diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-27 21:08:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-27 21:08:12 +0300 |
commit | 41c9fff024a72e6581e71c2ae080bdcb961a5601 (patch) | |
tree | b36a268efbaee403fa424048f030d5e281dcfbf8 /spec | |
parent | fb73ca3398c2ac49a616ab553e117b0586089702 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/runtime_spec.rb | 30 | ||||
-rw-r--r-- | spec/rubocop/cop/migration/add_column_with_default_spec.rb | 7 |
2 files changed, 34 insertions, 3 deletions
diff --git a/spec/lib/gitlab/runtime_spec.rb b/spec/lib/gitlab/runtime_spec.rb index ff8b383ba45..6059644a1b2 100644 --- a/spec/lib/gitlab/runtime_spec.rb +++ b/spec/lib/gitlab/runtime_spec.rb @@ -3,6 +3,10 @@ require 'spec_helper' describe Gitlab::Runtime do + before do + allow(described_class).to receive(:process_name).and_return('ruby') + end + context "when unknown" do it "raises an exception when trying to identify" do expect { subject.identify }.to raise_error(subject::UnknownProcessError) @@ -36,6 +40,8 @@ describe Gitlab::Runtime do expect(subject.unicorn?).to be(false) expect(subject.sidekiq?).to be(false) expect(subject.console?).to be(false) + expect(subject.rake?).to be(false) + expect(subject.rspec?).to be(false) end end @@ -57,6 +63,8 @@ describe Gitlab::Runtime do expect(subject.puma?).to be(false) expect(subject.sidekiq?).to be(false) expect(subject.console?).to be(false) + expect(subject.rake?).to be(false) + expect(subject.rspec?).to be(false) end end @@ -77,6 +85,8 @@ describe Gitlab::Runtime do expect(subject.unicorn?).to be(false) expect(subject.puma?).to be(false) expect(subject.console?).to be(false) + expect(subject.rake?).to be(false) + expect(subject.rspec?).to be(false) end end @@ -96,6 +106,26 @@ describe Gitlab::Runtime do expect(subject.unicorn?).to be(false) expect(subject.sidekiq?).to be(false) expect(subject.puma?).to be(false) + expect(subject.rake?).to be(false) + expect(subject.rspec?).to be(false) + end + end + + context "rspec" do + before do + allow(described_class).to receive(:process_name).and_return('rspec') + end + + it "identifies itself" do + expect(subject.identify).to eq(:rspec) + expect(subject.rspec?).to be(true) + end + + it "does not identify as others" do + expect(subject.unicorn?).to be(false) + expect(subject.sidekiq?).to be(false) + expect(subject.rake?).to be(false) + expect(subject.puma?).to be(false) end end end diff --git a/spec/rubocop/cop/migration/add_column_with_default_spec.rb b/spec/rubocop/cop/migration/add_column_with_default_spec.rb index 3d2315ddfa1..d309a960e2f 100644 --- a/spec/rubocop/cop/migration/add_column_with_default_spec.rb +++ b/spec/rubocop/cop/migration/add_column_with_default_spec.rb @@ -27,7 +27,7 @@ describe RuboCop::Cop::Migration::AddColumnWithDefault do allow(cop).to receive(:in_migration?).and_return(true) end - let(:offense) { '`add_column_with_default` with `allow_null: false` may cause prolonged lock situations and downtime, see https://gitlab.com/gitlab-org/gitlab/issues/38060' } + let(:offense) { '`add_column_with_default` without `allow_null: true` may cause prolonged lock situations and downtime, see https://gitlab.com/gitlab-org/gitlab/issues/38060' } it 'registers an offense when specifying allow_null: false' do expect_offense(<<~RUBY) @@ -46,10 +46,11 @@ describe RuboCop::Cop::Migration::AddColumnWithDefault do RUBY end - it 'registers no offense when allow_null is not specified' do - expect_no_offenses(<<~RUBY) + it 'registers an offense when allow_null is not specified' do + expect_offense(<<~RUBY) def up add_column_with_default(:ci_build_needs, :artifacts, :boolean, default: true) + ^^^^^^^^^^^^^^^^^^^^^^^ #{offense} end RUBY end |