Commit 7d7f0a29 authored by Robert Speicher's avatar Robert Speicher
Browse files

Use `eq` instead of `==` in matchers

parent e42388f8
......@@ -11,7 +11,7 @@ describe 'Variables', feature: true do
context 'create a trigger' do
before do
click_on 'Add Trigger'
@project.triggers.count.should == 1
@project.triggers.count.should eq 1
end
it 'contains trigger token' do
......@@ -20,7 +20,7 @@ describe 'Variables', feature: true do
it 'revokes the trigger' do
click_on 'Revoke'
@project.triggers.count.should == 0
@project.triggers.count.should eq 0
end
end
end
......@@ -19,7 +19,7 @@ describe "Variables", feature: true do
click_on "Save changes"
expect(page).to have_content("Variables were successfully updated.")
@project.variables.count.should == 1
@project.variables.count.should eq 1
end
end
......
......@@ -11,12 +11,12 @@ describe ApplicationHelper do
}
intervals_in_words.each do |interval, expectation|
duration_in_words(Time.now + interval, Time.now).should == expectation
duration_in_words(Time.now + interval, Time.now).should eq expectation
end
end
it "calculates interval from now if there is no finished_at" do
duration_in_words(nil, Time.now - 5).should == "5 seconds"
duration_in_words(nil, Time.now - 5).should eq "5 seconds"
end
end
......@@ -30,7 +30,7 @@ describe ApplicationHelper do
}
intervals_in_words.each do |interval, expectation|
time_interval_in_words(interval).should == expectation
time_interval_in_words(interval).should eq expectation
end
end
end
......
......@@ -8,7 +8,7 @@ describe UserHelper do
let (:avatar_url) { nil }
it 'should return a generic avatar' do
user_avatar_url(user).should == 'no_avatar.png'
user_avatar_url(user).should eq 'no_avatar.png'
end
end
......@@ -17,11 +17,11 @@ describe UserHelper do
let (:avatar_url) { "#{base_url}?s=40&d=mm" }
it 'should return gravatar with default size' do
user_avatar_url(user).should == "#{base_url}?s=40&d=identicon"
user_avatar_url(user).should eq "#{base_url}?s=40&d=identicon"
end
it 'should return gravatar with custom size' do
user_avatar_url(user, 120).should == "#{base_url}?s=120&d=identicon"
user_avatar_url(user, 120).should eq "#{base_url}?s=120&d=identicon"
end
end
......@@ -30,11 +30,11 @@ describe UserHelper do
let (:avatar_url) { "#{base_url}?s=40&d=mm" }
it 'should return gravatar with default size' do
user_avatar_url(user).should == "#{base_url}?s=40&d=identicon"
user_avatar_url(user).should eq "#{base_url}?s=40&d=identicon"
end
it 'should return gravatar with custom size' do
user_avatar_url(user, 120).should == "#{base_url}?s=120&d=identicon"
user_avatar_url(user, 120).should eq "#{base_url}?s=120&d=identicon"
end
end
......@@ -42,7 +42,7 @@ describe UserHelper do
let (:avatar_url) { 'http://example.local/avatar.png' }
it 'should return custom avatar' do
user_avatar_url(user).should == avatar_url
user_avatar_url(user).should eq avatar_url
end
end
end
......
......@@ -3,131 +3,131 @@ require 'spec_helper'
describe Ansi2html do
it "prints non-ansi as-is" do
Ansi2html::convert("Hello").should == 'Hello'
Ansi2html::convert("Hello").should eq 'Hello'
end
it "strips non-color-changing controll sequences" do
Ansi2html::convert("Hello \e[2Kworld").should == 'Hello world'
Ansi2html::convert("Hello \e[2Kworld").should eq 'Hello world'
end
it "prints simply red" do
Ansi2html::convert("\e[31mHello\e[0m").should == '<span class="term-fg-red">Hello</span>'
Ansi2html::convert("\e[31mHello\e[0m").should eq '<span class="term-fg-red">Hello</span>'
end
it "prints simply red without trailing reset" do
Ansi2html::convert("\e[31mHello").should == '<span class="term-fg-red">Hello</span>'
Ansi2html::convert("\e[31mHello").should eq '<span class="term-fg-red">Hello</span>'
end
it "prints simply yellow" do
Ansi2html::convert("\e[33mHello\e[0m").should == '<span class="term-fg-yellow">Hello</span>'
Ansi2html::convert("\e[33mHello\e[0m").should eq '<span class="term-fg-yellow">Hello</span>'
end
it "prints default on blue" do
Ansi2html::convert("\e[39;44mHello").should == '<span class="term-bg-blue">Hello</span>'
Ansi2html::convert("\e[39;44mHello").should eq '<span class="term-bg-blue">Hello</span>'
end
it "prints red on blue" do
Ansi2html::convert("\e[31;44mHello").should == '<span class="term-fg-red term-bg-blue">Hello</span>'
Ansi2html::convert("\e[31;44mHello").should eq '<span class="term-fg-red term-bg-blue">Hello</span>'
end
it "resets colors after red on blue" do
Ansi2html::convert("\e[31;44mHello\e[0m world").should == '<span class="term-fg-red term-bg-blue">Hello</span> world'
Ansi2html::convert("\e[31;44mHello\e[0m world").should eq '<span class="term-fg-red term-bg-blue">Hello</span> world'
end
it "performs color change from red/blue to yellow/blue" do
Ansi2html::convert("\e[31;44mHello \e[33mworld").should == '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-blue">world</span>'
Ansi2html::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>'
end
it "performs color change from red/blue to yellow/green" do
Ansi2html::convert("\e[31;44mHello \e[33;42mworld").should == '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-green">world</span>'
Ansi2html::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>'
end
it "performs color change from red/blue to reset to yellow/green" do
Ansi2html::convert("\e[31;44mHello\e[0m \e[33;42mworld").should == '<span class="term-fg-red term-bg-blue">Hello</span> <span class="term-fg-yellow term-bg-green">world</span>'
Ansi2html::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>'
end
it "ignores unsupported codes" do
Ansi2html::convert("\e[51mHello\e[0m").should == 'Hello'
Ansi2html::convert("\e[51mHello\e[0m").should eq 'Hello'
end
it "prints light red" do
Ansi2html::convert("\e[91mHello\e[0m").should == '<span class="term-fg-l-red">Hello</span>'
Ansi2html::convert("\e[91mHello\e[0m").should eq '<span class="term-fg-l-red">Hello</span>'
end
it "prints default on light red" do
Ansi2html::convert("\e[101mHello\e[0m").should == '<span class="term-bg-l-red">Hello</span>'
Ansi2html::convert("\e[101mHello\e[0m").should eq '<span class="term-bg-l-red">Hello</span>'
end
it "performs color change from red/blue to default/blue" do
Ansi2html::convert("\e[31;44mHello \e[39mworld").should == '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
Ansi2html::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>'
end
it "performs color change from light red/blue to default/blue" do
Ansi2html::convert("\e[91;44mHello \e[39mworld").should == '<span class="term-fg-l-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
Ansi2html::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>'
end
it "prints bold text" do
Ansi2html::convert("\e[1mHello").should == '<span class="term-bold">Hello</span>'
Ansi2html::convert("\e[1mHello").should eq '<span class="term-bold">Hello</span>'
end
it "resets bold text" do
Ansi2html::convert("\e[1mHello\e[21m world").should == '<span class="term-bold">Hello</span> world'
Ansi2html::convert("\e[1mHello\e[22m world").should == '<span class="term-bold">Hello</span> world'
Ansi2html::convert("\e[1mHello\e[21m world").should eq '<span class="term-bold">Hello</span> world'
Ansi2html::convert("\e[1mHello\e[22m world").should eq '<span class="term-bold">Hello</span> world'
end
it "prints italic text" do
Ansi2html::convert("\e[3mHello").should == '<span class="term-italic">Hello</span>'
Ansi2html::convert("\e[3mHello").should eq '<span class="term-italic">Hello</span>'
end
it "resets italic text" do
Ansi2html::convert("\e[3mHello\e[23m world").should == '<span class="term-italic">Hello</span> world'
Ansi2html::convert("\e[3mHello\e[23m world").should eq '<span class="term-italic">Hello</span> world'
end
it "prints underlined text" do
Ansi2html::convert("\e[4mHello").should == '<span class="term-underline">Hello</span>'
Ansi2html::convert("\e[4mHello").should eq '<span class="term-underline">Hello</span>'
end
it "resets underlined text" do
Ansi2html::convert("\e[4mHello\e[24m world").should == '<span class="term-underline">Hello</span> world'
Ansi2html::convert("\e[4mHello\e[24m world").should eq '<span class="term-underline">Hello</span> world'
end
it "prints concealed text" do
Ansi2html::convert("\e[8mHello").should == '<span class="term-conceal">Hello</span>'
Ansi2html::convert("\e[8mHello").should eq '<span class="term-conceal">Hello</span>'
end
it "resets concealed text" do
Ansi2html::convert("\e[8mHello\e[28m world").should == '<span class="term-conceal">Hello</span> world'
Ansi2html::convert("\e[8mHello\e[28m world").should eq '<span class="term-conceal">Hello</span> world'
end
it "prints crossed-out text" do
Ansi2html::convert("\e[9mHello").should == '<span class="term-cross">Hello</span>'
Ansi2html::convert("\e[9mHello").should eq '<span class="term-cross">Hello</span>'
end
it "resets crossed-out text" do
Ansi2html::convert("\e[9mHello\e[29m world").should == '<span class="term-cross">Hello</span> world'
Ansi2html::convert("\e[9mHello\e[29m world").should eq '<span class="term-cross">Hello</span> world'
end
it "can print 256 xterm fg colors" do
Ansi2html::convert("\e[38;5;16mHello").should == '<span class="xterm-fg-16">Hello</span>'
Ansi2html::convert("\e[38;5;16mHello").should eq '<span class="xterm-fg-16">Hello</span>'
end
it "can print 256 xterm fg colors on normal magenta background" do
Ansi2html::convert("\e[38;5;16;45mHello").should == '<span class="xterm-fg-16 term-bg-magenta">Hello</span>'
Ansi2html::convert("\e[38;5;16;45mHello").should eq '<span class="xterm-fg-16 term-bg-magenta">Hello</span>'
end
it "can print 256 xterm bg colors" do
Ansi2html::convert("\e[48;5;240mHello").should == '<span class="xterm-bg-240">Hello</span>'
Ansi2html::convert("\e[48;5;240mHello").should eq '<span class="xterm-bg-240">Hello</span>'
end
it "can print 256 xterm bg colors on normal magenta foreground" do
Ansi2html::convert("\e[48;5;16;35mHello").should == '<span class="term-fg-magenta xterm-bg-16">Hello</span>'
Ansi2html::convert("\e[48;5;16;35mHello").should eq '<span class="term-fg-magenta xterm-bg-16">Hello</span>'
end
it "prints bold colored text vividly" do
Ansi2html::convert("\e[1;31mHello\e[0m").should == '<span class="term-fg-l-red term-bold">Hello</span>'
Ansi2html::convert("\e[1;31mHello\e[0m").should eq '<span class="term-fg-l-red term-bold">Hello</span>'
end
it "prints bold light colored text correctly" do
Ansi2html::convert("\e[1;91mHello\e[0m").should == '<span class="term-fg-l-red term-bold">Hello</span>'
Ansi2html::convert("\e[1;91mHello\e[0m").should eq '<span class="term-fg-l-red term-bold">Hello</span>'
end
end
......@@ -11,7 +11,7 @@ describe "Charts" do
it 'should return build times in minutes' do
chart = Charts::BuildTime.new(@project)
chart.build_times.should == [2]
chart.build_times.should eq [2]
end
end
end
......@@ -13,8 +13,8 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref(type, "master").size.should == 1
config_processor.builds_for_stage_and_ref(type, "master").first.should == {
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 1
config_processor.builds_for_stage_and_ref(type, "master").first.should eq({
stage: "test",
except: nil,
name: :rspec,
......@@ -23,7 +23,7 @@ describe GitlabCiYamlProcessor do
tags: [],
options: {},
allow_failure: false
}
})
end
it "does not return builds if only has another branch" do
......@@ -34,7 +34,7 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref(type, "master").size.should == 0
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 0
end
it "does not return builds if only has regexp with another branch" do
......@@ -45,7 +45,7 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref(type, "master").size.should == 0
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 0
end
it "returns builds if only has specified this branch" do
......@@ -56,7 +56,7 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref(type, "master").size.should == 1
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 1
end
it "does not build tags" do
......@@ -67,7 +67,7 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref(type, "0-1", true).size.should == 0
config_processor.builds_for_stage_and_ref(type, "0-1", true).size.should eq 0
end
it "returns builds if only has a list of branches including specified" do
......@@ -78,7 +78,7 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref(type, "deploy").size.should == 1
config_processor.builds_for_stage_and_ref(type, "deploy").size.should eq 1
end
it "returns build only for specified type" do
......@@ -93,9 +93,9 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref("production", "deploy").size.should == 0
config_processor.builds_for_stage_and_ref(type, "deploy").size.should == 1
config_processor.builds_for_stage_and_ref("deploy", "deploy").size.should == 2
config_processor.builds_for_stage_and_ref("production", "deploy").size.should eq 0
config_processor.builds_for_stage_and_ref(type, "deploy").size.should eq 1
config_processor.builds_for_stage_and_ref("deploy", "deploy").size.should eq 2
end
end
......@@ -110,8 +110,8 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref("test", "master").size.should == 1
config_processor.builds_for_stage_and_ref("test", "master").first.should == {
config_processor.builds_for_stage_and_ref("test", "master").size.should eq 1
config_processor.builds_for_stage_and_ref("test", "master").first.should eq({
except: nil,
stage: "test",
name: :rspec,
......@@ -123,7 +123,7 @@ describe GitlabCiYamlProcessor do
services: ["mysql"]
},
allow_failure: false
}
})
end
it "returns image and service when overridden for job" do
......@@ -136,8 +136,8 @@ describe GitlabCiYamlProcessor do
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.builds_for_stage_and_ref("test", "master").size.should == 1
config_processor.builds_for_stage_and_ref("test", "master").first.should == {
config_processor.builds_for_stage_and_ref("test", "master").size.should eq 1
config_processor.builds_for_stage_and_ref("test", "master").first.should eq({
except: nil,
stage: "test",
name: :rspec,
......@@ -149,7 +149,7 @@ describe GitlabCiYamlProcessor do
services: ["postgresql"]
},
allow_failure: false
}
})
end
end
......@@ -166,7 +166,7 @@ describe GitlabCiYamlProcessor do
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor.variables.should == variables
config_processor.variables.should eq variables
end
end
......
......@@ -5,7 +5,7 @@ describe Upgrader do
let(:current_version) { GitlabCi::VERSION }
describe 'current_version_raw' do
it { upgrader.current_version_raw.should == current_version }
it { upgrader.current_version_raw.should eq current_version }
end
describe 'latest_version?' do
......
......@@ -68,7 +68,7 @@ describe Commit do
commit = FactoryGirl.create :commit, project: project
expected = 'commit_pusher_email'
commit.stub(:push_data) { { user_email: expected } }
commit.project_recipients.should == [expected]
commit.project_recipients.should eq [expected]
end
it 'should return commit_pusher_email and additional recipients' do
......@@ -78,7 +78,7 @@ describe Commit do
commit = FactoryGirl.create :commit, project: project
expected = 'commit_pusher_email'
commit.stub(:push_data) { { user_email: expected } }
commit.project_recipients.should == ['rec1', 'rec2', expected]
commit.project_recipients.should eq ['rec1', 'rec2', expected]
end
it 'should return recipients' do
......@@ -86,7 +86,7 @@ describe Commit do
email_add_pusher: false,
email_recipients: 'rec1 rec2'
commit = FactoryGirl.create :commit, project: project
commit.project_recipients.should == ['rec1', 'rec2']
commit.project_recipients.should eq ['rec1', 'rec2']
end
it 'should return unique recipients only' do
......@@ -96,7 +96,7 @@ describe Commit do
commit = FactoryGirl.create :commit, project: project
expected = 'rec2'
commit.stub(:push_data) { { user_email: expected } }
commit.project_recipients.should == ['rec1', 'rec2']
commit.project_recipients.should eq ['rec1', 'rec2']
end
end
end
......@@ -142,15 +142,15 @@ describe Commit do
it "creates builds for next type" do
commit.create_builds.should be_truthy
commit.builds.reload
commit.builds.size.should == 2
commit.builds.size.should eq 2
commit.create_next_builds(nil).should be_truthy
commit.builds.reload
commit.builds.size.should == 4
commit.builds.size.should eq 4
commit.create_next_builds(nil).should be_truthy
commit.builds.reload
commit.builds.size.should == 5
commit.builds.size.should eq 5
commit.create_next_builds(nil).should be_falsey
end
......@@ -164,7 +164,7 @@ describe Commit do
it 'creates builds' do
commit.create_builds.should be_truthy
commit.builds.reload
commit.builds.size.should == 2
commit.builds.size.should eq 2
end
context 'for build triggers' do
......@@ -174,27 +174,27 @@ describe Commit do
it 'creates builds' do
commit.create_builds(trigger_request).should be_truthy
commit.builds.reload
commit.builds.size.should == 2
commit.builds.size.should eq 2
end
it 'rebuilds commit' do
commit.create_builds.should be_truthy
commit.builds.reload
commit.builds.size.should == 2
commit.builds.size.should eq 2
commit.create_builds(trigger_request).should be_truthy
commit.builds.reload
commit.builds.size.should == 4
commit.builds.size.should eq 4
end
it 'creates next builds' do
commit.create_builds(trigger_request).should be_truthy
commit.builds.reload
commit.builds.size.should == 2
commit.builds.size.should eq 2
commit.create_next_builds(trigger_request).should be_truthy
commit.builds.reload
commit.builds.size.should == 4
commit.builds.size.should eq 4
end
context 'for [ci skip]' do
......@@ -204,11 +204,11 @@ describe Commit do
end
it 'rebuilds commit' do
commit.status.should == 'skipped'
commit.status.should eq 'skipped'
commit.create_builds(trigger_request).should be_truthy
commit.builds.reload
commit.builds.size.should == 2
commit.status.should == 'pending'
commit.builds.size.should eq 2
commit.status.should eq 'pending'
end
end
end
......@@ -222,7 +222,7 @@ describe Commit do
build = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 60
build1 = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 120
commit.finished_at.to_i.should == build.finished_at.to_i
commit.finished_at.to_i.should eq build.finished_at.to_i
end
it "returns nil if there is no finished build" do
......@@ -239,21 +239,21 @@ describe Commit 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: "rubocop", coverage: 40, commit: commit
commit.coverage.should == "35.00"
commit.coverage.should eq "35.00"
end
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: "rubocop", coverage: 40, commit: commit
FactoryGirl.create :build, commit: commit
commit.coverage.should == "35.00"
commit.coverage.should eq "35.00"
end
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: "rubocop", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit
commit.coverage.should == "35.00"
commit.coverage.should eq "35.00"
end
it "calculates average when there is one build without coverage" do
......
......@@ -148,7 +148,7 @@ describe MailService do
end
it do
mail.can_test?.should == true
mail.can_test?.should eq true
end
end
......
......@@ -19,7 +19,7 @@ describe SlackMessage do
it 'returns a message with succeeded build' do
build.update(status: "success")
subject.color.should == color
subject.color.should eq color
subject.fallback.should include('Build')
subject.fallback.should include("\##{build.id}")
subject.fallback.should include('succeeded')
......@@ -33,7 +33,7 @@ describe SlackMessage do
it 'returns a message with failed build' do
build.update(status: "failed")
subject.color.should == color
subject.color.should eq color
subject.fallback.should include('Build')
subject.fallback.should include("\##{build.id}")
subject.fallback.should include('failed')
......@@ -53,7 +53,7 @@ describe SlackMessage do
commit.builds.update_all(status: "success")
commit.reload
subject.color.should == color
subject.color.should eq color
subject.fallback.should include('Commit')
subject.fallback.should include("\##{commit.id}")
subject.fallback.should include('succeeded')
......@@ -71,12 +71,12 @@ describe SlackMessage do
first_build.update(status: "success")
second_build.update(status: "failed")
subject.color.should == color
subject.color.should eq color
subject.fallback.should include('Commit')
subject.fallback.should include("\##{commit.id}")
subject.fallback.should include('failed')
subject.attachments.first[:fields].size.should == 1
subject.attachments.first[:fields].first[:title].should == second_build.name
subject.attachments.first[:fields].si