summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-06-01 14:33:04 +0300
committerValery Sizov <vsv2711@gmail.com>2015-06-03 16:36:54 +0300
commit550bcc8aaab26f94ef6b288c28159be21d11f269 (patch)
tree3958de94cc933bfedbefcf144c37fb9d811169f5 /spec
parent227ffbc87c0d989c9213e4a4e4b87df0c8d01720 (diff)
downloadgitlab-ci-550bcc8aaab26f94ef6b288c28159be21d11f269.tar.gz
fix specs
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects_controller_spec.rb8
-rw-r--r--spec/factories/commits.rb4
-rw-r--r--spec/features/commits_spec.rb6
-rw-r--r--spec/features/projects_spec.rb4
-rw-r--r--spec/models/commit_spec.rb4
-rw-r--r--spec/models/project_services/hip_chat_message_spec.rb98
-rw-r--r--spec/models/project_services/slack_message_spec.rb122
-rw-r--r--spec/models/project_spec.rb19
-rw-r--r--spec/requests/api/builds_spec.rb4
-rw-r--r--spec/requests/api/commits_spec.rb3
-rw-r--r--spec/services/create_commit_service_spec.rb87
-rw-r--r--spec/services/create_project_service_spec.rb2
-rw-r--r--spec/services/register_build_service_spec.rb3
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/gitlab_stubs/gitlab_ci.yml24
-rw-r--r--spec/support/stub_gitlab_data.rb5
16 files changed, 220 insertions, 174 deletions
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 17f6417..3275b10 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -11,7 +11,8 @@ describe ProjectsController do
ref: 'master',
before: '2aa371379db71ac89ae20843fcff3b3477cf1a1d',
after: '1c8a9df454ef68c22c2a33cca8232bb50849e5c5',
- token: @project.token
+ token: @project.token,
+ ci_yaml_file: gitlab_ci_yaml
expect(response).to be_success
@@ -23,14 +24,15 @@ describe ProjectsController do
ref: 'master',
before: '2aa371379db71ac89ae20843fcff3b3477cf1a1d',
after: '0000000000000000000000000000000000000000',
- token: @project.token
+ token: @project.token,
+ ci_yaml_file: gitlab_ci_yaml
expect(response).not_to be_success
expect(response.code).to eq('400')
end
it 'should respond 400 if some params missed' do
- post :build, id: @project.id, token: @project.token
+ post :build, id: @project.id, token: @project.token, ci_yaml_file: gitlab_ci_yaml
expect(response).not_to be_success
expect(response.code).to eq('400')
end
diff --git a/spec/factories/commits.rb b/spec/factories/commits.rb
index 3674643..4779f37 100644
--- a/spec/factories/commits.rb
+++ b/spec/factories/commits.rb
@@ -13,7 +13,6 @@
#
# Read about factories at https://github.com/thoughtbot/factory_girl
-
FactoryGirl.define do
factory :commit do
ref 'master'
@@ -44,7 +43,8 @@ FactoryGirl.define do
}
}
],
- total_commits_count: 1
+ total_commits_count: 1,
+ ci_yaml_file: File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
}
end
end
diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb
index 2108d2c..deaf729 100644
--- a/spec/features/commits_spec.rb
+++ b/spec/features/commits_spec.rb
@@ -6,8 +6,7 @@ describe "Commits" do
login_as :user
@project = FactoryGirl.create :project
@commit = FactoryGirl.create :commit, project: @project
- @job = FactoryGirl.create :job, project: @project
- @build = FactoryGirl.create :build, commit: @commit, job: @job
+ @build = FactoryGirl.create :build, commit: @commit
end
describe "GET /:project/commits/:sha" do
@@ -25,8 +24,7 @@ describe "Commits" do
before do
@project = FactoryGirl.create :public_project
@commit = FactoryGirl.create :commit, project: @project
- @job = FactoryGirl.create :job, project: @project
- @build = FactoryGirl.create :build, commit: @commit, job: @job
+ @build = FactoryGirl.create :build, commit: @commit
end
describe "GET /:project/commits/:sha" do
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb
index f01dc11..3f21af9 100644
--- a/spec/features/projects_spec.rb
+++ b/spec/features/projects_spec.rb
@@ -34,12 +34,12 @@ describe "Projects" do
it { page.should have_content 'Build Schedule' }
it "updates configuration" do
- fill_in 'Skip refs', with: 'deploy'
+ fill_in 'Timeout', with: '70'
click_button 'Save changes'
page.should have_content 'was successfully updated'
- find_field('Skip refs').value.should eq 'deploy'
+ find_field('Timeout').value.should eq '70'
end
end
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index c4056e3..1658ae6 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -132,8 +132,8 @@ describe Commit do
describe "create_deploy_builds" do
it "creates deploy build" do
- FactoryGirl.create :job, job_type: :deploy, project: project
- project.reload
+ config_processor = GitlabCiYamlProcessor.new(gitlab_ci_yaml)
+ commit.stub(:config_processor).and_return(config_processor)
commit.create_deploy_builds
commit.builds.reload
diff --git a/spec/models/project_services/hip_chat_message_spec.rb b/spec/models/project_services/hip_chat_message_spec.rb
index 6096b5c..d4bfb31 100644
--- a/spec/models/project_services/hip_chat_message_spec.rb
+++ b/spec/models/project_services/hip_chat_message_spec.rb
@@ -4,62 +4,76 @@ describe HipChatMessage do
subject { HipChatMessage.new(build) }
let(:project) { FactoryGirl.create(:project) }
- let(:commit) { FactoryGirl.create(:commit, project: project) }
- let(:job) { FactoryGirl.create(:job, project: project) }
- let(:build) { FactoryGirl.create(:build, commit: commit, job: job, status: 'success') }
- context 'when build succeeds' do
-
- before { build.save }
-
- it 'returns a successful message' do
- expect( subject.status_color ).to eq 'green'
- expect( subject.notify? ).to be_false
- expect( subject.to_s ).to match(/Build '[^']+' #\d+/)
- expect( subject.to_s ).to match(/Successful in \d+ second\(s\)\./)
+ context "One build" do
+ let(:commit) do
+ commit = FactoryGirl.create(:commit, project: project)
+ commit.push_data[:ci_yaml_file] = YAML.dump({jobs: ["ls"]})
+ commit.save
+ commit
end
- end
- context 'when build fails' do
+ let(:build) do
+ commit.create_builds
+ commit.builds.first
+ end
- before do
- build.status = 'failed'
- build.save
+ context 'when build succeeds' do
+ it 'returns a successful message' do
+ build.update(status: "success")
+
+ expect( subject.status_color ).to eq 'green'
+ expect( subject.notify? ).to be_false
+ expect( subject.to_s ).to match(/Build '[^']+' #\d+/)
+ expect( subject.to_s ).to match(/Successful in \d+ second\(s\)\./)
+ end
end
- it 'returns a failure message' do
- expect( subject.status_color ).to eq 'red'
- expect( subject.notify? ).to be_true
- expect( subject.to_s ).to match(/Build '[^']+' #\d+/)
- expect( subject.to_s ).to match(/Failed in \d+ second\(s\)\./)
+ context 'when build fails' do
+ it 'returns a failure message' do
+ build.update(status: "failed")
+
+ expect( subject.status_color ).to eq 'red'
+ expect( subject.notify? ).to be_true
+ expect( subject.to_s ).to match(/Build '[^']+' #\d+/)
+ expect( subject.to_s ).to match(/Failed in \d+ second\(s\)\./)
+ end
end
end
- context 'when all matrix builds succeed' do
- let(:job2) { FactoryGirl.create(:job, project: project, name: 'Another Job') }
- let(:build2) { FactoryGirl.create(:build, id: 10, commit: commit, job: job2, status: 'success') }
-
- before { build.save; build2.save }
+ context "Several builds" do
+ let(:commit) {commit = FactoryGirl.create(:commit, project: project)}
- it 'returns a successful message' do
- expect( subject.status_color ).to eq 'green'
- expect( subject.notify? ).to be_false
- expect( subject.to_s ).to match(/Commit #\d+/)
- expect( subject.to_s ).to match(/Successful in \d+ second\(s\)\./)
+ let(:build) do
+ commit.builds.first
end
- end
- context 'when at least one matrix build fails' do
- let(:job2) { FactoryGirl.create(:job, project: project, name: 'Another Job') }
- let(:build2) { FactoryGirl.create(:build, id: 10, commit: commit, job: job2, status: 'failed') }
+ context 'when all matrix builds succeed' do
+ it 'returns a successful message' do
+ commit.create_builds
+ commit.builds.update_all(status: "success")
+ commit.reload
- before { build.save; build2.save }
+ expect( subject.status_color ).to eq 'green'
+ expect( subject.notify? ).to be_false
+ expect( subject.to_s ).to match(/Commit #\d+/)
+ expect( subject.to_s ).to match(/Successful in \d+ second\(s\)\./)
+ end
+ end
- it 'returns a failure message' do
- expect( subject.status_color ).to eq 'red'
- expect( subject.notify? ).to be_true
- expect( subject.to_s ).to match(/Commit #\d+/)
- expect( subject.to_s ).to match(/Failed in \d+ second\(s\)\./)
+ context 'when at least one matrix build fails' do
+ it 'returns a failure message' do
+ commit.create_builds
+ first_build = commit.builds.first
+ second_build = commit.builds.last
+ first_build.update(status: "success")
+ second_build.update(status: "failed")
+
+ expect( subject.status_color ).to eq 'red'
+ expect( subject.notify? ).to be_true
+ expect( subject.to_s ).to match(/Commit #\d+/)
+ expect( subject.to_s ).to match(/Failed in \d+ second\(s\)\./)
+ end
end
end
end
diff --git a/spec/models/project_services/slack_message_spec.rb b/spec/models/project_services/slack_message_spec.rb
index 83a6352..03c0cd3 100644
--- a/spec/models/project_services/slack_message_spec.rb
+++ b/spec/models/project_services/slack_message_spec.rb
@@ -4,76 +4,90 @@ describe SlackMessage do
subject { SlackMessage.new(commit) }
let(:project) { FactoryGirl.create :project }
- let(:commit) { FactoryGirl.create :commit, project: project }
- let(:job) { FactoryGirl.create :job, project: project }
- let(:build) { FactoryGirl.create :build, commit: commit, job: job, status: 'success' }
- context 'when build succeeded' do
- let(:color) { 'good' }
-
- before { build }
+ context "One build" do
+ let(:commit) do
+ commit = FactoryGirl.create(:commit, project: project)
+ commit.push_data[:ci_yaml_file] = YAML.dump({jobs: ["ls"]})
+ commit.save
+ commit
+ end
- it 'returns a message with succeeded build' do
- subject.color.should == color
- subject.fallback.should include('Build')
- subject.fallback.should include("\##{build.id}")
- subject.fallback.should include('succeeded')
- subject.attachments.first[:fields].should be_empty
+ let(:build) do
+ commit.create_builds
+ commit.builds.first
end
- end
- context 'when build failed' do
- let(:color) { 'danger' }
+ context 'when build succeeded' do
+ let(:color) { 'good' }
- before do
- build.status = 'failed'
- build.save
- end
+ it 'returns a message with succeeded build' do
+ build.update(status: "success")
- it 'returns a message with failed build' do
- subject.color.should == color
- subject.fallback.should include('Build')
- subject.fallback.should include("\##{build.id}")
- subject.fallback.should include('failed')
- subject.attachments.first[:fields].should be_empty
+ subject.color.should == color
+ subject.fallback.should include('Build')
+ subject.fallback.should include("\##{build.id}")
+ subject.fallback.should include('succeeded')
+ subject.attachments.first[:fields].should be_empty
+ end
end
- end
- context 'when all matrix builds succeeded' do
- let(:job2) { FactoryGirl.create :job, project: project }
- let(:build2) { FactoryGirl.create :build, commit: commit, job: job2, status: 'success' }
- let(:color) { 'good' }
+ context 'when build failed' do
+ let(:color) { 'danger' }
- before { build; build2 }
+ it 'returns a message with failed build' do
+ build.update(status: "failed")
- it 'returns a message with success' do
- subject.color.should == color
- subject.fallback.should include('Commit')
- subject.fallback.should include("\##{commit.id}")
- subject.fallback.should include('succeeded')
- subject.attachments.first[:fields].should be_empty
+ subject.color.should == color
+ subject.fallback.should include('Build')
+ subject.fallback.should include("\##{build.id}")
+ subject.fallback.should include('failed')
+ subject.attachments.first[:fields].should be_empty
+ end
end
end
- context 'when one of matrix builds failed' do
- let(:job2) { FactoryGirl.create :job, project: project, name: 'Test JOB' }
- let(:build2) { FactoryGirl.create :build, id: 10, commit: commit, job: job2, status: 'success' }
- let(:color) { 'danger' }
+ context "Several builds" do
+ let(:commit) {commit = FactoryGirl.create(:commit, project: project)}
- before do
- build
- build2.status = 'failed'
- build2.save
+ let(:build) do
+ commit.builds.first
end
- it 'returns a message with information about failed build' do
- subject.color.should == 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 == build2.name
- subject.attachments.first[:fields].first[:value].should include("\##{build2.id}")
+ context 'when all matrix builds succeeded' do
+ let(:color) { 'good' }
+
+ it 'returns a message with success' do
+ commit.create_builds
+ commit.builds.update_all(status: "success")
+ commit.reload
+
+ subject.color.should == color
+ subject.fallback.should include('Commit')
+ subject.fallback.should include("\##{commit.id}")
+ subject.fallback.should include('succeeded')
+ subject.attachments.first[:fields].should be_empty
+ end
+ end
+
+ context 'when one of matrix builds failed' do
+ let(:color) { 'danger' }
+
+ it 'returns a message with information about failed build' do
+ commit.create_builds
+ first_build = commit.builds.first
+ second_build = commit.builds.last
+ first_build.update(status: "success")
+ second_build.update(status: "failed")
+
+ subject.color.should == 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].first[:value].should include("\##{second_build.id}")
+ end
end
end
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 4bcd130..44a6f51 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -126,8 +126,7 @@ describe Project do
let(:project_dump) { File.read(Rails.root.join('spec/support/gitlab_stubs/raw_project.yml')) }
let(:parsed_project) { Project.parse(project_dump) }
- #before { parsed_project.build_default_job }
-
+
it { parsed_project.should be_valid }
it { parsed_project.should be_kind_of(Project) }
it { parsed_project.name.should eq("GitLab / api.gitlab.org") }
@@ -152,22 +151,6 @@ describe Project do
it { should include(project.gitlab_url[7..-1]) }
end
- describe "#skip_ref?" do
- let(:project) { FactoryGirl.create(:project, skip_refs: "master, develop, feature/*") }
-
- it 'returns true when item is not in list' do
- expect(project.skip_ref?('someotherstring')).to eq false
- end
-
- it 'accepts string values' do
- expect(project.skip_ref?('master')).to eq true
- end
-
- it 'accepts glob pattern syntax' do
- expect(project.skip_ref?('feature/some_feature')).to eq true
- end
- end
-
describe :search do
let!(:project) { FactoryGirl.create(:project, name: "foo") }
diff --git a/spec/requests/api/builds_spec.rb b/spec/requests/api/builds_spec.rb
index 2960388..2dd6e01 100644
--- a/spec/requests/api/builds_spec.rb
+++ b/spec/requests/api/builds_spec.rb
@@ -17,8 +17,8 @@ describe API::API do
describe "POST /builds/register" do
it "should start a build" do
commit = FactoryGirl.create(:commit, project: project)
- job = FactoryGirl.create :job, project: project
- build = commit.create_builds.first
+ commit.create_builds
+ build = commit.builds.first
post api("/builds/register"), token: runner.token, info: {platform: :darwin}
diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb
index 87072bb..190df70 100644
--- a/spec/requests/api/commits_spec.rb
+++ b/spec/requests/api/commits_spec.rb
@@ -43,7 +43,8 @@ describe API::API, 'Commits' do
"email" => "jordi@softcatala.org",
}
}
- ]
+ ],
+ ci_yaml_file: gitlab_ci_yaml
}
}
diff --git a/spec/services/create_commit_service_spec.rb b/spec/services/create_commit_service_spec.rb
index 7a4ff7d..4b4f788 100644
--- a/spec/services/create_commit_service_spec.rb
+++ b/spec/services/create_commit_service_spec.rb
@@ -6,7 +6,14 @@ describe CreateCommitService do
describe :execute do
context 'valid params' do
- let(:commit) { service.execute(project, ref: 'refs/heads/master', before: '00000000', after: '31das312') }
+ let(:commit) do
+ service.execute(project,
+ ref: 'refs/heads/master',
+ before: '00000000',
+ after: '31das312',
+ ci_yaml_file: gitlab_ci_yaml
+ )
+ end
it { commit.should be_kind_of(Commit) }
it { commit.should be_valid }
@@ -15,61 +22,50 @@ describe CreateCommitService do
it { commit.builds.first.should be_kind_of(Build) }
end
- context 'without params' do
- subject { service.execute(project, {}) }
-
- it { should be_false }
- end
-
context "deploy builds" do
it "calls create_deploy_builds if there are no builds" do
- project.jobs.destroy_all
+ config = YAML.dump({jobs: [], build_jobs: ["ls"]})
Commit.any_instance.should_receive(:create_deploy_builds)
- service.execute(project, ref: 'refs/heads/master', before: '00000000', after: '31das312')
+ service.execute(project, ref: 'refs/heads/master', before: '00000000', after: '31das312', ci_yaml_file: config)
end
it "does not call create_deploy_builds if there is build" do
+ config = YAML.dump({jobs: ["ls"], build_jobs: ["ls"]})
Commit.any_instance.should_not_receive(:create_deploy_builds)
- service.execute(project, ref: 'refs/heads/master', before: '00000000', after: '31das312')
+ service.execute(project, ref: 'refs/heads/master', before: '00000000', after: '31das312', ci_yaml_file: config)
end
end
context "skip tag if there is no build for it" do
- it "does not create commit if there is no appropriate job" do
- project.jobs
-
- result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312')
- result.should be_false
- end
-
it "creates commit if there is appropriate job" do
- project.jobs.first.update(build_tags: true)
-
- result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312')
+ result = service.execute(project,
+ ref: 'refs/tags/0_1',
+ before: '00000000',
+ after: '31das312',
+ ci_yaml_file: gitlab_ci_yaml
+ )
result.should be_persisted
end
it "does not create commit if there is no appropriate job nor deploy job" do
- project.jobs.first.update(build_tags: false)
- FactoryGirl.create(:deploy_job, project: project, refs: "release")
-
- result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312')
+ result = service.execute(project,
+ ref: 'refs/tags/0_1',
+ before: '00000000',
+ after: '31das312',
+ ci_yaml_file: YAML.dump({})
+ )
result.should be_false
end
it "creates commit if there is no appropriate job but deploy job has right ref setting" do
- project.jobs.first.update(build_tags: false)
- FactoryGirl.create(:deploy_job, project: project, refs: "0_1")
-
- result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312')
- result.should be_persisted
- end
-
- it "creates commit if there is no appropriate job and deploy job has no ref setting" do
- project.jobs.first.update(build_tags: true)
- FactoryGirl.create(:deploy_job, project: project)
-
- result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312')
+ config = YAML.dump({deploy_jobs: [{script: "ls", refs: "0_1"}]})
+
+ result = service.execute(project,
+ ref: 'refs/heads/0_1',
+ before: '00000000',
+ after: '31das312',
+ ci_yaml_file: config
+ )
result.should be_persisted
end
end
@@ -77,16 +73,27 @@ describe CreateCommitService do
describe :ci_skip? do
it "skips commit creation if there is [ci skip] tag in commit message" do
commits = [{message: "some message[ci skip]"}]
- result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312', commits: commits)
+ result = service.execute(project,
+ ref: 'refs/tags/0_1',
+ before: '00000000',
+ after: '31das312',
+ commits: commits,
+ ci_yaml_file: gitlab_ci_yaml
+ )
result.should be_false
end
it "does not skips commit creation if there is no [ci skip] tag in commit message" do
- project.jobs.first.update(build_tags: true)
-
commits = [{message: "some message"}]
- result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312', commits: commits)
+ result = service.execute(project,
+ ref: 'refs/tags/0_1',
+ before: '00000000',
+ after: '31das312',
+ commits: commits,
+ ci_yaml_file: gitlab_ci_yaml
+ )
+
result.should be_persisted
end
end
diff --git a/spec/services/create_project_service_spec.rb b/spec/services/create_project_service_spec.rb
index 6ecb93e..b28cf5a 100644
--- a/spec/services/create_project_service_spec.rb
+++ b/spec/services/create_project_service_spec.rb
@@ -24,7 +24,6 @@ describe CreateProjectService do
context "forking" do
it "uses project as a template for settings and jobs" do
origin_project = FactoryGirl.create(:project)
- origin_project.jobs << Job.new(commands: "pwd")
origin_project.shared_runners_enabled = true
origin_project.public = true
origin_project.allow_git_fetch = true
@@ -35,7 +34,6 @@ describe CreateProjectService do
project.shared_runners_enabled.should be_true
project.public.should be_true
project.allow_git_fetch.should be_true
- project.jobs.last.commands.should == "pwd"
end
end
end
diff --git a/spec/services/register_build_service_spec.rb b/spec/services/register_build_service_spec.rb
index 7925dca..1407346 100644
--- a/spec/services/register_build_service_spec.rb
+++ b/spec/services/register_build_service_spec.rb
@@ -3,9 +3,8 @@ require 'spec_helper'
describe RegisterBuildService do
let!(:service) { RegisterBuildService.new }
let!(:project) { FactoryGirl.create :project }
- let!(:job) { FactoryGirl.create :job, project: project }
let!(:commit) { FactoryGirl.create :commit, project: project }
- let!(:pending_build) { commit.create_build_from_job(job) }
+ let!(:pending_build) { FactoryGirl.create :build, project: project, commit: commit }
let!(:shared_runner) { FactoryGirl.create(:runner, is_shared: true) }
let!(:specific_runner) { FactoryGirl.create(:runner, is_shared: false) }
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 4e8ef9a..54d3068 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -29,6 +29,7 @@ RSpec.configure do |config|
config.include LoginHelpers, type: :feature
config.include StubGitlabCalls
+ config.include StubGitlabData
# ## Mock Framework
#
diff --git a/spec/support/gitlab_stubs/gitlab_ci.yml b/spec/support/gitlab_stubs/gitlab_ci.yml
new file mode 100644
index 0000000..3ad21d4
--- /dev/null
+++ b/spec/support/gitlab_stubs/gitlab_ci.yml
@@ -0,0 +1,24 @@
+# Refs to skip
+skip_refs: “deploy-*”
+
+# Run before each script
+before_script:
+ - ls
+
+# Parallel jobs, each line is parallel build
+jobs:
+ - script: "rake spec"
+ runner: "ruby,postgres"
+ name: "Rspec"
+ - script: "rake spinach"
+ runner: "ruby,mysql"
+ name: "Spinach"
+ tags: true
+ branches: false
+
+# Parallel deploy jobs
+deploy_jobs:
+ - "cap deploy production"
+ - script: "cap deploy staging"
+ refs: staging
+ name: "Deploy to staging"
diff --git a/spec/support/stub_gitlab_data.rb b/spec/support/stub_gitlab_data.rb
new file mode 100644
index 0000000..fa402f3
--- /dev/null
+++ b/spec/support/stub_gitlab_data.rb
@@ -0,0 +1,5 @@
+module StubGitlabData
+ def gitlab_ci_yaml
+ File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
+ end
+end