Adds model and controller tests for Question.

This commit is contained in:
Stella Rouzi 2015-09-16 12:20:52 +03:00
parent e25425bd77
commit a04df00bdc
6 changed files with 311 additions and 24 deletions

View 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