diff options
Diffstat (limited to 'spec/models/build_spec.rb')
-rw-r--r-- | spec/models/build_spec.rb | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 17c3ba5..32a0446 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -50,60 +50,57 @@ describe Build do build.ci_skip?.should == false end end - + describe '#project_recipients' do context 'always sending notification' do it 'should return git_author_email as only recipient when no additional recipients are given' do - project = FactoryGirl.create :project, - email_add_committer: true, - email_recipients: '' - build = FactoryGirl.create :build, - status: :success, - project: project + project = FactoryGirl.create :project, + email_add_committer: true, + email_recipients: '' + build = FactoryGirl.create :build, + status: :success, + project: project expected = 'git_author_email' build.stub(:git_author_email) { expected } build.project_recipients.should == [expected] end it 'should return git_author_email and additional recipients' do - project = FactoryGirl.create :project, - email_add_committer: true, - email_recipients: 'rec1 rec2' - build = FactoryGirl.create :build, - status: :success, - project: project + project = FactoryGirl.create :project, + email_add_committer: true, + email_recipients: 'rec1 rec2' + build = FactoryGirl.create :build, + status: :success, + project: project expected = 'git_author_email' build.stub(:git_author_email) { expected } build.project_recipients.should == ['rec1', 'rec2', expected] end it 'should return recipients' do - project = FactoryGirl.create :project, - email_add_committer: false, - email_recipients: 'rec1 rec2' - build = FactoryGirl.create :build, - status: :success, - project: project + project = FactoryGirl.create :project, + email_add_committer: false, + email_recipients: 'rec1 rec2' + build = FactoryGirl.create :build, + status: :success, + project: project expected = 'git_author_email' build.stub(:git_author_email) { expected } build.project_recipients.should == ['rec1', 'rec2'] end it 'should return unique recipients only' do - project = FactoryGirl.create :project, - email_add_committer: true, - email_recipients: 'rec1 rec1 rec2' - build = FactoryGirl.create :build, - status: :success, - project: project + project = FactoryGirl.create :project, + email_add_committer: true, + email_recipients: 'rec1 rec1 rec2' + build = FactoryGirl.create :build, + status: :success, + project: project expected = 'rec2' build.stub(:git_author_email) { expected } build.project_recipients.should == ['rec1', 'rec2'] end end end - end - - |