spec/post_spec.rb in mongoid_rating-0.1.2 vs spec/post_spec.rb in mongoid_rating-0.1.3

- old
+ new

@@ -26,10 +26,27 @@ @post.rate! 1, @bob @post.rate_values.should eq [1] end end + it 'allows string rate' do + @post.rate! '5', @bob + @post.rate.should eql 5.0 + end + + it 'allows string rate' do + @post.rate! '3.2', @bob + @post.rate.should eql 3.2 + end + it '#fmt_rate' do + @post.fmt_rate.should eq '0.0' + @post.rate! '3.2', @bob + @post.fmt_rate.should eq '3.2' + @post.rate! '3', @bob + @post.fmt_rate.should eq '3.0' + end + context "when rated" do before (:each) do @post.rate! 1, @bob end @@ -51,18 +68,9 @@ context "when rate_value not in rating range" do it { expect { @post.rate 17, @sally }.to raise_error() } it { expect { @post.rate -17, @sally }.to raise_error() } end - it 'allows string rate' do - @post.rate! '5', @bob - @post.rate.should eql 5.0 - end - - it 'allows string rate' do - @post.rate! '3.2', @bob - @post.rate.should eql 3.2 - end end describe "#rated?" do describe "for Bob" do specify { @post.rate_by?(@bob).should be_true }