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
Loading
@@ -13,34 +13,34 @@ describe ImageForBuildService do
Loading
@@ -13,34 +13,34 @@ describe ImageForBuildService do
before { build.run! } before { build.run! }
let(:image) { service.execute(project, ref: 'master') } let(:image) { service.execute(project, ref: 'master') }
   
it { image.should be_kind_of(OpenStruct) } it { expect(image).to be_kind_of(OpenStruct) }
it { image.path.to_s.should include('public/build-running.svg') } it { expect(image.path.to_s).to include('public/build-running.svg') }
it { image.name.should eq 'build-running.svg' } it { expect(image.name).to eq 'build-running.svg' }
end end
   
context 'unknown branch name' do context 'unknown branch name' do
let(:image) { service.execute(project, ref: 'feature') } let(:image) { service.execute(project, ref: 'feature') }
   
it { image.should be_kind_of(OpenStruct) } it { expect(image).to be_kind_of(OpenStruct) }
it { image.path.to_s.should include('public/build-unknown.svg') } it { expect(image.path.to_s).to include('public/build-unknown.svg') }
it { image.name.should eq 'build-unknown.svg' } it { expect(image.name).to eq 'build-unknown.svg' }
end end
   
context 'commit sha' do context 'commit sha' do
before { build.run! } before { build.run! }
let(:image) { service.execute(project, sha: build.sha) } let(:image) { service.execute(project, sha: build.sha) }
   
it { image.should be_kind_of(OpenStruct) } it { expect(image).to be_kind_of(OpenStruct) }
it { image.path.to_s.should include('public/build-running.svg') } it { expect(image.path.to_s).to include('public/build-running.svg') }
it { image.name.should eq 'build-running.svg' } it { expect(image.name).to eq 'build-running.svg' }
end end
   
context 'unknown commit sha' do context 'unknown commit sha' do
let(:image) { service.execute(project, sha: '0000000') } let(:image) { service.execute(project, sha: '0000000') }
   
it { image.should be_kind_of(OpenStruct) } it { expect(image).to be_kind_of(OpenStruct) }
it { image.path.to_s.should include('public/build-unknown.svg') } it { expect(image.path.to_s).to include('public/build-unknown.svg') }
it { image.name.should eq 'build-unknown.svg' } it { expect(image.name).to eq 'build-unknown.svg' }
end end
end end
end end
Loading
@@ -18,29 +18,29 @@ describe RegisterBuildService do
Loading
@@ -18,29 +18,29 @@ describe RegisterBuildService do
pending_build.tag_list = ["linux"] pending_build.tag_list = ["linux"]
pending_build.save pending_build.save
specific_runner.tag_list = ["linux"] specific_runner.tag_list = ["linux"]
service.execute(specific_runner).should eq pending_build expect(service.execute(specific_runner)).to eq pending_build
end end
   
it "does not pick build with different tag" do it "does not pick build with different tag" do
pending_build.tag_list = ["linux"] pending_build.tag_list = ["linux"]
pending_build.save pending_build.save
specific_runner.tag_list = ["win32"] specific_runner.tag_list = ["win32"]
service.execute(specific_runner).should be_falsey expect(service.execute(specific_runner)).to be_falsey
end end
   
it "picks build without tag" do it "picks build without tag" do
service.execute(specific_runner).should eq pending_build expect(service.execute(specific_runner)).to eq pending_build
end end
   
it "does not pick build with tag" do it "does not pick build with tag" do
pending_build.tag_list = ["linux"] pending_build.tag_list = ["linux"]
pending_build.save pending_build.save
service.execute(specific_runner).should be_falsey expect(service.execute(specific_runner)).to be_falsey
end end
   
it "pick build without tag" do it "pick build without tag" do
specific_runner.tag_list = ["win32"] specific_runner.tag_list = ["win32"]
service.execute(specific_runner).should eq pending_build expect(service.execute(specific_runner)).to eq pending_build
end end
end end
   
Loading
@@ -53,19 +53,19 @@ describe RegisterBuildService do
Loading
@@ -53,19 +53,19 @@ describe RegisterBuildService do
context 'shared runner' do context 'shared runner' do
let(:build) { service.execute(shared_runner) } let(:build) { service.execute(shared_runner) }
   
it { build.should be_kind_of(Build) } it { expect(build).to be_kind_of(Build) }
it { build.should be_valid } it { expect(build).to be_valid }
it { build.should be_running } it { expect(build).to be_running }
it { build.runner.should eq shared_runner } it { expect(build.runner).to eq shared_runner }
end end
   
context 'specific runner' do context 'specific runner' do
let(:build) { service.execute(specific_runner) } let(:build) { service.execute(specific_runner) }
   
it { build.should be_kind_of(Build) } it { expect(build).to be_kind_of(Build) }
it { build.should be_valid } it { expect(build).to be_valid }
it { build.should be_running } it { expect(build).to be_running }
it { build.runner.should eq specific_runner } it { expect(build.runner).to eq specific_runner }
end end
end end
   
Loading
@@ -73,16 +73,16 @@ describe RegisterBuildService do
Loading
@@ -73,16 +73,16 @@ describe RegisterBuildService do
context 'shared runner' do context 'shared runner' do
let(:build) { service.execute(shared_runner) } let(:build) { service.execute(shared_runner) }
   
it { build.should be_nil } it { expect(build).to be_nil }
end end
   
context 'specific runner' do context 'specific runner' do
let(:build) { service.execute(specific_runner) } let(:build) { service.execute(specific_runner) }
   
it { build.should be_kind_of(Build) } it { expect(build).to be_kind_of(Build) }
it { build.should be_valid } it { expect(build).to be_valid }
it { build.should be_running } it { expect(build).to be_running }
it { build.runner.should eq specific_runner } it { expect(build.runner).to eq specific_runner }
end end
end end
end end
Loading
Loading
Loading
@@ -9,13 +9,13 @@ describe WebHookService do
Loading
@@ -9,13 +9,13 @@ describe WebHookService do
describe '#execute' do describe '#execute' do
it "should execute successfully" do it "should execute successfully" do
stub_request(:post, hook.url).to_return(status: 200) stub_request(:post, hook.url).to_return(status: 200)
described_class.new.build_end(build).should be_truthy expect(described_class.new.build_end(build)).to be_truthy
end end
end end
   
context 'build_data' do context 'build_data' do
it "contains all needed fields" do it "contains all needed fields" do
build_data(build).should include( expect(build_data(build)).to include(
:build_id, :build_id,
:project_id, :project_id,
:ref, :ref,
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