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

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

parent e42388f8
No related branches found
No related tags found
No related merge requests found
Showing
with 165 additions and 165 deletions
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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,
Loading
Loading
@@ -23,7 +23,7 @@ describe GitlabCiYamlProcessor do
tags: [],
options: {},
allow_failure: false
}
})
end
 
it "does not return builds if only has another branch" do
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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,
Loading
Loading
@@ -123,7 +123,7 @@ describe GitlabCiYamlProcessor do
services: ["mysql"]
},
allow_failure: false
}
})
end
 
it "returns image and service when overridden for job" do
Loading
Loading
@@ -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,
Loading
Loading
@@ -149,7 +149,7 @@ describe GitlabCiYamlProcessor do
services: ["postgresql"]
},
allow_failure: false
}
})
end
end
 
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -148,7 +148,7 @@ describe MailService do
end
 
it do
mail.can_test?.should == true
mail.can_test?.should eq true
end
end
 
Loading
Loading
Loading
Loading
@@ -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')
Loading
Loading
@@ -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')
Loading
Loading
@@ -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')
Loading
Loading
@@ -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].size.should eq 1
subject.attachments.first[:fields].first[:title].should eq second_build.name
subject.attachments.first[:fields].first[:value].should include("\##{second_build.id}")
end
end
Loading
Loading
Loading
Loading
@@ -39,12 +39,12 @@ describe Project do
describe 'before_validation' do
it 'should set an random token if none provided' do
project = FactoryGirl.create :project_without_token
project.token.should_not == ""
project.token.should_not eq ""
end
 
it 'should not set an random toke if one provided' do
project = FactoryGirl.create :project
project.token.should == "iPWx6WM4lhHNedGfBpPJNP"
project.token.should eq "iPWx6WM4lhHNedGfBpPJNP"
end
end
 
Loading
Loading
@@ -57,7 +57,7 @@ describe Project do
FactoryGirl.create :commit, committed_at: 1.hour.ago, project: newest_project
FactoryGirl.create :commit, committed_at: 2.hour.ago, project: oldest_project
 
Project.ordered_by_last_commit_date.should == [newest_project, oldest_project, project_without_commits]
Project.ordered_by_last_commit_date.should eq [newest_project, oldest_project, project_without_commits]
end
end
 
Loading
Loading
@@ -70,26 +70,26 @@ describe Project do
FactoryGirl.create(:build, commit: commit)
end
 
it { project.status.should == 'pending' }
it { project.status.should eq 'pending' }
it { project.last_commit.should be_kind_of(Commit) }
it { project.human_status.should == 'pending' }
it { project.human_status.should eq 'pending' }
end
end
 
describe '#email_notification?' do
it do
project = FactoryGirl.create :project, email_add_pusher: true
project.email_notification?.should == true
project.email_notification?.should eq true
end
 
it do
project = FactoryGirl.create :project, email_add_pusher: false, email_recipients: 'test tesft'
project.email_notification?.should == true
project.email_notification?.should eq true
end
 
it do
project = FactoryGirl.create :project, email_add_pusher: false, email_recipients: ''
project.email_notification?.should == false
project.email_notification?.should eq false
end
end
 
Loading
Loading
@@ -98,28 +98,28 @@ describe Project do
project = FactoryGirl.create :project, email_add_pusher: true
project.stub(:broken?).and_return(true)
project.stub(:success?).and_return(true)
project.broken_or_success?.should == true
project.broken_or_success?.should eq true
}
 
it {
project = FactoryGirl.create :project, email_add_pusher: true
project.stub(:broken?).and_return(true)
project.stub(:success?).and_return(false)
project.broken_or_success?.should == true
project.broken_or_success?.should eq true
}
 
it {
project = FactoryGirl.create :project, email_add_pusher: true
project.stub(:broken?).and_return(false)
project.stub(:success?).and_return(true)
project.broken_or_success?.should == true
project.broken_or_success?.should eq true
}
 
it {
project = FactoryGirl.create :project, email_add_pusher: true
project.stub(:broken?).and_return(false)
project.stub(:success?).and_return(false)
project.broken_or_success?.should == false
project.broken_or_success?.should eq false
}
end
 
Loading
Loading
Loading
Loading
@@ -44,7 +44,7 @@ describe Runner do
before { shared_runner.assign_to(project) }
 
it { shared_runner.should be_specific }
it { shared_runner.projects.should == [project] }
it { shared_runner.projects.should eq [project] }
it { shared_runner.only_for?(project).should be_truthy }
end
 
Loading
Loading
Loading
Loading
@@ -42,7 +42,7 @@ describe Service do
end
 
describe '#can_test' do
it { @testable.should == true }
it { @testable.should eq true }
end
end
end
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ describe Trigger do
 
it 'should not set an random token if one provided' do
trigger = FactoryGirl.create :trigger, project: project
trigger.token.should == 'token'
trigger.token.should eq 'token'
end
end
end
Loading
Loading
@@ -66,13 +66,13 @@ describe User do
it "returns projects" do
allow_any_instance_of(User).to receive(:can_manage_project?).and_return(true)
 
