Skip to content

Commit

Permalink
Test multiple field entry/saving.
Browse files Browse the repository at this point in the history
Co-authored-by: Anna Headley <[email protected]>
  • Loading branch information
tpendragon and hackartisan committed Jul 25, 2022
1 parent 3f8a807 commit cfef5aa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion spec/features/simple_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
expect(page).to have_css("title", text: "#{simple_resource.title.first} - Figgy", visible: false)
end

scenario "creating a new resource" do
scenario "creating a new resource", js: true do
visit new_simple_scanned_resources_path

expect(page).to have_field "Title"
Expand Down Expand Up @@ -66,11 +66,22 @@
# expect(page).to have_field "Subject"
expect(page.find("#scanned_resource_change_set", visible: false).value).to eq "simple"

click_button "Add another Title"
expect(page).to have_content "cannot add another"
fill_in "Title", with: "Test Title"
click_button "Add another Title"
input = find_all("*[name='scanned_resource[title][]']").last
input.fill_in(with: "Second Title")
click_button "Add another Title"
input = find_all("*[name='scanned_resource[title][]']").last
input.fill_in(with: "Third Title")
find_all("button.btn-link.remove").last.click
# fill_in "Contributor", with: "Test Contributor"
click_button "Save"

expect(page).to have_content "Test Title"
expect(page).to have_content "Second Title"
expect(page).not_to have_content "Third Title"
end

scenario "creating an invalid resource" do
Expand Down

0 comments on commit cfef5aa

Please sign in to comment.