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

View file

@ -19,6 +19,11 @@ describe Issue do
it { Issue.should respond_to :opened }
end
describe 'modules' do
it { should include_module(IssueCommonality) }
it { should include_module(Upvote) }
end
subject { Factory.create(:issue) }
describe '#is_being_reassigned?' do
@ -61,40 +66,6 @@ describe Issue do
subject.is_being_reopened?.should be_false
end
end
describe "plus 1" do
subject { Factory.create(:issue) }
it "with no notes has a 0/0 score" do
subject.upvotes.should == 0
end
it "should recognize non-+1 notes" do
subject.notes << Factory(:note, note: "No +1 here")
subject.should have(1).note
subject.notes.first.upvote?.should be_false
subject.upvotes.should == 0
end
it "should recognize a single +1 note" do
subject.notes << Factory(:note, note: "+1 This is awesome")
subject.upvotes.should == 1
end
it "should recognize a multiple +1 notes" do
subject.notes << Factory(:note, note: "+1 This is awesome")
subject.notes << Factory(:note, note: "+1 I want this")
subject.upvotes.should == 2
end
end
describe ".search" do
let!(:issue) { Factory.create(:issue, title: "Searchable issue") }
it "matches by title" do
Issue.search('able').all.should == [issue]
end
end
end
# == Schema Information
#

View file

@ -20,38 +20,9 @@ describe MergeRequest do
it { MergeRequest.should respond_to :opened }
end
describe "plus 1" do
subject { Factory.create(:merge_request) }
it "with no notes has a 0/0 score" do
subject.upvotes.should == 0
end
it "should recognize non-+1 notes" do
subject.notes << Factory(:note, note: "No +1 here")
subject.should have(1).note
subject.notes.first.upvote?.should be_false
subject.upvotes.should == 0
end
it "should recognize a single +1 note" do
subject.notes << Factory(:note, note: "+1 This is awesome")
subject.upvotes.should == 1
end
it "should recognize a multiple +1 notes" do
subject.notes << Factory(:note, note: "+1 This is awesome")
subject.notes << Factory(:note, note: "+1 I want this")
subject.upvotes.should == 2
end
end
describe ".search" do
let!(:issue) { Factory.create(:issue, title: "Searchable issue") }
it "matches by title" do
Issue.search('able').all.should == [issue]
end
describe 'modules' do
it { should include_module(IssueCommonality) }
it { should include_module(Upvote) }
end
end
# == Schema Information