Sha256: 2441a66e9bcef26bb6c10cba299efd4af9b39b7d3f284076693f8ebaff694e16

Contents?: true

Size: 1.5 KB

Versions: 14

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: false

require 'spec_helper'

describe USPSFlags::Config do
  describe 'class variable accessors' do
    it 'returns the current flags directory' do
      expect(USPSFlags.configuration.flags_dir).to eql($tmp_flags_dir)
    end

    it 'returns the current log directory' do
      default_log_path = $tmp_flags_dir + '/log'
      expect(USPSFlags.configuration.log_path).to eql(default_log_path)
    end

    it 'returns a Boolean from clear' do
      expect(USPSFlags.configuration.clear).to be(true)
    end
  end

  describe 'trident' do
    it 'returns a Hash from trident' do
      expect(USPSFlags.configuration.trident).to be_a(Hash)
    end
  end

  describe 'configuration constructor' do
    it 'returns a properly constructed configuration' do
      USPSFlags.configure do |config|
        config.flags_dir = $tmp_flags_dir
      end

      expect(USPSFlags.configuration.flags_dir).to eql($tmp_flags_dir)
    end

    it 'returns a boolean on configuration clear' do
      USPSFlags.configure do |config|
        config.flags_dir = $tmp_flags_dir
      end

      expect(USPSFlags.configuration.clear).to be(true)
    end
  end

  describe 'Rails configuration' do
    before do
      class Rails
        def self.root
          'tmp/rails_app'
        end
      end

      @config = described_class.new do |config|
        config.flags_dir = $tmp_flags_dir
      end
    end

    it 'uses the default Rails log directory' do
      expect(@config.log_path).to eql('tmp/rails_app/log')
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
usps_flags-0.6.4 spec/usps_flags/config_spec.rb
usps_flags-0.6.3 spec/usps_flags/config_spec.rb
usps_flags-0.6.2 spec/usps_flags/config_spec.rb
usps_flags-0.6.1 spec/usps_flags/config_spec.rb
usps_flags-0.6.0 spec/usps_flags/config_spec.rb
usps_flags-0.5.9 spec/usps_flags/config_spec.rb
usps_flags-0.5.8 spec/usps_flags/config_spec.rb
usps_flags-0.5.7 spec/usps_flags/config_spec.rb
usps_flags-0.5.6 spec/usps_flags/config_spec.rb
usps_flags-0.5.5 spec/usps_flags/config_spec.rb
usps_flags-0.5.4 spec/usps_flags/config_spec.rb
usps_flags-0.5.3 spec/usps_flags/config_spec.rb
usps_flags-0.5.2 spec/usps_flags/config_spec.rb
usps_flags-0.5.1 spec/usps_flags/config_spec.rb