user.authorized_projects.count.should == 2
user.authorized_projects.count.should eq 2
end
 
it "empty list if user miss manage permission" do
allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false)
 
user.authorized_projects.count.should == 0
user.authorized_projects.count.should eq 0
end
end
 
Loading
Loading
Loading
Loading
@@ -22,15 +22,15 @@ describe API::API do
 
post api("/builds/register"), token: runner.token, info: {platform: :darwin}
 
response.status.should == 201
json_response['sha'].should == build.sha
runner.reload.platform.should == "darwin"
response.status.should eq 201
json_response['sha'].should eq build.sha
runner.reload.platform.should eq "darwin"
end
 
it "should return 404 error if no pending build found" do
post api("/builds/register"), token: runner.token
 
response.status.should == 404
response.status.should eq 404
end
 
it "should return 404 error if no builds for specific runner" do
Loading
Loading
@@ -39,7 +39,7 @@ describe API::API do
 
post api("/builds/register"), token: runner.token
 
response.status.should == 404
response.status.should eq 404
end
 
it "should return 404 error if no builds for shared runner" do
Loading
Loading
@@ -48,7 +48,7 @@ describe API::API do
 
post api("/builds/register"), token: shared_runner.token
 
response.status.should == 404
response.status.should eq 404
end
 
it "returns options" do
Loading
Loading
@@ -57,8 +57,8 @@ describe API::API do
 
post api("/builds/register"), token: runner.token, info: {platform: :darwin}
 
response.status.should == 201
json_response["options"].should == {"image" => "ruby:2.1", "services" => ["postgres"]}
response.status.should eq 201
json_response["options"].should eq({"image" => "ruby:2.1", "services" => ["postgres"]})
end
 
it "returns variables" do
Loading
Loading
@@ -68,8 +68,8 @@ describe API::API do
 
post api("/builds/register"), token: runner.token, info: {platform: :darwin}
 
