Sha256: 2e0c4aa2d3ac881a3b09c06ffcad8d2048a583bfdc307bf35ff01e53bab3be51

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

describe Appsignal::System do
  describe ".container?" do
    subject { described_class.container? }

    context "when on Heroku" do
      around { |example| recognize_as_heroku { example.run } }

      it "returns true" do
        expect(subject).to be_truthy
      end
    end

    context "when in docker" do
      around { |example| recognize_as_container(:docker) { example.run } }

      it "returns true" do
        expect(subject).to be_truthy
      end
    end

    context "when not in container" do
      around { |example| recognize_as_container(:none) { example.run } }

      it "returns false" do
        expect(subject).to be_falsy
      end
    end
  end

  describe ".heroku?" do
    subject { described_class.heroku? }

    context "when on Heroku" do
      around { |example| recognize_as_heroku { example.run } }

      it "returns true" do
        expect(subject).to be_truthy
      end
    end

    context "when not on Heroku" do
      around { |example| recognize_as_container(:none) { example.run } }

      it "returns false" do
        expect(subject).to be_falsy
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
appsignal-2.1.2 spec/lib/appsignal/system_spec.rb
appsignal-2.1.1 spec/lib/appsignal/system_spec.rb
appsignal-2.1.1.beta.1 spec/lib/appsignal/system_spec.rb
appsignal-2.1.0 spec/lib/appsignal/system_spec.rb