mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 14:39:52 +01:00
Add test for answer uniqueness
This commit is contained in:
parent
7b0a615193
commit
a74f40ecfc
1 changed files with 14 additions and 0 deletions
14
spec/integration/answer_uniqueness_spec.rb
Normal file
14
spec/integration/answer_uniqueness_spec.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
describe "Answer uniqueness" do
|
||||
let(:user) { FactoryBot.build(:user) }
|
||||
let(:question) { FactoryBot.create(:question) }
|
||||
|
||||
subject { 2.times { user.answer(question, "random") } }
|
||||
|
||||
it "does not allow answering the same question twice" do
|
||||
expect{ subject }.to raise_error(ActiveRecord::RecordInvalid)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue