From 41c9fff024a72e6581e71c2ae080bdcb961a5601 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 27 Dec 2019 18:08:12 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/lib/gitlab/runtime_spec.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'spec/lib/gitlab/runtime_spec.rb') 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 -- cgit v1.2.3