提交 aaf30b4e 编写于 作者: L Lin Jen-Shin

if -> when; when -> `when`; %w() -> %w[]; and fix some typos:

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5620#note_13810945
上级 ce4a669d
...@@ -42,7 +42,7 @@ describe Ci::Build, models: true do ...@@ -42,7 +42,7 @@ describe Ci::Build, models: true do
describe '#ignored?' do describe '#ignored?' do
subject { build.ignored? } subject { build.ignored? }
context 'if build is not allowed to fail' do context 'when build is not allowed to fail' do
before do before do
build.allow_failure = false build.allow_failure = false
end end
...@@ -64,7 +64,7 @@ describe Ci::Build, models: true do ...@@ -64,7 +64,7 @@ describe Ci::Build, models: true do
end end
end end
context 'if build is allowed to fail' do context 'when build is allowed to fail' do
before do before do
build.allow_failure = true build.allow_failure = true
end end
...@@ -92,7 +92,7 @@ describe Ci::Build, models: true do ...@@ -92,7 +92,7 @@ describe Ci::Build, models: true do
it { is_expected.to be_empty } it { is_expected.to be_empty }
context 'if build.trace contains text' do context 'when build.trace contains text' do
let(:text) { 'example output' } let(:text) { 'example output' }
before do before do
build.trace = text build.trace = text
...@@ -102,7 +102,7 @@ describe Ci::Build, models: true do ...@@ -102,7 +102,7 @@ describe Ci::Build, models: true do
it { expect(subject.length).to be >= text.length } it { expect(subject.length).to be >= text.length }
end end
context 'if build.trace hides token' do context 'when build.trace hides token' do
let(:token) { 'my_secret_token' } let(:token) { 'my_secret_token' }
before do before do
...@@ -284,13 +284,13 @@ describe Ci::Build, models: true do ...@@ -284,13 +284,13 @@ describe Ci::Build, models: true do
stub_ci_pipeline_yaml_file(config) stub_ci_pipeline_yaml_file(config)
end end
context 'if config is not found' do context 'when config is not found' do
let(:config) { nil } let(:config) { nil }
it { is_expected.to eq(predefined_variables) } it { is_expected.to eq(predefined_variables) }
end end
context 'if config does not have a questioned job' do context 'when config does not have a questioned job' do
let(:config) do let(:config) do
YAML.dump({ YAML.dump({
test_other: { test_other: {
...@@ -302,7 +302,7 @@ describe Ci::Build, models: true do ...@@ -302,7 +302,7 @@ describe Ci::Build, models: true do
it { is_expected.to eq(predefined_variables) } it { is_expected.to eq(predefined_variables) }
end end
context 'if config has variables' do context 'when config has variables' do
let(:config) do let(:config) do
YAML.dump({ YAML.dump({
test: { test: {
...@@ -394,7 +394,7 @@ describe Ci::Build, models: true do ...@@ -394,7 +394,7 @@ describe Ci::Build, models: true do
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
end end
context 'if there are runner' do context 'when there are runners' do
let(:runner) { create(:ci_runner) } let(:runner) { create(:ci_runner) }
before do before do
...@@ -424,8 +424,8 @@ describe Ci::Build, models: true do ...@@ -424,8 +424,8 @@ describe Ci::Build, models: true do
describe '#stuck?' do describe '#stuck?' do
subject { build.stuck? } subject { build.stuck? }
%w(pending).each do |state| %w[pending].each do |state|
context "if commit_status.status is #{state}" do context "when commit_status.status is #{state}" do
before do before do
build.status = state build.status = state
end end
...@@ -445,8 +445,8 @@ describe Ci::Build, models: true do ...@@ -445,8 +445,8 @@ describe Ci::Build, models: true do
end end
end end
%w(success failed canceled running).each do |state| %w[success failed canceled running].each do |state|
context "if commit_status.status is #{state}" do context "when commit_status.status is #{state}" do
before do before do
build.status = state build.status = state
end end
...@@ -768,7 +768,7 @@ describe Ci::Build, models: true do ...@@ -768,7 +768,7 @@ describe Ci::Build, models: true do
describe '#when' do describe '#when' do
subject { build.when } subject { build.when }
context 'if is undefined' do context 'when `when` is undefined' do
before do before do
build.when = nil build.when = nil
end end
...@@ -778,13 +778,13 @@ describe Ci::Build, models: true do ...@@ -778,13 +778,13 @@ describe Ci::Build, models: true do
stub_ci_pipeline_yaml_file(config) stub_ci_pipeline_yaml_file(config)
end end
context 'if config is not found' do context 'when config is not found' do
let(:config) { nil } let(:config) { nil }
it { is_expected.to eq('on_success') } it { is_expected.to eq('on_success') }
end end
context 'if config does not have a questioned job' do context 'when config does not have a questioned job' do
let(:config) do let(:config) do
YAML.dump({ YAML.dump({
test_other: { test_other: {
...@@ -796,7 +796,7 @@ describe Ci::Build, models: true do ...@@ -796,7 +796,7 @@ describe Ci::Build, models: true do
it { is_expected.to eq('on_success') } it { is_expected.to eq('on_success') }
end end
context 'if config has when' do context 'when config has `when`' do
let(:config) do let(:config) do
YAML.dump({ YAML.dump({
test: { test: {
...@@ -882,7 +882,7 @@ describe Ci::Build, models: true do ...@@ -882,7 +882,7 @@ describe Ci::Build, models: true do
subject { build.play } subject { build.play }
it 'enques a build' do it 'enqueues a build' do
is_expected.to be_pending is_expected.to be_pending
is_expected.to eq(build) is_expected.to eq(build)
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册