Sha256: f5fecd2af7b29e46d242757fca3f944fa25b9d068d0028968f8cfff7c9efb7f3

Contents?: true

Size: 1.47 KB

Versions: 7

Compression:

Stored size: 1.47 KB

Contents

require 'rails_helper'

RSpec.describe Journaled do
  it "is enabled in production" do
    allow(Rails).to receive(:env).and_return("production")
    expect(Journaled).to be_enabled
  end

  it "is disabled in development" do
    allow(Rails).to receive(:env).and_return("development")
    expect(Journaled).not_to be_enabled
  end

  it "is disabled in test" do
    allow(Rails).to receive(:env).and_return("test")
    expect(Journaled).not_to be_enabled
  end

  it "is enabled in whatevs" do
    allow(Rails).to receive(:env).and_return("whatevs")
    expect(Journaled).to be_enabled
  end

  it "is enabled when explicitly enabled in development" do
    with_env(JOURNALED_ENABLED: true) do
      allow(Rails).to receive(:env).and_return("development")
      expect(Journaled).to be_enabled
    end
  end

  it "is disabled when explicitly disabled in production" do
    with_env(JOURNALED_ENABLED: false) do
      allow(Rails).to receive(:env).and_return("production")
      expect(Journaled).not_to be_enabled
    end
  end

  it "is disabled when explicitly disabled with empty string" do
    with_env(JOURNALED_ENABLED: '') do
      allow(Rails).to receive(:env).and_return("production")
      expect(Journaled).not_to be_enabled
    end
  end

  describe "#actor_uri" do
    it "delegates to ActorUriProvider" do
      allow(Journaled::ActorUriProvider).to receive(:instance).and_return(double(actor_uri: "my actor uri"))
      expect(Journaled.actor_uri).to eq "my actor uri"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
journaled-2.1.1 spec/lib/journaled_spec.rb
journaled-2.1.0 spec/lib/journaled_spec.rb
journaled-2.0.3 spec/lib/journaled_spec.rb
journaled-2.0.2 spec/lib/journaled_spec.rb
journaled-2.0.1 spec/lib/journaled_spec.rb
journaled-2.0.0 spec/lib/journaled_spec.rb
journaled-2.0.0.rc1 spec/lib/journaled_spec.rb