Skip to content

Commit

Permalink
Added director context to users_controller_spec.rb.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhiiva committed Jul 6, 2021
1 parent 835c7ef commit c96dd93
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,28 @@
end
end

context "as director" do
let(:director) { create :director }

before do
sign_in director
end

describe '#edit' do
it "can edit tournament" do
tournament_one = create :tournament, year: user.year
get :edit_tournament, params: { id: tournament_one.id, year: user.year }
expect(response).to be_successful
end
it "from wrong year raises RecordNotFound" do
sign_in create :staff, year: wrong_year
expect {
get :edit_tournament, params: { id: tournament_one.id, year: wrong_year }
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
end

context "as an admin" do
before do
sign_in create :admin
Expand Down

0 comments on commit c96dd93

Please sign in to comment.