Skip to content
Snippets Groups Projects
Commit 77053a6c authored by Robert Speicher's avatar Robert Speicher
Browse files

Convert to RSpec3 syntax via transpec

Command:

    transpec -c 'bundle exec rspec spec -t ~feature' \
    -o should,oneliner,should_receive
parent 74b995d1
No related branches found
No related tags found
No related merge requests found
Showing
with 217 additions and 217 deletions
Loading
@@ -42,7 +42,7 @@ describe "Admin Runners", feature: true do
Loading
@@ -42,7 +42,7 @@ describe "Admin Runners", feature: true do
end end
   
describe 'runner info' do describe 'runner info' do
it { find_field('runner_token').value.should eq runner.token } it { expect(find_field('runner_token').value).to eq runner.token }
end end
   
describe 'projects' do describe 'projects' do
Loading
Loading
Loading
@@ -39,7 +39,7 @@ describe "Projects", feature: true do
Loading
@@ -39,7 +39,7 @@ describe "Projects", feature: true do
   
expect(page).to have_content 'was successfully updated' expect(page).to have_content 'was successfully updated'
   
find_field('Timeout').value.should eq '70' expect(find_field('Timeout').value).to eq '70'
end end
end end
   
Loading
Loading
Loading
@@ -60,7 +60,7 @@ describe "Runners", feature: true do
Loading
@@ -60,7 +60,7 @@ describe "Runners", feature: true do
click_on "Remove runner" click_on "Remove runner"
end end
   
Runner.exists?(id: @specific_runner).should be_falsey expect(Runner.exists?(id: @specific_runner)).to be_falsey
end end
end end
   
Loading
@@ -75,7 +75,7 @@ describe "Runners", feature: true do
Loading
@@ -75,7 +75,7 @@ describe "Runners", feature: true do
   
click_on "Enable shared runners" click_on "Enable shared runners"
   
@project.reload.shared_runners_enabled.should be_truthy expect(@project.reload.shared_runners_enabled).to be_truthy
end end
end end
   
Loading
Loading
Loading
@@ -11,7 +11,7 @@ describe 'Variables', feature: true do
Loading
@@ -11,7 +11,7 @@ describe 'Variables', feature: true do
context 'create a trigger' do context 'create a trigger' do
before do before do
click_on 'Add Trigger' click_on 'Add Trigger'
@project.triggers.count.should eq 1 expect(@project.triggers.count).to eq 1
end end
   
it 'contains trigger token' do it 'contains trigger token' do
Loading
@@ -20,7 +20,7 @@ describe 'Variables', feature: true do
Loading
@@ -20,7 +20,7 @@ describe 'Variables', feature: true do
   
it 'revokes the trigger' do it 'revokes the trigger' do
click_on 'Revoke' click_on 'Revoke'
@project.triggers.count.should eq 0 expect(@project.triggers.count).to eq 0
end end
end end
end end
Loading
@@ -19,7 +19,7 @@ describe "Variables", feature: true do
Loading
@@ -19,7 +19,7 @@ describe "Variables", feature: true do
click_on "Save changes" click_on "Save changes"
expect(page).to have_content("Variables were successfully updated.") expect(page).to have_content("Variables were successfully updated.")
@project.variables.count.should eq 1 expect(@project.variables.count).to eq 1
end end
   
end end
Loading
Loading
Loading
@@ -11,12 +11,12 @@ describe ApplicationHelper do
Loading
@@ -11,12 +11,12 @@ describe ApplicationHelper do
} }
   
intervals_in_words.each do |interval, expectation| intervals_in_words.each do |interval, expectation|
duration_in_words(Time.now + interval, Time.now).should eq expectation expect(duration_in_words(Time.now + interval, Time.now)).to eq expectation
end end
end end
   
it "calculates interval from now if there is no finished_at" do it "calculates interval from now if there is no finished_at" do
duration_in_words(nil, Time.now - 5).should eq "5 seconds" expect(duration_in_words(nil, Time.now - 5)).to eq "5 seconds"
end end
end end
   
Loading
@@ -30,7 +30,7 @@ describe ApplicationHelper do
Loading
@@ -30,7 +30,7 @@ describe ApplicationHelper do
} }
   
intervals_in_words.each do |interval, expectation| intervals_in_words.each do |interval, expectation|
time_interval_in_words(interval).should eq expectation expect(time_interval_in_words(interval)).to eq expectation
end end
end end
end end
Loading
Loading
Loading
@@ -3,16 +3,16 @@ require 'spec_helper'
Loading
@@ -3,16 +3,16 @@ require 'spec_helper'
describe RunnersHelper do describe RunnersHelper do
it "returns - not contacted yet" do it "returns - not contacted yet" do
runner = FactoryGirl.build :runner runner = FactoryGirl.build :runner
runner_status_icon(runner).should include("not connected yet") expect(runner_status_icon(runner)).to include("not connected yet")
end end
   
it "returns offline text" do it "returns offline text" do
runner = FactoryGirl.build(:runner, contacted_at: 1.day.ago, active: true) runner = FactoryGirl.build(:runner, contacted_at: 1.day.ago, active: true)
runner_status_icon(runner).should include("Runner is offline") expect(runner_status_icon(runner)).to include("Runner is offline")
end end
   
it "returns online text" do it "returns online text" do
runner = FactoryGirl.build(:runner, contacted_at: 1.hour.ago, active: true) runner = FactoryGirl.build(:runner, contacted_at: 1.hour.ago, active: true)
runner_status_icon(runner).should include("Runner is online") expect(runner_status_icon(runner)).to include("Runner is online")
end end
end end
Loading
@@ -8,7 +8,7 @@ describe UserHelper do
Loading
@@ -8,7 +8,7 @@ describe UserHelper do
let (:avatar_url) { nil } let (:avatar_url) { nil }
   
it 'should return a generic avatar' do it 'should return a generic avatar' do
user_avatar_url(user).should eq 'no_avatar.png' expect(user_avatar_url(user)).to eq 'no_avatar.png'
end end
end end
   
Loading
@@ -17,11 +17,11 @@ describe UserHelper do
Loading
@@ -17,11 +17,11 @@ describe UserHelper do
let (:avatar_url) { "#{base_url}?s=40&d=mm" } let (:avatar_url) { "#{base_url}?s=40&d=mm" }
   
it 'should return gravatar with default size' do it 'should return gravatar with default size' do
user_avatar_url(user).should eq "#{base_url}?s=40&d=identicon" expect(user_avatar_url(user)).to eq "#{base_url}?s=40&d=identicon"
end end
   
it 'should return gravatar with custom size' do it 'should return gravatar with custom size' do
user_avatar_url(user, 120).should eq "#{base_url}?s=120&d=identicon" expect(user_avatar_url(user, 120)).to eq "#{base_url}?s=120&d=identicon"
end end
end end
   
Loading
@@ -30,11 +30,11 @@ describe UserHelper do
Loading
@@ -30,11 +30,11 @@ describe UserHelper do
let (:avatar_url) { "#{base_url}?s=40&d=mm" } let (:avatar_url) { "#{base_url}?s=40&d=mm" }
   
it 'should return gravatar with default size' do it 'should return gravatar with default size' do
user_avatar_url(user).should eq "#{base_url}?s=40&d=identicon" expect(user_avatar_url(user)).to eq "#{base_url}?s=40&d=identicon"
end end
   
