adds specs
This commit is contained in:
@@ -30,7 +30,7 @@ feature 'Admin shifts' do
|
||||
expect(page).to have_content officer.name
|
||||
end
|
||||
|
||||
scenario "Create" do
|
||||
scenario "Create", :js do
|
||||
poll = create(:poll)
|
||||
booth = create(:poll_booth)
|
||||
officer = create(:poll_officer)
|
||||
@@ -41,10 +41,13 @@ feature 'Admin shifts' do
|
||||
click_link "Manage shifts"
|
||||
end
|
||||
|
||||
select I18n.l(poll.starts_at.to_date, format: :long), from: 'shift_date'
|
||||
select officer.name, from: 'shift_officer_id'
|
||||
click_button "Add shift"
|
||||
fill_in "search", with: officer.email
|
||||
click_button "Search"
|
||||
click_link "Edit shifts"
|
||||
|
||||
select I18n.l(poll.starts_at.to_date, format: :long), from: 'shift_date'
|
||||
click_button "Add shift"
|
||||
|
||||
expect(page).to have_content "Shift added"
|
||||
|
||||
within("#shifts") do
|
||||
@@ -54,6 +57,25 @@ feature 'Admin shifts' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Erros on create", :js do
|
||||
poll = create(:poll)
|
||||
booth = create(:poll_booth)
|
||||
officer = create(:poll_officer)
|
||||
|
||||
visit admin_booths_path
|
||||
|
||||
within("#booth_#{booth.id}") do
|
||||
click_link "Manage shifts"
|
||||
end
|
||||
|
||||
fill_in "search", with: officer.email
|
||||
click_button "Search"
|
||||
click_link "Edit shifts"
|
||||
click_button "Add shift"
|
||||
|
||||
expect(page).to have_content "can't be blank"
|
||||
end
|
||||
|
||||
scenario "Destroy" do
|
||||
poll = create(:poll)
|
||||
booth = create(:poll_booth)
|
||||
|
||||
Reference in New Issue
Block a user