Adds model and controller tests for Question.
This commit is contained in:
parent
e25425bd77
commit
a04df00bdc
6 changed files with 311 additions and 24 deletions
22
spec/models/question_spec.rb
Normal file
22
spec/models/question_spec.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Question do
|
||||
|
||||
describe 'validations' do
|
||||
|
||||
it 'has a valid factory' do
|
||||
expect(build(:question)).to be_valid
|
||||
end
|
||||
|
||||
it 'is not valid without a title' do
|
||||
should validate_presence_of(:title)
|
||||
expect(build(:question, title: nil)).not_to be_valid
|
||||
end
|
||||
|
||||
it 'is not valid without a question type' do
|
||||
should validate_presence_of(:question_type_id)
|
||||
expect(build(:question, question_type_id: nil)).not_to be_valid
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue