From 752eb2c11d9125d9b7b60bc7719db954ebb1d9a5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 15 Jan 2013 16:36:35 +0200 Subject: [PATCH] more tests fixed --- spec/lib/votes_spec.rb | 6 ------ spec/mailers/notify_spec.rb | 5 +++-- spec/observers/note_observer_spec.rb | 3 ++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/spec/lib/votes_spec.rb b/spec/lib/votes_spec.rb index 7e49ac78..b49ed15b 100644 --- a/spec/lib/votes_spec.rb +++ b/spec/lib/votes_spec.rb @@ -1,14 +1,8 @@ require 'spec_helper' -describe Issue do - it { should include_module(Votes) } -end - describe MergeRequest do let(:merge_request) { FactoryGirl.create(:merge_request_with_diffs) } - it { should include_module(Votes) } - describe "#upvotes" do it "with no notes has a 0/0 score" do merge_request.upvotes.should == 0 diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index e5b4cdaf..01e3c3f1 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -191,7 +191,7 @@ describe Notify do let(:note) { create(:note, project: project, author: note_author) } before :each do - Note.stub(:find).with(note.id).and_return(note) + Note.stub(:find).with(note.id).and_return(note) end shared_examples 'a note email' do @@ -233,9 +233,10 @@ describe Notify do commit.stub(:safe_message).and_return('some message') end end + before(:each) { note.stub(:noteable).and_return(commit) } - subject { Notify.note_commit_email(recipient.id, note.id) } + subject { Notify.note_commit_email(recipient.email, note.id) } it_behaves_like 'a note email' diff --git a/spec/observers/note_observer_spec.rb b/spec/observers/note_observer_spec.rb index 73da2e14..8ad42c21 100644 --- a/spec/observers/note_observer_spec.rb +++ b/spec/observers/note_observer_spec.rb @@ -41,8 +41,9 @@ describe NoteObserver do it 'notifies the author of a commit when flagged to notify the author' do note.stub(:notify_author).and_return(true) + note.stub(:noteable).and_return(double(author_email: 'test@test.com')) note.stub(:id).and_return(42) - author = double :user, id: 1 + author = double :user, id: 1, email: 'test@test.com' note.stub(:commit_author).and_return(author) Notify.should_receive(:note_commit_email)