Add tests for Answer Model
This commit is contained in:
parent
89af26bf18
commit
214d0edb70
1 changed files with 16 additions and 0 deletions
16
spec/models/answer_spec.rb
Normal file
16
spec/models/answer_spec.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Answer do
|
||||||
|
describe 'association' do
|
||||||
|
it { should have_many :qanswers }
|
||||||
|
it { should have_many(:questions).through(:qanswers) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'validation' do
|
||||||
|
it 'has valid factory' do
|
||||||
|
expect(build(:answer)).to be_valid
|
||||||
|
end
|
||||||
|
|
||||||
|
it{ is_expected.to validate_presence_of(:title) }
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue