Commit 602762b98d495e31ba481ff0e4aba81ba634d0c5
1 parent
5a8e79d5
Exists in
master
and in
1 other branch
add test for new revision to question on edit
Showing
1 changed file
with
7 additions
and
0 deletions
Show diff stats
spec/models/question_spec.rb
| @@ -31,6 +31,13 @@ describe Question do | @@ -31,6 +31,13 @@ describe Question do | ||
| 31 | aoiquestion.median_votes_per_session.should == 2 | 31 | aoiquestion.median_votes_per_session.should == 2 |
| 32 | end | 32 | end |
| 33 | 33 | ||
| 34 | + it "should create a new revision if modified" do | ||
| 35 | + oldVer = @question.version | ||
| 36 | + @question.name = "some new name" | ||
| 37 | + @question.save | ||
| 38 | + @question.version.should == oldVer + 1 | ||
| 39 | + end | ||
| 40 | + | ||
| 34 | it "should create a new instance given valid attributes" do | 41 | it "should create a new instance given valid attributes" do |
| 35 | # Factory.attributes_for does not return associations, this is a good enough substitute | 42 | # Factory.attributes_for does not return associations, this is a good enough substitute |
| 36 | Question.create!(Factory.build(:question).attributes.symbolize_keys) | 43 | Question.create!(Factory.build(:question).attributes.symbolize_keys) |