it 'should return gravatar with custom size' do it 'should return gravatar with custom size' do
user_avatar_url(user, 120).should eq "#{base_url}?s=120&d=identicon" expect(user_avatar_url(user, 120)).to eq "#{base_url}?s=120&d=identicon"
end end
end end
   
Loading
@@ -42,7 +42,7 @@ describe UserHelper do
Loading
@@ -42,7 +42,7 @@ describe UserHelper do
let (:avatar_url) { 'http://example.local/avatar.png' } let (:avatar_url) { 'http://example.local/avatar.png' }
   
it 'should return custom avatar' do it 'should return custom avatar' do
user_avatar_url(user).should eq avatar_url expect(user_avatar_url(user)).to eq avatar_url
end end
end end
end end
Loading
Loading
Loading
@@ -7,17 +7,17 @@ describe UserSessionsHelper do
Loading
@@ -7,17 +7,17 @@ describe UserSessionsHelper do
let (:return_to) { 'b' } let (:return_to) { 'b' }
   
it 'should return null if return_to is also null' do it 'should return null if return_to is also null' do
generate_oauth_hmac(salt, nil).should be_nil expect(generate_oauth_hmac(salt, nil)).to be_nil
end end
   
it 'should return not null if return_to is also not null' do it 'should return not null if return_to is also not null' do
generate_oauth_hmac(salt, return_to).should_not be_nil expect(generate_oauth_hmac(salt, return_to)).not_to be_nil
end end
   
it 'should return different hmacs for different salts' do it 'should return different hmacs for different salts' do
secret1 = generate_oauth_hmac(salt, return_to) secret1 = generate_oauth_hmac(salt, return_to)
secret2 = generate_oauth_hmac(salt2, return_to) secret2 = generate_oauth_hmac(salt2, return_to)
secret1.should_not eq(secret2) expect(secret1).not_to eq(secret2)
end end
end end
   
Loading
@@ -25,13 +25,13 @@ describe UserSessionsHelper do
Loading
@@ -25,13 +25,13 @@ describe UserSessionsHelper do
let (:return_to) { 'b' } let (:return_to) { 'b' }
   
it 'should return null if return_to is also null' do it 'should return null if return_to is also null' do
generate_oauth_state(nil).should be_nil expect(generate_oauth_state(nil)).to be_nil
end end
   
it 'should return two different states for same return_to' do it 'should return two different states for same return_to' do
state1 = generate_oauth_state(return_to) state1 = generate_oauth_state(return_to)
state2 = generate_oauth_state(return_to) state2 = generate_oauth_state(return_to)
state1.should_not eq(state2) expect(state1).not_to eq(state2)
end end
end end
   
Loading
@@ -40,7 +40,7 @@ describe UserSessionsHelper do
Loading
@@ -40,7 +40,7 @@ describe UserSessionsHelper do
let (:state) { generate_oauth_state(return_to) } let (:state) { generate_oauth_state(return_to) }
   
it 'should return return_to' do it 'should return return_to' do
get_ouath_state_return_to(state).should eq(return_to) expect(get_ouath_state_return_to(state)).to eq(return_to)
end end
end end
   
Loading
@@ -53,17 +53,17 @@ describe UserSessionsHelper do
Loading
@@ -53,17 +53,17 @@ describe UserSessionsHelper do
let (:invalid3) { 'aa:bb:' } let (:invalid3) { 'aa:bb:' }
   
it 'should validate oauth state' do it 'should validate oauth state' do
is_oauth_state_valid?(state).should be_truthy expect(is_oauth_state_valid?(state)).to be_truthy
end end
   
it 'should not validate forged state' do it 'should not validate forged state' do
is_oauth_state_valid?(forged).should be_falsey expect(is_oauth_state_valid?(forged)).to be_falsey
end end
   
it 'should not validate invalid state' do it 'should not validate invalid state' do
is_oauth_state_valid?(invalid).should be_falsey expect(is_oauth_state_valid?(invalid)).to be_falsey
is_oauth_state_valid?(invalid2).should be_falsey expect(is_oauth_state_valid?(invalid2)).to be_falsey
is_oauth_state_valid?(invalid3).should be_falsey expect(is_oauth_state_valid?(invalid3)).to be_falsey
end end
end end
end end
Loading
@@ -3,131 +3,131 @@ require 'spec_helper'
Loading
@@ -3,131 +3,131 @@ require 'spec_helper'
describe Ansi2html do describe Ansi2html do
   
it "prints non-ansi as-is" do it "prints non-ansi as-is" do
described_class::convert("Hello").should eq 'Hello' expect(described_class::convert("Hello")).to eq 'Hello'
end end
   
it "strips non-color-changing controll sequences" do it "strips non-color-changing controll sequences" do
described_class::convert("Hello \e[2Kworld").should eq 'Hello world' expect(described_class::convert("Hello \e[2Kworld")).to eq 'Hello world'
end end
   
it "prints simply red" do it "prints simply red" do
described_class::convert("\e[31mHello\e[0m").should eq '<span class="term-fg-red">Hello</span>' expect(described_class::convert("\e[31mHello\e[0m")).to eq '<span class="term-fg-red">Hello</span>'
end end
   
it "prints simply red without trailing reset" do it "prints simply red without trailing reset" do
described_class::convert("\e[31mHello").should eq '<span class="term-fg-red">Hello</span>' expect(described_class::convert("\e[31mHello")).to eq '<span class="term-fg-red">Hello</span>'
end end
   
it "prints simply yellow" do it "prints simply yellow" do
described_class::convert("\e[33mHello\e[0m").should eq '<span class="term-fg-yellow">Hello</span>' expect(described_class::convert("\e[33mHello\e[0m")).to eq '<span class="term-fg-yellow">Hello</span>'
end end
   
it "prints default on blue" do it "prints default on blue" do
described_class::convert("\e[39;44mHello").should eq '<span class="term-bg-blue">Hello</span>' expect(described_class::convert("\e[39;44mHello")).to eq '<span class="term-bg-blue">Hello</span>'
end end
   
it "prints red on blue" do it "prints red on blue" do
described_class::convert("\e[31;44mHello").should eq '<span class="term-fg-red term-bg-blue">Hello</span>' expect(described_class::convert("\e[31;44mHello")).to eq '<span class="term-fg-red term-bg-blue">Hello</span>'
end end
   
it "resets colors after red on blue" do it "resets colors after red on blue" do
described_class::convert("\e[31;44mHello\e[0m world").should eq '<span class="term-fg-red term-bg-blue">Hello</span> world' expect(described_class::convert("\e[31;44mHello\e[0m world")).to eq '<span class="term-fg-red term-bg-blue">Hello</span> world'
end end
   
