-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spec for uploading, downloading, and removing completed service form
- Loading branch information
Showing
7 changed files
with
166 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "visit the manage service view", js: true do | ||
let(:admin) { users(:admin_user) } | ||
let(:steward) { users(:fifth_user) } | ||
let(:user) { users(:fourth_user) } | ||
|
||
before do | ||
organization.stewards << steward | ||
end | ||
|
||
let(:lottery) { lotteries(:lottery_with_tickets_and_draws) } | ||
let(:organization) { lottery.organization } | ||
let(:entrant) { lottery_entrants(:lottery_entrant_0004) } | ||
let(:person) { people(:bruno_fadel) } | ||
|
||
before { lottery.update(status: :finished) } | ||
|
||
scenario "user who is an admin" do | ||
login_as admin, scope: :user | ||
visit_page | ||
|
||
expect(page).to have_current_path(organization_lottery_entrant_service_detail_path(organization, lottery, entrant)) | ||
end | ||
|
||
scenario "user who is a steward" do | ||
login_as steward, scope: :user | ||
visit_page | ||
|
||
expect(page).to have_current_path(organization_lottery_entrant_service_detail_path(organization, lottery, entrant)) | ||
end | ||
|
||
scenario "user who has the same email as the entrant" do | ||
entrant.update!(email: user.email) | ||
login_as user, scope: :user | ||
visit_page | ||
|
||
expect(page).to have_current_path(organization_lottery_entrant_service_detail_path(organization, lottery, entrant)) | ||
end | ||
|
||
scenario "user who has the same person" do | ||
entrant.update!(person: person) | ||
person.update!(claimant: user) | ||
login_as user, scope: :user | ||
visit_page | ||
|
||
expect(page).to have_current_path(organization_lottery_entrant_service_detail_path(organization, lottery, entrant)) | ||
end | ||
|
||
scenario "user who is not associated" do | ||
login_as user, scope: :user | ||
visit_page | ||
|
||
expect(page).to have_current_path(root_path) | ||
expect(page).to have_text("Access denied") | ||
end | ||
|
||
def visit_page | ||
visit organization_lottery_entrant_service_detail_path(organization, lottery, entrant) | ||
end | ||
end |