response.status.should == 201
json_response["variables"].should == [
response.status.should eq 201
json_response["variables"].should eq [
{"key" => "DB_NAME", "value" => "postgres", "public" => true},
{"key" => "SECRET_KEY", "value" => "secret_value", "public" => false},
]
Loading
Loading
@@ -85,8 +85,8 @@ describe API::API do
 
post api("/builds/register"), token: runner.token, info: {platform: :darwin}
 
response.status.should == 201
json_response["variables"].should == [
response.status.should eq 201
json_response["variables"].should eq [
{"key" => "DB_NAME", "value" => "postgres", "public" => true},
{"key" => "SECRET_KEY", "value" => "secret_value", "public" => false},
{"key" => "TRIGGER_KEY", "value" => "TRIGGER_VALUE", "public" => false},
Loading
Loading
@@ -101,7 +101,7 @@ describe API::API do
it "should update a running build" do
build.run!
put api("/builds/#{build.id}"), token: runner.token
response.status.should == 200
response.status.should eq 200
end
 
it 'Should not override trace information when no trace is given' do
Loading
Loading
Loading
Loading
@@ -19,10 +19,10 @@ describe API::API, 'Commits' do
it "should return commits per project" do
get api("/commits"), options
 
response.status.should == 200
json_response.count.should == 1
json_response.first["project_id"].should == project.id
json_response.first["sha"].should == commit.sha
response.status.should eq 200
json_response.count.should eq 1
json_response.first["project_id"].should eq project.id
json_response.first["sha"].should eq commit.sha
end
end
 
Loading
Loading
@@ -51,15 +51,15 @@ describe API::API, 'Commits' do
it "should create a build" do
post api("/commits"), options.merge(data: data)
 
response.status.should == 201
json_response['sha'].should == "da1560886d4f094c3e6c9ef40349f7d38b5d27d7"
response.status.should eq 201
json_response['sha'].should eq "da1560886d4f094c3e6c9ef40349f7d38b5d27d7"
end
 
it "should return 400 error if no data passed" do
post api("/commits"), options
 
response.status.should == 400
json_response['message'].should == "400 (Bad request) \"data\" not given"
response.status.should eq 400
json_response['message'].should eq "400 (Bad request) \"data\" not given"
end
end
end
Loading
Loading
@@ -41,8 +41,8 @@ describe API::API do
 
it "should create a project with valid data" do
post api("/forks"), options
response.status.should == 201
json_response['name'].should == "Gitlab.org / Underscore"
response.status.should eq 201
json_response['name'].should eq "Gitlab.org / Underscore"
end
end
 
Loading
Loading
@@ -53,7 +53,7 @@ describe API::API do
 
it "should error with invalid data" do
post api("/forks"), options
response.status.should == 400
response.status.should eq 400
end
end
end
Loading
Loading
Loading
Loading
@@ -25,10 +25,10 @@ describe API::API do
 
it "should return all projects on the CI instance" do
get api("/projects"), options
response.status.should == 200
json_response.count.should == 2
json_response.first["id"].should == project1.id
json_response.last["id"].should == project2.id
response.status.should eq 200
json_response.count.should eq 2
json_response.first["id"].should eq project1.id
json_response.last["id"].should eq project2.id
end
end
 
Loading
Loading
@@ -40,8 +40,8 @@ describe API::API do
it "should return all projects on the CI instance" do
get api("/projects/owned"), options
 
response.status.should == 200
json_response.count.should == 0
response.status.should eq 200
json_response.count.should eq 0
end
end
end
Loading
Loading
@@ -58,19 +58,19 @@ describe API::API do
 
it "should create webhook for specified project" do
post api("/projects/#{project.id}/webhooks"), options
response.status.should == 201
json_response["url"].should == webhook[:web_hook]
response.status.should eq 201
json_response["url"].should eq webhook[:web_hook]
end
 
it "fails to create webhook for non existsing project" do
post api("/projects/non-existant-id/webhooks"), options
response.status.should == 404
response.status.should eq 404
end
 
it "non-manager is not authorized" do
allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false)
post api("/projects/#{project.id}/webhooks"), options
response.status.should == 401
response.status.should eq 401
end
end
 
Loading
Loading
@@ -83,14 +83,14 @@ describe API::API do
 
it "fails to create webhook for not valid url" do
post api("/projects/#{project.id}/webhooks"), options
response.status.should == 400
response.status.should eq 400
end
end
 
context "Missed web_hook parameter" do
it "fails to create webhook for not provided url" do
post api("/projects/#{project.id}/webhooks"), options
response.status.should == 400
response.status.should eq 400
end
end
end
Loading
Loading
@@ -101,15 +101,15 @@ describe API::API do
context "with an existing project" do
it "should retrieve the project info" do
get api("/projects/#{project.id}"), options
response.status.should == 200
json_response['id'].should == project.id
response.status.should eq 200
json_response['id'].should eq project.id
end
end
 
context "with a non-existing project" do
it "should return 404 error if project not found" do
get api("/projects/non_existent_id"), options
response.status.should == 404
response.status.should eq 404
end
end
end
Loading
Loading
@@ -124,19 +124,19 @@ describe API::API do
 
it "should update a specific project's information" do
put api("/projects/#{project.id}"), options
response.status.should == 200
json_response["name"].should == project_info[:name]
response.status.should eq 200
json_response["name"].should eq project_info[:name]
end
 
it "fails to update a non-existing project" do
put api("/projects/non-existant-id"), options
response.status.should == 404
response.status.should eq 404
end
 
it "non-manager is not authorized" do
allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false)
put api("/projects/#{project.id}"), options
response.status.should == 401
response.status.should eq 401
end
end
 
Loading
Loading
@@ -145,7 +145,7 @@ describe API::API do
 
it "should delete a specific project" do
delete api("/projects/#{project.id}"), options
response.status.should == 200
response.status.should eq 200
 
expect { project.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
Loading
Loading
@@ -153,12 +153,12 @@ describe API::API do
it "non-manager is not authorized" do
allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false)
delete api("/projects/#{project.id}"), options
response.status.should == 401
response.status.should eq 401
end
 
it "is getting not found error" do
delete api("/projects/not-existing_id"), options
response.status.should == 404
response.status.should eq 404
end
end
 
Loading
Loading
@@ -181,8 +181,8 @@ describe API::API do
 
it "should create a project with valid data" do
post api("/projects"), options
response.status.should == 201
json_response['name'].should == project_info[:name]
response.status.should eq 201
json_response['name'].should eq project_info[:name]
end
end
 
Loading
Loading
@@ -193,7 +193,7 @@ describe API::API do
 
it "should error with invalid data" do
post api("/projects"), options
response.status.should == 400
response.status.should eq 400
end
end
 
Loading
Loading
@@ -203,24 +203,24 @@ describe API::API do
 
it "should add the project to the runner" do
post api("/projects/#{project.id}/runners/#{runner.id}"), options
response.status.should == 201
response.status.should eq 201
 
project.reload
project.runners.first.id.should == runner.id
project.runners.first.id.should eq runner.id
end
 
it "should fail if it tries to link a non-existing project or runner" do
post api("/projects/#{project.id}/runners/non-existing"), options
response.status.should == 404
response.status.should eq 404
 
post api("/projects/non-existing/runners/#{runner.id}"), options
response.status.should == 404
response.status.should eq 404
end
 
it "non-manager is not authorized" do
allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false)
post api("/projects/#{project.id}/runners/#{runner.id}"), options
response.status.should == 401
response.status.should eq 401
end
end
 
Loading
Loading
@@ -235,7 +235,7 @@ describe API::API do
it "should remove the project from the runner" do
project.runners.should be_present
delete api("/projects/#{project.id}/runners/#{runner.id}"), options
response.status.should == 200
response.status.should eq 200
 
project.reload
project.runners.should be_empty
Loading
Loading
@@ -244,7 +244,7 @@ describe API::API do
it "non-manager is not authorized" do
allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false)
post api("/projects/#{project.id}/runners/#{runner.id}"), options
response.status.should == 401
response.status.should eq 401
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