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:
Javi Martín
2019-09-23 00:23:19 +02:00
parent 175163adb6
commit 24aa4744f1
3 changed files with 8 additions and 15 deletions

View File

@@ -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")