Merge pull request #1692 from riyad/saner-note-methods

Small Note code cleanup
This commit is contained in:
Dmitriy Zaporozhets 2012-10-15 10:11:00 -07:00
commit e84d90c1e7
7 changed files with 39 additions and 18 deletions

View file

@ -235,7 +235,7 @@ describe Notify do
commit.stub(:safe_message).and_return('some message')
end
end
before(:each) { note.stub(:target).and_return(commit) }
before(:each) { note.stub(:noteable).and_return(commit) }
subject { Notify.note_commit_email(recipient.id, note.id) }

View file

@ -85,9 +85,19 @@ describe Note do
noteable_type: "Commit"
end
it "should be accessible through #noteable" do
@note.noteable_id.should == commit.id
@note.noteable.should be_a(Commit)
@note.noteable.should == commit
end
it "should save a valid note" do
@note.noteable_id.should == commit.id
@note.target.id.should == commit.id
@note.noteable == commit
end
it "should be recognized by #for_commit?" do
@note.should be_for_commit
end
end
@ -101,7 +111,11 @@ describe Note do
it "should save a valid note" do
@note.noteable_id.should == commit.id
@note.target.id.should == commit.id
@note.noteable.id.should == commit.id
end
it "should be recognized by #for_diff_line?" do
@note.should be_for_diff_line
end
end