-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added question_spec which was missing before
Moved webdriver tests to their own dir (out of features/)
- Loading branch information
1 parent
f67d8b8
commit ce95823
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
|
||
describe Question do | ||
describe 'new' do | ||
before :each do | ||
@q = Question.new :text => 'text', :answers => ['a', '', 'c'], :explanation => 'expl', :correct_answer_index => 1 | ||
end | ||
specify 'when valid' do | ||
@q.should be_valid | ||
@q.should have(2).answers | ||
end | ||
specify 'with all blank answers' do | ||
@q.answers = ['', ''] | ||
@q.should_not be_valid | ||
@q.should have(1).errors_on(:answers) | ||
end | ||
specify 'with empty text' do | ||
@q.text = '' | ||
@q. should_not be_valid | ||
@q.should have(1).errors_on(:text) | ||
end | ||
specify 'with correct answer index out of range' do | ||
@q.correct_answer_index = 2 | ||
@q.should_not be_valid | ||
@q.errors_on(:correct_answer_index).should include('must be less than or equal to 1') | ||
end | ||
end | ||
end |
File renamed without changes.