Sha256: 1ddc1d4690ae7fcf15ab07f7006548b8cf161f2af262f8bc5b9baacc85c32c07

Contents?: true

Size: 1.6 KB

Versions: 8

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

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

    it "should return the current flags directory" do
      default_log_path = $tmp_flags_dir + "/log"
      expect(USPSFlags.configuration.log_path).to eql(default_log_path)
    end

    it "should return a Boolean from use_larger_tridents" do
      expect([true, false]).to include(USPSFlags.configuration.use_larger_tridents)
    end

    it "should return a Boolean from clear" do
      expect([true, false]).to include(USPSFlags.configuration.clear)
    end
  end

  describe "trident" do
    it "should return a Hash from trident" do
      expect(USPSFlags.configuration.trident).to be_a(Hash)
    end
  end

  describe "configuration constructor" do
    it "should return 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)
      expect(USPSFlags.configuration.clear).to eql(true)
      expect(USPSFlags.configuration.use_larger_tridents).to eql(true)
    end
  end

  describe "Rails configuration" do
    before(:each) do
      class Rails
        def self.root
          "tmp/rails_app"
        end
      end

      @config = USPSFlags::Config.new do |config|
        config.flags_dir = $tmp_flags_dir
      end
    end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
usps_flags-0.3.21 spec/usps_flags/config_spec.rb
usps_flags-0.3.20 spec/usps_flags/config_spec.rb
usps_flags-0.3.19 spec/usps_flags/config_spec.rb
usps_flags-0.3.18 spec/usps_flags/config_spec.rb
usps_flags-0.3.17 spec/usps_flags/config_spec.rb
usps_flags-0.3.16 spec/usps_flags/config_spec.rb
usps_flags-0.3.15 spec/usps_flags/config_spec.rb
usps_flags-0.3.14 spec/usps_flags/config_spec.rb