Sha256: eb11613d4c9471a8cec90f9ecce3ecd5cd0868765aacdbeb09ebef167de976a6

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')


describe Baurets::Optionsful::Config do

  include Rack::Test::Methods

  context "Config carries specific settings" do
    
    describe "when there's no custom config file, use expected default settings" do
      
      it "the Link header generation must be disabled" do
        config = Baurets::Optionsful::Config.new("file_error.txt")
        config.link.should be false
      end
      
    end
    
    describe "when there is a custom config file, load the settings from it" do
      
      it "the Link header generation must be disabled" do
        file = File.join(File.dirname(__FILE__), 'config', 'optionsful_link_false.yml')
        config = Baurets::Optionsful::Config.new(file)
        config.link.should be false
      end
      
      it "the Link header generation must be enabled" do
        config = Baurets::Optionsful::Config.new(File.join(File.dirname(__FILE__), 'config', 'optionsful.yml'))
        config.link.should be true
      end
      
      it "if the Link header generation is enabled, host value must be set" do
        config = Baurets::Optionsful::Config.new(File.join(File.dirname(__FILE__), 'config', 'optionsful.yml'))
        config.link.should be true
        config.host.empty?.should_not be true
      end
      
      it "if the Link header generation is enabled, host value accepts 'auto'" do
        config = Baurets::Optionsful::Config.new(File.join(File.dirname(__FILE__), 'config', 'optionsful_host_auto.yml'))
        config.link.should be true
        config.host.should == "auto"
      end
      
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
optionsful-0.3.2 spec/optionsful_config_spec.rb
optionsful-0.3.1 spec/optionsful_config_spec.rb
optionsful-0.3.0 spec/optionsful_config_spec.rb