Sha256: f7b53fd6e1bc8ca85ad8685383f97361f0cb88cfaa8139edc25414eb2956f929

Contents?: true

Size: 987 Bytes

Versions: 8

Compression:

Stored size: 987 Bytes

Contents

RSpec.describe Percy::Capybara::Client do
  it 'accepts and memoizes a client arg' do
    client = Percy::Client.new
    capybara_client = Percy::Capybara::Client.new(client: client)
    expect(capybara_client.client).to eq(client)
  end
  describe '#enabled?' do
    before(:each) do
      @original_env = ENV['TRAVIS_BUILD_ID']
      ENV['TRAVIS_BUILD_ID'] = nil
    end
    after(:each) do
      ENV['TRAVIS_BUILD_ID'] = @original_env
      ENV['PERCY_ENABLE'] = nil
    end

    context 'in supported CI environment' do
      it 'is true' do
        ENV['TRAVIS_BUILD_ID'] = '123'
        expect(Percy::Capybara::Client.new.enabled?).to be_truthy
      end
    end
    it 'is false by default for local dev environments or unknown CI environments' do
      expect(Percy::Capybara::Client.new.enabled?).to be_falsey
    end
    it 'is true if PERCY_ENABLE=1 is set' do
      ENV['PERCY_ENABLE'] = '1'
      expect(Percy::Capybara::Client.new.enabled?).to be_truthy
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
percy-capybara-0.3.0 spec/lib/percy/capybara/client_spec.rb
percy-capybara-0.2.5 spec/lib/percy/capybara/client_spec.rb
percy-capybara-0.2.4 spec/lib/percy/capybara/client_spec.rb
percy-capybara-0.2.3 spec/lib/percy/capybara/client_spec.rb
percy-capybara-0.2.2 spec/lib/percy/capybara/client_spec.rb
percy-capybara-0.2.1 spec/lib/percy/capybara/client_spec.rb
percy-capybara-0.2.0 spec/lib/percy/capybara/client_spec.rb
percy-capybara-0.1.3 spec/lib/percy/capybara/client_spec.rb