Skip to content

Commit

Permalink
Update Answers controller POST #mark tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
metacorn committed Jun 26, 2019
1 parent 6573a52 commit 3cd0a05
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions spec/controllers/answers_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,12 @@
let!(:answer3) { create(:answer, question: question1, user: user2) }

context 'authenticated user' do
before { login(user1) }
before do
login(user1)
answer2.best = true
end

it 'marks answers to his question' do
post :mark, params: { id: answer2 }, format: :js
answer2.reload

expect(answer2).to be_best

post :mark, params: { id: answer3 }, format: :js
answer2.reload
answer3.reload
Expand All @@ -225,7 +223,7 @@
it "tries to mark an answer to another user's question" do
post :mark, params: { id: answer1 }, format: :js

expect(answer2).to_not be_best
expect(answer1).to_not be_best
end
end

Expand Down

0 comments on commit 3cd0a05

Please sign in to comment.