Simplify login for officer user in tests
The same way it's done in other places. We also remove a useless assignment.
This commit is contained in:
@@ -47,8 +47,7 @@ describe "Admin" do
|
||||
end
|
||||
|
||||
scenario "Access as poll officer is not authorized" do
|
||||
create(:poll_officer, user: user)
|
||||
login_as(user)
|
||||
login_as(create(:poll_officer).user)
|
||||
visit admin_root_path
|
||||
|
||||
expect(page).not_to have_current_path(admin_root_path)
|
||||
|
||||
@@ -5,13 +5,11 @@ describe "Budget Poll Officing" do
|
||||
scenario "Show sidebar menus if officer has shifts assigned" do
|
||||
booth = create(:poll_booth)
|
||||
booth_assignment = create(:poll_booth_assignment, booth: booth)
|
||||
|
||||
user = create(:user)
|
||||
officer = create(:poll_officer, user: user)
|
||||
officer = create(:poll_officer)
|
||||
|
||||
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
||||
|
||||
login_as user
|
||||
login_as officer.user
|
||||
visit officing_root_path
|
||||
|
||||
expect(page).not_to have_content("You don't have officing shifts today")
|
||||
@@ -32,10 +30,8 @@ describe "Budget Poll Officing" do
|
||||
end
|
||||
|
||||
scenario "Do not show sidebar menus if officer has no shifts assigned" do
|
||||
user = create(:user)
|
||||
officer = create(:poll_officer, user: user)
|
||||
login_as(create(:poll_officer).user)
|
||||
|
||||
login_as user
|
||||
visit officing_root_path
|
||||
|
||||
expect(page).to have_content("You don't have officing shifts today")
|
||||
|
||||
@@ -129,10 +129,8 @@ describe "Poll Officing" do
|
||||
booth = create(:poll_booth)
|
||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||
|
||||
user1 = create(:user)
|
||||
user2 = create(:user)
|
||||
officer1 = create(:poll_officer, user: user1)
|
||||
officer2 = create(:poll_officer, user: user2)
|
||||
officer1 = create(:poll_officer)
|
||||
officer2 = create(:poll_officer)
|
||||
|
||||
create(:poll_shift, officer: officer1, booth: booth, date: Date.current, task: :vote_collection)
|
||||
create(:poll_shift, officer: officer2, booth: booth, date: Date.current, task: :vote_collection)
|
||||
@@ -141,12 +139,12 @@ describe "Poll Officing" do
|
||||
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment, officer: officer2)
|
||||
|
||||
in_browser(:one) do
|
||||
login_as user1
|
||||
login_as officer1.user
|
||||
visit officing_root_path
|
||||
end
|
||||
|
||||
in_browser(:two) do
|
||||
login_as user2
|
||||
login_as officer2.user
|
||||
visit officing_root_path
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user