it "performs color change from red/blue to yellow/blue" do it "performs color change from red/blue to yellow/blue" do
described_class::convert("\e[31;44mHello \e[33mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-blue">world</span>' expect(described_class::convert("\e[31;44mHello \e[33mworld")).to eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-blue">world</span>'
end end
   
it "performs color change from red/blue to yellow/green" do it "performs color change from red/blue to yellow/green" do
described_class::convert("\e[31;44mHello \e[33;42mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-green">world</span>' expect(described_class::convert("\e[31;44mHello \e[33;42mworld")).to eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-green">world</span>'
end end
   
it "performs color change from red/blue to reset to yellow/green" do it "performs color change from red/blue to reset to yellow/green" do
described_class::convert("\e[31;44mHello\e[0m \e[33;42mworld").should eq '<span class="term-fg-red term-bg-blue">Hello</span> <span class="term-fg-yellow term-bg-green">world</span>' expect(described_class::convert("\e[31;44mHello\e[0m \e[33;42mworld")).to eq '<span class="term-fg-red term-bg-blue">Hello</span> <span class="term-fg-yellow term-bg-green">world</span>'
end end
   
it "ignores unsupported codes" do it "ignores unsupported codes" do
described_class::convert("\e[51mHello\e[0m").should eq 'Hello' expect(described_class::convert("\e[51mHello\e[0m")).to eq 'Hello'
end end
   
it "prints light red" do it "prints light red" do
described_class::convert("\e[91mHello\e[0m").should eq '<span class="term-fg-l-red">Hello</span>' expect(described_class::convert("\e[91mHello\e[0m")).to eq '<span class="term-fg-l-red">Hello</span>'
end end
   
it "prints default on light red" do it "prints default on light red" do
described_class::convert("\e[101mHello\e[0m").should eq '<span class="term-bg-l-red">Hello</span>' expect(described_class::convert("\e[101mHello\e[0m")).to eq '<span class="term-bg-l-red">Hello</span>'
end end
   
it "performs color change from red/blue to default/blue" do it "performs color change from red/blue to default/blue" do
described_class::convert("\e[31;44mHello \e[39mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>' expect(described_class::convert("\e[31;44mHello \e[39mworld")).to eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
end end
   
it "performs color change from light red/blue to default/blue" do it "performs color change from light red/blue to default/blue" do
described_class::convert("\e[91;44mHello \e[39mworld").should eq '<span class="term-fg-l-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>' expect(described_class::convert("\e[91;44mHello \e[39mworld")).to eq '<span class="term-fg-l-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
end end
   
it "prints bold text" do it "prints bold text" do
described_class::convert("\e[1mHello").should eq '<span class="term-bold">Hello</span>' expect(described_class::convert("\e[1mHello")).to eq '<span class="term-bold">Hello</span>'
end end
   
it "resets bold text" do it "resets bold text" do
described_class::convert("\e[1mHello\e[21m world").should eq '<span class="term-bold">Hello</span> world' expect(described_class::convert("\e[1mHello\e[21m world")).to eq '<span class="term-bold">Hello</span> world'
described_class::convert("\e[1mHello\e[22m world").should eq '<span class="term-bold">Hello</span> world' expect(described_class::convert("\e[1mHello\e[22m world")).to eq '<span class="term-bold">Hello</span> world'
end end
   
it "prints italic text" do it "prints italic text" do
described_class::convert("\e[3mHello").should eq '<span class="term-italic">Hello</span>' expect(described_class::convert("\e[3mHello")).to eq '<span class="term-italic">Hello</span>'
end end
   
it "resets italic text" do it "resets italic text" do
described_class::convert("\e[3mHello\e[23m world").should eq '<span class="term-italic">Hello</span> world' expect(described_class::convert("\e[3mHello\e[23m world")).to eq '<span class="term-italic">Hello</span> world'
end end
   
it "prints underlined text" do it "prints underlined text" do
described_class::convert("\e[4mHello").should eq '<span class="term-underline">Hello</span>' expect(described_class::convert("\e[4mHello")).to eq '<span class="term-underline">Hello</span>'
end end
   
it "resets underlined text" do it "resets underlined text" do
described_class::convert("\e[4mHello\e[24m world").should eq '<span class="term-underline">Hello</span> world' expect(described_class::convert("\e[4mHello\e[24m world")).to eq '<span class="term-underline">Hello</span> world'
end end
   
it "prints concealed text" do it "prints concealed text" do
described_class::convert("\e[8mHello").should eq '<span class="term-conceal">Hello</span>' expect(described_class::convert("\e[8mHello")).to eq '<span class="term-conceal">Hello</span>'
end end
   
it "resets concealed text" do it "resets concealed text" do
described_class::convert("\e[8mHello\e[28m world").should eq '<span class="term-conceal">Hello</span> world' expect(described_class::convert("\e[8mHello\e[28m world")).to eq '<span class="term-conceal">Hello</span> world'
end end
   
it "prints crossed-out text" do it "prints crossed-out text" do
described_class::convert("\e[9mHello").should eq '<span class="term-cross">Hello</span>' expect(described_class::convert("\e[9mHello")).to eq '<span class="term-cross">Hello</span>'
end end
   
it "resets crossed-out text" do it "resets crossed-out text" do
described_class::convert("\e[9mHello\e[29m world").should eq '<span class="term-cross">Hello</span> world' expect(described_class::convert("\e[9mHello\e[29m world")).to eq '<span class="term-cross">Hello</span> world'
end end
   
it "can print 256 xterm fg colors" do it "can print 256 xterm fg colors" do
described_class::convert("\e[38;5;16mHello").should eq '<span class="xterm-fg-16">Hello</span>' expect(described_class::convert("\e[38;5;16mHello")).to eq '<span class="xterm-fg-16">Hello</span>'
end end
   
it "can print 256 xterm fg colors on normal magenta background" do it "can print 256 xterm fg colors on normal magenta background" do
described_class::convert("\e[38;5;16;45mHello").should eq '<span class="xterm-fg-16 term-bg-magenta">Hello</span>' expect(described_class::convert("\e[38;5;16;45mHello")).to eq '<span class="xterm-fg-16 term-bg-magenta">Hello</span>'
end end
   
it "can print 256 xterm bg colors" do it "can print 256 xterm bg colors" do
described_class::convert("\e[48;5;240mHello").should eq '<span class="xterm-bg-240">Hello</span>' expect(described_class::convert("\e[48;5;240mHello")).to eq '<span class="xterm-bg-240">Hello</span>'
end end
   
it "can print 256 xterm bg colors on normal magenta foreground" do it "can print 256 xterm bg colors on normal magenta foreground" do
described_class::convert("\e[48;5;16;35mHello").should eq '<span class="term-fg-magenta xterm-bg-16">Hello</span>' expect(described_class::convert("\e[48;5;16;35mHello")).to eq '<span class="term-fg-magenta xterm-bg-16">Hello</span>'
end end
   
it "prints bold colored text vividly" do it "prints bold colored text vividly" do
described_class::convert("\e[1;31mHello\e[0m").should eq '<span class="term-fg-l-red term-bold">Hello</span>' expect(described_class::convert("\e[1;31mHello\e[0m")).to eq '<span class="term-fg-l-red term-bold">Hello</span>'
end end
   
it "prints bold light colored text correctly" do it "prints bold light colored text correctly" do
described_class::convert("\e[1;91mHello\e[0m").should eq '<span class="term-fg-l-red term-bold">Hello</span>' expect(described_class::convert("\e[1;91mHello\e[0m")).to eq '<span class="term-fg-l-red term-bold">Hello</span>'
end end
end end
Loading
@@ -9,6 +9,6 @@ describe Charts::BuildTime do
Loading
@@ -9,6 +9,6 @@ describe Charts::BuildTime do
   
it 'should return build times in minutes' do it 'should return build times in minutes' do
chart = described_class.new(@project) chart = described_class.new(@project)
chart.build_times.should eq [2] expect(chart.build_times).to eq [2]
end end
end end
Loading
@@ -13,8 +13,8 @@ describe GitlabCiYamlProcessor do
Loading
@@ -13,8 +13,8 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 1 expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq 1
config_processor.builds_for_stage_and_ref(type, "master").first.should eq({ expect(config_processor.builds_for_stage_and_ref(type, "master").first).to eq({
stage: "test", stage: "test",
except: nil, except: nil,
name: :rspec, name: :rspec,
Loading
@@ -34,7 +34,7 @@ describe GitlabCiYamlProcessor do
Loading
@@ -34,7 +34,7 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 0 expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq 0
end end
   
it "does not return builds if only has regexp with another branch" do it "does not return builds if only has regexp with another branch" do
Loading
@@ -45,7 +45,7 @@ describe GitlabCiYamlProcessor do
Loading
@@ -45,7 +45,7 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 0 expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq 0
end end
   
it "returns builds if only has specified this branch" do it "returns builds if only has specified this branch" do
Loading
@@ -56,7 +56,7 @@ describe GitlabCiYamlProcessor do
Loading
@@ -56,7 +56,7 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 1 expect(config_processor.builds_for_stage_and_ref(type, "master").size).to eq 1
end end
   
it "does not build tags" do it "does not build tags" do
Loading
@@ -67,7 +67,7 @@ describe GitlabCiYamlProcessor do
Loading
@@ -67,7 +67,7 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref(type, "0-1", true).size.should eq 0 expect(config_processor.builds_for_stage_and_ref(type, "0-1", true).size).to eq 0
end end
   
it "returns builds if only has a list of branches including specified" do it "returns builds if only has a list of branches including specified" do
Loading
@@ -78,7 +78,7 @@ describe GitlabCiYamlProcessor do
Loading
@@ -78,7 +78,7 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref(type, "deploy").size.should eq 1 expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq 1
end end
   
it "returns build only for specified type" do it "returns build only for specified type" do
Loading
@@ -93,9 +93,9 @@ describe GitlabCiYamlProcessor do
Loading
@@ -93,9 +93,9 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref("production", "deploy").size.should eq 0 expect(config_processor.builds_for_stage_and_ref("production", "deploy").size).to eq 0
config_processor.builds_for_stage_and_ref(type, "deploy").size.should eq 1 expect(config_processor.builds_for_stage_and_ref(type, "deploy").size).to eq 1
config_processor.builds_for_stage_and_ref("deploy", "deploy").size.should eq 2 expect(config_processor.builds_for_stage_and_ref("deploy", "deploy").size).to eq 2
end end
end end
   
Loading
@@ -110,8 +110,8 @@ describe GitlabCiYamlProcessor do
Loading
@@ -110,8 +110,8 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref("test", "master").size.should eq 1 expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq 1
config_processor.builds_for_stage_and_ref("test", "master").first.should eq({ expect(config_processor.builds_for_stage_and_ref("test", "master").first).to eq({
except: nil, except: nil,
stage: "test", stage: "test",
name: :rspec, name: :rspec,
Loading
@@ -136,8 +136,8 @@ describe GitlabCiYamlProcessor do
Loading
@@ -136,8 +136,8 @@ describe GitlabCiYamlProcessor do
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
   
config_processor.builds_for_stage_and_ref("test", "master").size.should eq 1 expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq 1
config_processor.builds_for_stage_and_ref("test", "master").first.should eq({ expect(config_processor.builds_for_stage_and_ref("test", "master").first).to eq({
except: nil, except: nil,
stage: "test", stage: "test",
name: :rspec, name: :rspec,
Loading
@@ -166,7 +166,7 @@ describe GitlabCiYamlProcessor do
Loading
@@ -166,7 +166,7 @@ describe GitlabCiYamlProcessor do
}) })
   
config_processor = described_class.new(config) config_processor = described_class.new(config)
config_processor.variables.should eq variables expect(config_processor.variables).to eq variables
end end
end end
   
Loading
Loading
Loading
@@ -5,13 +5,13 @@ describe Upgrader do
Loading
@@ -5,13 +5,13 @@ describe Upgrader do
let(:current_version) { GitlabCi::VERSION } let(:current_version) { GitlabCi::VERSION }
   
describe 'current_version_raw' do describe 'current_version_raw' do
it { upgrader.current_version_raw.should eq current_version } it { expect(upgrader.current_version_raw).to eq current_version }
end end
   
describe 'latest_version?' do describe 'latest_version?' do
it 'should be true if newest version' do it 'should be true if newest version' do
allow(upgrader).to receive_messages(latest_version_raw: current_version) allow(upgrader).to receive_messages(latest_version_raw: current_version)
upgrader.latest_version?.should be_truthy expect(upgrader.latest_version?).to be_truthy
end end
end end
   
Loading
Loading
Loading
@@ -14,11 +14,11 @@ describe Notify do
Loading
@@ -14,11 +14,11 @@ describe Notify do
subject { described_class.build_success_email(@build.id, 'wow@example.com') } subject { described_class.build_success_email(@build.id, 'wow@example.com') }
   
it 'has the correct subject' do it 'has the correct subject' do
should have_subject /Build success for/ is_expected.to have_subject /Build success for/
end end
   
it 'contains name of project' do it 'contains name of project' do
should have_body_text /build successful/ is_expected.to have_body_text /build successful/
end end
end end
   
Loading
@@ -26,11 +26,11 @@ describe Notify do
Loading
@@ -26,11 +26,11 @@ describe Notify do
subject { described_class.build_fail_email(@build.id, 'wow@example.com') } subject { described_class.build_fail_email(@build.id, 'wow@example.com') }
   
it 'has the correct subject' do it 'has the correct subject' do
should have_subject /Build failed for/ is_expected.to have_subject /Build failed for/
end end
   
it 'contains name of project' do it 'contains name of project' do
should have_body_text /build failed/ is_expected.to have_body_text /build failed/
end end
end end
end end
Loading
@@ -30,14 +30,14 @@ describe Build do
Loading
@@ -30,14 +30,14 @@ describe Build do
let(:commit) { FactoryGirl.create :commit, project: project } let(:commit) { FactoryGirl.create :commit, project: project }
let(:build) { FactoryGirl.create :build, commit: commit } let(:build) { FactoryGirl.create :build, commit: commit }
   
it { should belong_to(:commit) } it { is_expected.to belong_to(:commit) }
it { should validate_presence_of :status } it { is_expected.to validate_presence_of :status }
   
it { should respond_to :success? } it { is_expected.to respond_to :success? }
it { should respond_to :failed? } it { is_expected.to respond_to :failed? }
it { should respond_to :running? } it { is_expected.to respond_to :running? }
it { should respond_to :pending? } it { is_expected.to respond_to :pending? }
it { should respond_to :trace_html } it { is_expected.to respond_to :trace_html }
   
describe '.first_pending' do describe '.first_pending' do
let(:first) { FactoryGirl.create :build, commit: commit, status: 'pending', created_at: Date.yesterday } let(:first) { FactoryGirl.create :build, commit: commit, status: 'pending', created_at: Date.yesterday }
Loading
@@ -45,8 +45,8 @@ describe Build do
Loading
@@ -45,8 +45,8 @@ describe Build do
before { first; second } before { first; second }
subject { Build.first_pending } subject { Build.first_pending }
   
it { should be_a(Build) } it { is_expected.to be_a(Build) }
it('returns with the first pending build') { should eq(first) } it('returns with the first pending build') { is_expected.to eq(first) }
end end
   
describe '.create_from' do describe '.create_from' do
Loading
@@ -69,14 +69,14 @@ describe Build do
Loading
@@ -69,14 +69,14 @@ describe Build do
context 'without started_at' do context 'without started_at' do
before { build.started_at = nil } before { build.started_at = nil }
   
it { should be_falsey } it { is_expected.to be_falsey }
end end
   
%w(running success failed).each do |status| %w(running success failed).each do |status|
context "if build status is #{status}" do context "if build status is #{status}" do
before { build.status = status } before { build.status = status }
   
it { should be_truthy } it { is_expected.to be_truthy }
end end
end end
   
Loading
@@ -84,7 +84,7 @@ describe Build do
Loading
@@ -84,7 +84,7 @@ describe Build do
context "if build status is #{status}" do context "if build status is #{status}" do
before { build.status = status } before { build.status = status }
   
it { should be_falsey } it { is_expected.to be_falsey }
end end
end end
end end
Loading
@@ -96,7 +96,7 @@ describe Build do
Loading
@@ -96,7 +96,7 @@ describe Build do
context "if build.status is #{state}" do context "if build.status is #{state}" do
before { build.status = state } before { build.status = state }
   
it { should be_truthy } it { is_expected.to be_truthy }
end end
end end
   
Loading
@@ -104,7 +104,7 @@ describe Build do
Loading
@@ -104,7 +104,7 @@ describe Build do
context "if build.status is #{state}" do context "if build.status is #{state}" do
before { build.status = state } before { build.status = state }
   
it { should be_falsey } it { is_expected.to be_falsey }
end end
end end
end end
Loading
@@ -116,7 +116,7 @@ describe Build do
Loading
@@ -116,7 +116,7 @@ describe Build do
context "if build.status is #{state}" do context "if build.status is #{state}" do
before { build.status = state } before { build.status = state }
   
it { should be_truthy } it { is_expected.to be_truthy }
end end
end end
   
Loading
@@ -124,7 +124,7 @@ describe Build do
Loading
@@ -124,7 +124,7 @@ describe Build do
context "if build.status is #{state}" do context "if build.status is #{state}" do
before { build.status = state } before { build.status = state }
   
it { should be_falsey } it { is_expected.to be_falsey }
end end
end end
end end
Loading
@@ -138,13 +138,13 @@ describe Build do
Loading
@@ -138,13 +138,13 @@ describe Build do
context 'and build.status is success' do context 'and build.status is success' do
before { build.status = 'success' } before { build.status = 'success' }
   
it { should be_falsey } it { is_expected.to be_falsey }
end end
   
context 'and build.status is failed' do context 'and build.status is failed' do
before { build.status = 'failed' } before { build.status = 'failed' }
   
it { should be_falsey } it { is_expected.to be_falsey }
end end
end end
   
Loading
@@ -154,13 +154,13 @@ describe Build do
Loading
@@ -154,13 +154,13 @@ describe Build do
context 'and build.status is success' do context 'and build.status is success' do
before { build.status = 'success' } before { build.status = 'success' }
   
it { should be_falsey } it { is_expected.to be_falsey }
end end
   
context 'and build.status is failed' do context 'and build.status is failed' do
before { build.status = 'failed' } before { build.status = 'failed' }
   
it { should be_truthy } it { is_expected.to be_truthy }
end end
end end
end end
Loading
@@ -168,13 +168,13 @@ describe Build do
Loading
@@ -168,13 +168,13 @@ describe Build do
describe '#trace' do describe '#trace' do
subject { build.trace_html } subject { build.trace_html }
   
it { should be_empty } it { is_expected.to be_empty }
   
context 'if build.trace contains text' do context 'if build.trace contains text' do
let(:text) { 'example output' } let(:text) { 'example output' }
before { build.trace = text } before { build.trace = text }
   
it { should include(text) } it { is_expected.to include(text) }
it { expect(subject.length).to be >= text.length } it { expect(subject.length).to be >= text.length }
end end
end end
Loading
@@ -182,13 +182,13 @@ describe Build do
Loading
@@ -182,13 +182,13 @@ describe Build do
describe '#timeout' do describe '#timeout' do
subject { build.timeout } subject { build.timeout }
   
it { should eq(commit.project.timeout) } it { is_expected.to eq(commit.project.timeout) }
end end
   
describe '#duration' do describe '#duration' do
subject { build.duration } subject { build.duration }
   
it { should eq(120.0) } it { is_expected.to eq(120.0) }
   
context 'if the building process has not started yet' do context 'if the building process has not started yet' do
before do before do
Loading
@@ -196,7 +196,7 @@ describe Build do
Loading
@@ -196,7 +196,7 @@ describe Build do
build.finished_at = nil build.finished_at = nil
end end
   
it { should be_nil } it { is_expected.to be_nil }
end end
   
context 'if the building process has started' do context 'if the building process has started' do
Loading
@@ -205,8 +205,8 @@ describe Build do
Loading
@@ -205,8 +205,8 @@ describe Build do
build.finished_at = nil build.finished_at = nil
end end
   
it { should be_a(Float) } it { is_expected.to be_a(Float) }
it { should > 0.0 } it { is_expected.to be > 0.0 }
end end
end end
   
Loading
@@ -221,86 +221,86 @@ describe Build do
Loading
@@ -221,86 +221,86 @@ describe Build do
} }
   
subject { build.options } subject { build.options }
it { should eq(options) } it { is_expected.to eq(options) }
end end
   
describe '#ref' do describe '#ref' do
subject { build.ref } subject { build.ref }
   
it { should eq(commit.ref) } it { is_expected.to eq(commit.ref) }
end end
   
describe '#sha' do describe '#sha' do
subject { build.sha } subject { build.sha }
   
it { should eq(commit.sha) } it { is_expected.to eq(commit.sha) }
end end
   
describe '#short_sha' do describe '#short_sha' do
subject { build.short_sha } subject { build.short_sha }
   
it { should eq(commit.short_sha) } it { is_expected.to eq(commit.short_sha) }
end end
   
describe '#before_sha' do describe '#before_sha' do
subject { build.before_sha } subject { build.before_sha }
   
it { should eq(commit.before_sha) } it { is_expected.to eq(commit.before_sha) }
end end
   
describe '#allow_git_fetch' do describe '#allow_git_fetch' do
subject { build.allow_git_fetch } subject { build.allow_git_fetch }
   
it { should eq(project.allow_git_fetch) } it { is_expected.to eq(project.allow_git_fetch) }
end end
   
describe '#project' do describe '#project' do
subject { build.project } subject { build.project }
   
it { should eq(commit.project) } it { is_expected.to eq(commit.project) }
end end
   
describe '#project_id' do describe '#project_id' do
subject { build.project_id } subject { build.project_id }
   
it { should eq(commit.project_id) } it { is_expected.to eq(commit.project_id) }
end end
   
describe '#project_name' do describe '#project_name' do
subject { build.project_name } subject { build.project_name }
   
it { should eq(project.name) } it { is_expected.to eq(project.name) }
end end
   
describe '#repo_url' do describe '#repo_url' do
subject { build.repo_url } subject { build.repo_url }
   
it { should eq(project.repo_url_with_auth) } it { is_expected.to eq(project.repo_url_with_auth) }
end end
   
describe '#extract_coverage' do describe '#extract_coverage' do
context 'valid content & regex' do context 'valid content & regex' do
subject { build.extract_coverage('Coverage 1033 / 1051 LOC (98.29%) covered', '\(\d+.\d+\%\) covered') } subject { build.extract_coverage('Coverage 1033 / 1051 LOC (98.29%) covered', '\(\d+.\d+\%\) covered') }
   
it { should eq(98.29) } it { is_expected.to eq(98.29) }
end end
   
context 'valid content & bad regex' do context 'valid content & bad regex' do
subject { build.extract_coverage('Coverage 1033 / 1051 LOC (98.29%) covered', 'very covered') } subject { build.extract_coverage('Coverage 1033 / 1051 LOC (98.29%) covered', 'very covered') }
   
it { should be_nil } it { is_expected.to be_nil }
end end
   
context 'no coverage content & regex' do context 'no coverage content & regex' do
subject { build.extract_coverage('No coverage for today :sad:', '\(\d+.\d+\%\) covered') } subject { build.extract_coverage('No coverage for today :sad:', '\(\d+.\d+\%\) covered') }
   
it { should be_nil } it { is_expected.to be_nil }
end end
   
context 'multiple results in content & regex' do context 'multiple results in content & regex' do
subject { build.extract_coverage(' (98.39%) covered. (98.29%) covered', '\(\d+.\d+\%\) covered') } subject { build.extract_coverage(' (98.39%) covered. (98.29%) covered', '\(\d+.\d+\%\) covered') }
   
it { should eq(98.29) } it { is_expected.to eq(98.29) }
end end
end end
   
Loading
@@ -314,7 +314,7 @@ describe Build do
Loading
@@ -314,7 +314,7 @@ describe Build do
] ]
} }
   
it { should eq(variables) } it { is_expected.to eq(variables) }
   
context 'and secure variables' do context 'and secure variables' do
let(:secure_variables) { let(:secure_variables) {
Loading
@@ -327,7 +327,7 @@ describe Build do
Loading
@@ -327,7 +327,7 @@ describe Build do
build.project.variables << Variable.new(key: 'SECRET_KEY', value: 'secret_value') build.project.variables << Variable.new(key: 'SECRET_KEY', value: 'secret_value')
end end
   
it { should eq(variables + secure_variables) } it { is_expected.to eq(variables + secure_variables) }
   
context 'and trigger variables' do context 'and trigger variables' do
let(:trigger) { FactoryGirl.create :trigger, project: project } let(:trigger) { FactoryGirl.create :trigger, project: project }
Loading
@@ -342,7 +342,7 @@ describe Build do
Loading
@@ -342,7 +342,7 @@ describe Build do
build.trigger_request = trigger_request build.trigger_request = trigger_request
end end
   
it { should eq(variables + secure_variables + trigger_variables) } it { is_expected.to eq(variables + secure_variables + trigger_variables) }
end end
end end
end end
Loading
Loading
Loading
@@ -23,16 +23,16 @@ describe Commit do
Loading
@@ -23,16 +23,16 @@ describe Commit do
let(:commit_with_project) { FactoryGirl.create :commit, project: project } let(:commit_with_project) { FactoryGirl.create :commit, project: project }
let(:config_processor) { GitlabCiYamlProcessor.new(gitlab_ci_yaml) } let(:config_processor) { GitlabCiYamlProcessor.new(gitlab_ci_yaml) }
   
it { should belong_to(:project) } it { is_expected.to belong_to(:project) }
it { should have_many(:builds) } it { is_expected.to have_many(:builds) }
it { should validate_presence_of :before_sha } it { is_expected.to validate_presence_of :before_sha }
it { should validate_presence_of :sha } it { is_expected.to validate_presence_of :sha }
it { should validate_presence_of :ref } it { is_expected.to validate_presence_of :ref }
it { should validate_presence_of :push_data } it { is_expected.to validate_presence_of :push_data }
   
it { should respond_to :git_author_name } it { is_expected.to respond_to :git_author_name }
it { should respond_to :git_author_email } it { is_expected.to respond_to :git_author_email }
it { should respond_to :short_sha } it { is_expected.to respond_to :short_sha }
   
describe '#last_build' do describe '#last_build' do
subject { commit.last_build } subject { commit.last_build }
Loading
@@ -41,8 +41,8 @@ describe Commit do
Loading
@@ -41,8 +41,8 @@ describe Commit do
@second = FactoryGirl.create :build, commit: commit @second = FactoryGirl.create :build, commit: commit
end end
   
it { should be_a(Build) } it { is_expected.to be_a(Build) }
it('returns with the most recently created build') { should eq(@second) } it('returns with the most recently created build') { is_expected.to eq(@second) }
end end
   
describe '#retry' do describe '#retry' do
Loading
@@ -68,7 +68,7 @@ describe Commit do
Loading
@@ -68,7 +68,7 @@ describe Commit do
commit = FactoryGirl.create :commit, project: project commit = FactoryGirl.create :commit, project: project
expected = 'commit_pusher_email' expected = 'commit_pusher_email'
allow(commit).to receive(:push_data) { { user_email: expected } } allow(commit).to receive(:push_data) { { user_email: expected } }
commit.project_recipients.should eq [expected] expect(commit.project_recipients).to eq [expected]
end end
   
it 'should return commit_pusher_email and additional recipients' do it 'should return commit_pusher_email and additional recipients' do
Loading
@@ -78,7 +78,7 @@ describe Commit do
Loading
@@ -78,7 +78,7 @@ describe Commit do
commit = FactoryGirl.create :commit, project: project commit = FactoryGirl.create :commit, project: project
expected = 'commit_pusher_email' expected = 'commit_pusher_email'
allow(commit).to receive(:push_data) { { user_email: expected } } allow(commit).to receive(:push_data) { { user_email: expected } }
commit.project_recipients.should eq ['rec1', 'rec2', expected] expect(commit.project_recipients).to eq ['rec1', 'rec2', expected]
end end
   
it 'should return recipients' do it 'should return recipients' do
Loading
@@ -86,7 +86,7 @@ describe Commit do
Loading
@@ -86,7 +86,7 @@ describe Commit do
email_add_pusher: false, email_add_pusher: false,
email_recipients: 'rec1 rec2' email_recipients: 'rec1 rec2'
commit = FactoryGirl.create :commit, project: project commit = FactoryGirl.create :commit, project: project
commit.project_recipients.should eq ['rec1', 'rec2'] expect(commit.project_recipients).to eq ['rec1', 'rec2']
end end
   
it 'should return unique recipients only' do it 'should return unique recipients only' do
Loading
@@ -96,7 +96,7 @@ describe Commit do
Loading
@@ -96,7 +96,7 @@ describe Commit do
commit = FactoryGirl.create :commit, project: project commit = FactoryGirl.create :commit, project: project
expected = 'rec2' expected = 'rec2'
allow(commit).to receive(:push_data) { { user_email: expected } } allow(commit).to receive(:push_data) { { user_email: expected } }
commit.project_recipients.should eq ['rec1', 'rec2'] expect(commit.project_recipients).to eq ['rec1', 'rec2']
end end
end end
end end
Loading
@@ -108,7 +108,7 @@ describe Commit do
Loading
@@ -108,7 +108,7 @@ describe Commit do
commit.valid_commit_sha commit.valid_commit_sha
end end
   
it('commit errors should not be empty') { commit.errors.should_not be_empty } it('commit errors should not be empty') { expect(commit.errors).not_to be_empty }
end end
end end
   
Loading
@@ -116,7 +116,7 @@ describe Commit do
Loading
@@ -116,7 +116,7 @@ describe Commit do
subject { commit_with_project.compare? } subject { commit_with_project.compare? }
   
context 'if commit.before_sha are not nil' do context 'if commit.before_sha are not nil' do
it { should be_truthy } it { is_expected.to be_truthy }
end end
end end
   
Loading
@@ -124,14 +124,14 @@ describe Commit do
Loading
@@ -124,14 +124,14 @@ describe Commit do
subject { commit.short_before_sha } subject { commit.short_before_sha }
   
it { expect(subject.length).to eq 8 } it { expect(subject.length).to eq 8 }
it { commit.before_sha.should start_with(subject) } it { expect(commit.before_sha).to start_with(subject) }
end end
   
describe '#short_sha' do describe '#short_sha' do
subject { commit.short_sha } subject { commit.short_sha }
   
it { expect(subject.length).to eq 8 } it { expect(subject.length).to eq 8 }
it { commit.sha.should start_with(subject) } it { expect(commit.sha).to start_with(subject) }
end end
   
describe '#create_next_builds' do describe '#create_next_builds' do
Loading
@@ -140,19 +140,19 @@ describe Commit do
Loading
@@ -140,19 +140,19 @@ describe Commit do
end end
   
it "creates builds for next type" do it "creates builds for next type" do
commit.create_builds.should be_truthy expect(commit.create_builds).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 2 expect(commit.builds.size).to eq 2
   
commit.create_next_builds(nil).should be_truthy expect(commit.create_next_builds(nil)).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 4 expect(commit.builds.size).to eq 4
   
commit.create_next_builds(nil).should be_truthy expect(commit.create_next_builds(nil)).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 5 expect(commit.builds.size).to eq 5
   
commit.create_next_builds(nil).should be_falsey expect(commit.create_next_builds(nil)).to be_falsey
end end
end end
   
Loading
@@ -162,9 +162,9 @@ describe Commit do
Loading
@@ -162,9 +162,9 @@ describe Commit do
end end
   
it 'creates builds' do it 'creates builds' do
commit.create_builds.should be_truthy expect(commit.create_builds).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 2 expect(commit.builds.size).to eq 2
end end
   
context 'for build triggers' do context 'for build triggers' do
Loading
@@ -172,29 +172,29 @@ describe Commit do
Loading
@@ -172,29 +172,29 @@ describe Commit do
let(:trigger_request) { FactoryGirl.create :trigger_request, commit: commit, trigger: trigger } let(:trigger_request) { FactoryGirl.create :trigger_request, commit: commit, trigger: trigger }
   
it 'creates builds' do it 'creates builds' do
commit.create_builds(trigger_request).should be_truthy expect(commit.create_builds(trigger_request)).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 2 expect(commit.builds.size).to eq 2
end end
   
it 'rebuilds commit' do it 'rebuilds commit' do
commit.create_builds.should be_truthy expect(commit.create_builds).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 2 expect(commit.builds.size).to eq 2
   
commit.create_builds(trigger_request).should be_truthy expect(commit.create_builds(trigger_request)).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 4 expect(commit.builds.size).to eq 4
end end
   
it 'creates next builds' do it 'creates next builds' do
commit.create_builds(trigger_request).should be_truthy expect(commit.create_builds(trigger_request)).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 2 expect(commit.builds.size).to eq 2
   
commit.create_next_builds(trigger_request).should be_truthy expect(commit.create_next_builds(trigger_request)).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 4 expect(commit.builds.size).to eq 4
end end
   
context 'for [ci skip]' do context 'for [ci skip]' do
Loading
@@ -204,11 +204,11 @@ describe Commit do
Loading
@@ -204,11 +204,11 @@ describe Commit do
end end
   
it 'rebuilds commit' do it 'rebuilds commit' do
commit.status.should eq 'skipped' expect(commit.status).to eq 'skipped'
commit.create_builds(trigger_request).should be_truthy expect(commit.create_builds(trigger_request)).to be_truthy
commit.builds.reload commit.builds.reload
commit.builds.size.should eq 2 expect(commit.builds.size).to eq 2
commit.status.should eq 'pending' expect(commit.status).to eq 'pending'
end end
end end
end end
Loading
@@ -222,13 +222,13 @@ describe Commit do
Loading
@@ -222,13 +222,13 @@ describe Commit do
build = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 60 build = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 60
build1 = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 120 build1 = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 120
   
commit.finished_at.to_i.should eq build.finished_at.to_i expect(commit.finished_at.to_i).to eq build.finished_at.to_i
end end
   
it "returns nil if there is no finished build" do it "returns nil if there is no finished build" do
build = FactoryGirl.create :not_started_build, commit: commit build = FactoryGirl.create :not_started_build, commit: commit
   
commit.finished_at.should be_nil expect(commit.finished_at).to be_nil
end end
end end
   
Loading
@@ -239,26 +239,26 @@ describe Commit do
Loading
@@ -239,26 +239,26 @@ describe Commit do
it "calculates average when there are two builds with coverage" do it "calculates average when there are two builds with coverage" do
FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit
commit.coverage.should eq "35.00" expect(commit.coverage).to eq "35.00"
end end
   
it "calculates average when there are two builds with coverage and one with nil" do it "calculates average when there are two builds with coverage and one with nil" do
FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit
FactoryGirl.create :build, commit: commit FactoryGirl.create :build, commit: commit
commit.coverage.should eq "35.00" expect(commit.coverage).to eq "35.00"
end end
   
it "calculates average when there are two builds with coverage and one is retried" do it "calculates average when there are two builds with coverage and one is retried" do
FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 30, commit: commit FactoryGirl.create :build, name: "rubocop", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit
commit.coverage.should eq "35.00" expect(commit.coverage).to eq "35.00"
end end
   
it "calculates average when there is one build without coverage" do it "calculates average when there is one build without coverage" do
FactoryGirl.create :build, commit: commit FactoryGirl.create :build, commit: commit
commit.coverage.should be_nil expect(commit.coverage).to be_nil
end end
end end
end end
Loading
@@ -16,7 +16,7 @@ require 'spec_helper'
Loading
@@ -16,7 +16,7 @@ require 'spec_helper'
   
describe MailService do describe MailService do
describe "Associations" do describe "Associations" do
it { should belong_to :project } it { is_expected.to belong_to :project }
end end
   
describe "Validations" do describe "Validations" do
Loading
@@ -45,8 +45,8 @@ describe MailService do
Loading
@@ -45,8 +45,8 @@ describe MailService do
end end
   
def should_email(email) def should_email(email)
Notify.should_receive(:build_fail_email).with(build.id, email) expect(Notify).to receive(:build_fail_email).with(build.id, email)
Notify.should_not_receive(:build_success_email).with(build.id, email) expect(Notify).not_to receive(:build_success_email).with(build.id, email)
end end
end end
   
Loading
@@ -65,8 +65,8 @@ describe MailService do
Loading
@@ -65,8 +65,8 @@ describe MailService do
end end
   
def should_email(email) def should_email(email)
Notify.should_receive(:build_success_email).with(build.id, email) expect(Notify).to receive(:build_success_email).with(build.id, email)
Notify.should_not_receive(:build_fail_email).with(build.id, email) expect(Notify).not_to receive(:build_fail_email).with(build.id, email)
end end
end end
   
Loading
@@ -91,8 +91,8 @@ describe MailService do
Loading
@@ -91,8 +91,8 @@ describe MailService do
end end
   
def should_email(email) def should_email(email)
Notify.should_receive(:build_success_email).with(build.id, email) expect(Notify).to receive(:build_success_email).with(build.id, email)
Notify.should_not_receive(:build_fail_email).with(build.id, email) expect(Notify).not_to receive(:build_fail_email).with(build.id, email)
end end
end end
   
Loading
@@ -117,8 +117,8 @@ describe MailService do
Loading
@@ -117,8 +117,8 @@ describe MailService do
end end
   
def should_email(email) def should_email(email)
Notify.should_not_receive(:build_success_email).with(build.id, email) expect(Notify).not_to receive(:build_success_email).with(build.id, email)
Notify.should_not_receive(:build_fail_email).with(build.id, email) expect(Notify).not_to receive(:build_fail_email).with(build.id, email)
end end
end end
   
Loading
@@ -138,7 +138,7 @@ describe MailService do
Loading
@@ -138,7 +138,7 @@ describe MailService do
end end
   
it do it do
mail.can_test?.should eq true expect(mail.can_test?).to eq true
end end
end end
   
Loading
@@ -164,8 +164,8 @@ describe MailService do
Loading
@@ -164,8 +164,8 @@ describe MailService do
end end
   
def should_email(email) def should_email(email)
Notify.should_not_receive(:build_success_email).with(build.id, email) expect(Notify).not_to receive(:build_success_email).with(build.id, email)
Notify.should_not_receive(:build_fail_email).with(build.id, email) expect(Notify).not_to receive(:build_fail_email).with(build.id, email)
end end
end end
end end
Loading
Loading
Loading
@@ -13,7 +13,7 @@ describe Network do
Loading
@@ -13,7 +13,7 @@ describe Network do
allow(network.class).to receive(:put) { response } allow(network.class).to receive(:put) { response }
end end
   
it { should be_truthy } it { is_expected.to be_truthy }
end end
   
context 'on failure' do context 'on failure' do
Loading
@@ -23,7 +23,7 @@ describe Network do
Loading
@@ -23,7 +23,7 @@ describe Network do
allow(network.class).to receive(:put) { response } allow(network.class).to receive(:put) { response }
end end
   
it { should be_nil } it { is_expected.to be_nil }
end end
end end
   
Loading
@@ -39,7 +39,7 @@ describe Network do
Loading
@@ -39,7 +39,7 @@ describe Network do
allow(network.class).to receive(:delete) { response } allow(network.class).to receive(:delete) { response }
end end
   
it { should equal(parsed_response) } it { is_expected.to equal(parsed_response) }
end end
   
context 'on failure' do context 'on failure' do
Loading
@@ -48,7 +48,7 @@ describe Network do
Loading
@@ -48,7 +48,7 @@ describe Network do
allow(network.class).to receive(:delete) { response } allow(network.class).to receive(:delete) { response }
end end
   
it { should be_nil } it { is_expected.to be_nil }
end end
end end
end end
Loading
@@ -24,8 +24,8 @@ describe HipChatService do
Loading
@@ -24,8 +24,8 @@ describe HipChatService do
subject.active = true subject.active = true
end end
   
it { should validate_presence_of :hipchat_room } it { is_expected.to validate_presence_of :hipchat_room }
it { should validate_presence_of :hipchat_token } it { is_expected.to validate_presence_of :hipchat_token }
   
end end
end end
Loading
Loading
Loading
@@ -19,11 +19,11 @@ describe SlackMessage do
Loading
@@ -19,11 +19,11 @@ describe SlackMessage do
it 'returns a message with succeeded build' do it 'returns a message with succeeded build' do
build.update(status: "success") build.update(status: "success")
   
subject.color.should eq color expect(subject.color).to eq color
subject.fallback.should include('Build') expect(subject.fallback).to include('Build')
subject.fallback.should include("\##{build.id}") expect(subject.fallback).to include("\##{build.id}")
subject.fallback.should include('succeeded') expect(subject.fallback).to include('succeeded')
subject.attachments.first[:fields].should be_empty expect(subject.attachments.first[:fields]).to be_empty
end end
end end
   
Loading
@@ -33,11 +33,11 @@ describe SlackMessage do
Loading
@@ -33,11 +33,11 @@ describe SlackMessage do
it 'returns a message with failed build' do it 'returns a message with failed build' do
build.update(status: "failed") build.update(status: "failed")
   
subject.color.should eq color expect(subject.color).to eq color
subject.fallback.should include('Build') expect(subject.fallback).to include('Build')
subject.fallback.should include("\##{build.id}") expect(subject.fallback).to include("\##{build.id}")
subject.fallback.should include('failed') expect(subject.fallback).to include('failed')
subject.attachments.first[:fields].should be_empty expect(subject.attachments.first[:fields]).to be_empty
end end
end end
end end
Loading
@@ -53,11 +53,11 @@ describe SlackMessage do
Loading
@@ -53,11 +53,11 @@ describe SlackMessage do
commit.builds.update_all(status: "success") commit.builds.update_all(status: "success")
commit.reload commit.reload
   
subject.color.should eq color expect(subject.color).to eq color
subject.fallback.should include('Commit') expect(subject.fallback).to include('Commit')
subject.fallback.should include("\##{commit.id}") expect(subject.fallback).to include("\##{commit.id}")
subject.fallback.should include('succeeded') expect(subject.fallback).to include('succeeded')
subject.attachments.first[:fields].should be_empty expect(subject.attachments.first[:fields]).to be_empty
end end
end end
   
Loading
@@ -71,13 +71,13 @@ describe SlackMessage do
Loading
@@ -71,13 +71,13 @@ describe SlackMessage do
first_build.update(status: "success") first_build.update(status: "success")
second_build.update(status: "failed") second_build.update(status: "failed")
subject.color.should eq color expect(subject.color).to eq color
subject.fallback.should include('Commit') expect(subject.fallback).to include('Commit')
subject.fallback.should include("\##{commit.id}") expect(subject.fallback).to include("\##{commit.id}")
subject.fallback.should include('failed') expect(subject.fallback).to include('failed')
subject.attachments.first[:fields].size.should eq 1 expect(subject.attachments.first[:fields].size).to eq 1
subject.attachments.first[:fields].first[:title].should eq second_build.name expect(subject.attachments.first[:fields].first[:title]).to eq second_build.name
subject.attachments.first[:fields].first[:value].should include("\##{second_build.id}") expect(subject.attachments.first[:fields].first[:value]).to include("\##{second_build.id}")
end end
end end
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment