Sha256: 11e6b8d5df60e307fc67ac19635850d6b7a5b30b8c78a4a5c9b1145f9b54d450

Contents?: true

Size: 1.69 KB

Versions: 5

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

module Restfulie::Client::Configuration::Test
  class XmlRepresentation; end
end

describe Restfulie::Client::Configuration do

  let(:configuration) { Restfulie::Client::Configuration.new }

  it "should be development as default environment" do
    configuration.environment.should equal :development    
  end
  
  it "should be a empty string as default entry point" do
    configuration.entry_point.should eql ''
  end

  it "should be a empty hash as default representations" do
    configuration.representations.should == {}
  end
  
  it "should allow to set the test environment" do
    configuration.environment = :test
    configuration.environment.should equal :test
  end
  
  it "should allow a xml representation" do
    configuration.representations['application/xml'] = Restfulie::Client::Configuration::Test::XmlRepresentation
    configuration.representations['application/xml'].should == Restfulie::Client::Configuration::Test::XmlRepresentation    
  end
  
  it 'should allow change values for many environments' do
    configuration.entry_point = "http://foo.com/bar"
    configuration.entry_point.should == 'http://foo.com/bar'
        
    configuration.environment = :test
    
    configuration.entry_point.should be_empty
    configuration.representations.should be_empty
    
    configuration.entry_point = "http://bar.com/foo"
    
    configuration.representations['application/xml'] = Restfulie::Client::Configuration::Test::XmlRepresentation
    
    configuration.environment = :development
    configuration.entry_point.should == 'http://foo.com/bar'
    
    configuration.environment = :test
    configuration.entry_point.should == 'http://bar.com/foo'
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 spec/unit/client/configuration_spec.rb
restfulie-1.1.1 spec/unit/client/configuration_spec.rb
restfulie-1.1.0 spec/unit/client/configuration_spec.rb
restfulie-nosqlite-1.0.3 spec/unit/client/configuration_spec.rb
restfulie-1.0.3 spec/unit/client/configuration_spec.rb