Commit c4fa894d authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix specs

parent 80f8074d
...@@ -31,6 +31,7 @@ class Service < ActiveRecord::Base ...@@ -31,6 +31,7 @@ class Service < ActiveRecord::Base
default_value_for :tag_push_events, true default_value_for :tag_push_events, true
default_value_for :note_events, true default_value_for :note_events, true
default_value_for :build_events, true default_value_for :build_events, true
default_value_for :properties, {}
after_initialize :initialize_properties after_initialize :initialize_properties
......
...@@ -55,11 +55,11 @@ Feature: Project Services ...@@ -55,11 +55,11 @@ Feature: Project Services
And I fill Pushover settings And I fill Pushover settings
Then I should see Pushover service settings saved Then I should see Pushover service settings saved
Scenario: Activate email service Scenario: Activate email on push service
When I visit project "Shop" services page When I visit project "Shop" services page
And I click email service link And I click email on push service link
And I fill email settings And I fill email on push settings
Then I should see email service settings saved Then I should see email on push service settings saved
Scenario: Activate Irker (IRC Gateway) service Scenario: Activate Irker (IRC Gateway) service
When I visit project "Shop" services page When I visit project "Shop" services page
......
...@@ -118,16 +118,16 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps ...@@ -118,16 +118,16 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
expect(find_field('Restrict to branch').value).to eq 'master' expect(find_field('Restrict to branch').value).to eq 'master'
end end
step 'I click email service link' do step 'I click email on push service link' do
click_link 'Emails' click_link 'Emails on push'
end end
step 'I fill email settings' do step 'I fill email on push settings' do
fill_in 'Recipients', with: 'qa@company.name' fill_in 'Recipients', with: 'qa@company.name'
click_button 'Save' click_button 'Save'
end end
step 'I should see email service settings saved' do step 'I should see email on push service settings saved' do
expect(find_field('Recipients').value).to eq 'qa@company.name' expect(find_field('Recipients').value).to eq 'qa@company.name'
end end
......
...@@ -25,7 +25,7 @@ describe SlackService::BuildMessage do ...@@ -25,7 +25,7 @@ describe SlackService::BuildMessage do
let(:color) { 'good' } let(:color) { 'good' }
it 'returns a message with information about succeeded build' do it 'returns a message with information about succeeded build' do
message = '<somewhere.com|project_name>: Commit <somewhere.com/commit/97de212e80737a608d939f648d959671fb0a0142/builds|97de212e> of <somewhere.com/commits/develop|develop> branch by hacker succeeded in 10 second(s)' message = '<somewhere.com|project_name>: Commit <somewhere.com/commit/97de212e80737a608d939f648d959671fb0a0142/builds|97de212e> of <somewhere.com/commits/develop|develop> branch by hacker passed in 10 second(s)'
expect(subject.pretext).to be_empty expect(subject.pretext).to be_empty
expect(subject.fallback).to eq(message) expect(subject.fallback).to eq(message)
expect(subject.attachments).to eq([text: message, color: color]) expect(subject.attachments).to eq([text: message, color: color])
......
...@@ -16,7 +16,7 @@ describe BuildEmailWorker do ...@@ -16,7 +16,7 @@ describe BuildEmailWorker do
describe "#perform" do describe "#perform" do
it "sends mail" do it "sends mail" do
subject.perform(build.id, user.email, data.stringify_keys) subject.perform(build.id, [user.email], data.stringify_keys)
email = ActionMailer::Base.deliveries.last email = ActionMailer::Base.deliveries.last
expect(email.subject).to include('Build success for') expect(email.subject).to include('Build success for')
...@@ -27,7 +27,7 @@ describe BuildEmailWorker do ...@@ -27,7 +27,7 @@ describe BuildEmailWorker do
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
allow(Notify).to receive(:build_success_email).and_raise(Net::SMTPFatalError) allow(Notify).to receive(:build_success_email).and_raise(Net::SMTPFatalError)
subject.perform(build.id, user.email, data.stringify_keys) subject.perform(build.id, [user.email], data.stringify_keys)
expect(ActionMailer::Base.deliveries.count).to eq(0) expect(ActionMailer::Base.deliveries.count).to eq(0)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment