Sha256: 460e24c1e12167db41427deceb61a1f0012f6f73e184ebd48029002037e13a27

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

describe USPSFlags::Config do
  describe "class variable accessors" do
    it "should return the current flags directory" do
      expect(USPSFlags::Config.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::Config.log_path).to eql(default_log_path)
    end

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

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

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

  describe "configuration constructor" do
    it "should return a properly constructed configuration" do
      @config = USPSFlags::Config.new do |config|
        config.flags_dir = $tmp_flags_dir
      end

      expect(@config.flags_dir).to eql($tmp_flags_dir)
      expect(@config.reset).to eql(false)
      expect(@config.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(USPSFlags::Config.log_path).to eql("tmp/rails_app/log")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
usps_flags-0.3.10 spec/usps_flags/config_spec.rb