When I have a test case written like this:
it "creates a slot" do
expect(p = FactoryGirl.create(:position)).to be_valid()
expect(p = FactoryGirl.create(:experience)).to be_valid()
visit new_slot_path
expect(page).to have_content("New Slot")
fill_in "slot_name", :with => "Slot test"
select p.position, from: "slot_position_id"
click_link "Add Education Experience"
select e.experience, from: "slot_slots_experiences_attributes_experience_id"
click_button "Create Slot"
end
It cannot find the experience to add. How ever the exact same test written like this, the drop down for experience exists, but the other drop downs for position go missing.
it "creates a slot", :js => true do
expect(p = FactoryGirl.create(:position)).to be_valid()
expect(p = FactoryGirl.create(:experience)).to be_valid()
visit new_slot_path
expect(page).to have_content("New Slot")
fill_in "slot_name", :with => "Slot test"
select p.position, from: "slot_position_id"
click_link "Add Education Experience"
select e.experience, from: "slot_slots_experiences_attributes_experience_id"
click_button "Create Slot"
end
Aucun commentaire:
Enregistrer un commentaire