Move IssueCommonality and Upvote specs out of models and into their own specs

This commit is contained in:
Robert Speicher 2012-08-29 01:52:19 -04:00
parent 14daf2e2ba
commit 9d4d40deed
4 changed files with 104 additions and 66 deletions

27
spec/roles/upvote_spec.rb Normal file
View file

@ -0,0 +1,27 @@
require 'spec_helper'
describe Issue, "Upvote" do
let(:issue) { create(:issue) }
it "with no notes has a 0/0 score" do
issue.upvotes.should == 0
end
it "should recognize non-+1 notes" do
issue.notes << create(:note, note: "No +1 here")
issue.should have(1).note
issue.notes.first.upvote?.should be_false
issue.upvotes.should == 0
end
it "should recognize a single +1 note" do
issue.notes << create(:note, note: "+1 This is awesome")
issue.upvotes.should == 1
end
it "should recognize multiple +1 notes" do
issue.notes << create(:note, note: "+1 This is awesome")
issue.notes << create(:note, note: "+1 I want this")
issue.upvotes.should == 2
end
end