Commit 752eb2c11d9125d9b7b60bc7719db954ebb1d9a5

Authored by Dmitriy Zaporozhets
1 parent b059de2a

more tests fixed

spec/lib/votes_spec.rb
1 require 'spec_helper' 1 require 'spec_helper'
2 2
3 -describe Issue do  
4 - it { should include_module(Votes) }  
5 -end  
6 -  
7 describe MergeRequest do 3 describe MergeRequest do
8 let(:merge_request) { FactoryGirl.create(:merge_request_with_diffs) } 4 let(:merge_request) { FactoryGirl.create(:merge_request_with_diffs) }
9 5
10 - it { should include_module(Votes) }  
11 -  
12 describe "#upvotes" do 6 describe "#upvotes" do
13 it "with no notes has a 0/0 score" do 7 it "with no notes has a 0/0 score" do
14 merge_request.upvotes.should == 0 8 merge_request.upvotes.should == 0
spec/mailers/notify_spec.rb
@@ -191,7 +191,7 @@ describe Notify do @@ -191,7 +191,7 @@ describe Notify do
191 let(:note) { create(:note, project: project, author: note_author) } 191 let(:note) { create(:note, project: project, author: note_author) }
192 192
193 before :each do 193 before :each do
194 - Note.stub(:find).with(note.id).and_return(note) 194 + Note.stub(:find).with(note.id).and_return(note)
195 end 195 end
196 196
197 shared_examples 'a note email' do 197 shared_examples 'a note email' do
@@ -233,9 +233,10 @@ describe Notify do @@ -233,9 +233,10 @@ describe Notify do
233 commit.stub(:safe_message).and_return('some message') 233 commit.stub(:safe_message).and_return('some message')
234 end 234 end
235 end 235 end
  236 +
236 before(:each) { note.stub(:noteable).and_return(commit) } 237 before(:each) { note.stub(:noteable).and_return(commit) }
237 238
238 - subject { Notify.note_commit_email(recipient.id, note.id) } 239 + subject { Notify.note_commit_email(recipient.email, note.id) }
239 240
240 it_behaves_like 'a note email' 241 it_behaves_like 'a note email'
241 242
spec/observers/note_observer_spec.rb
@@ -41,8 +41,9 @@ describe NoteObserver do @@ -41,8 +41,9 @@ describe NoteObserver do
41 41
42 it 'notifies the author of a commit when flagged to notify the author' do 42 it 'notifies the author of a commit when flagged to notify the author' do
43 note.stub(:notify_author).and_return(true) 43 note.stub(:notify_author).and_return(true)
  44 + note.stub(:noteable).and_return(double(author_email: 'test@test.com'))
44 note.stub(:id).and_return(42) 45 note.stub(:id).and_return(42)
45 - author = double :user, id: 1 46 + author = double :user, id: 1, email: 'test@test.com'
46 note.stub(:commit_author).and_return(author) 47 note.stub(:commit_author).and_return(author)
47 Notify.should_receive(:note_commit_email) 48 Notify.should_receive(:note_commit_email)
48 49