Sha256: e9c01d0ef5fc7d37231b335614e98fdaa42df7db38d96bd25157f4ee7dd7bf55

Contents?: true

Size: 837 Bytes

Versions: 4

Compression:

Stored size: 837 Bytes

Contents

if respond_to?(:require_relative, true)
  require_relative 'common'
else
  require File.dirname(__FILE__) + '/common'
end

require 'rest-core/util/config'
::Rails = Object.new

describe RestCore::Config do

  before do
    @klass = RestGraph.dup
  end

  after do
    RR.verify
  end

  def check
    @klass.default_app_id     .should == 41829
    @klass.default_secret     .should == 'r41829'.reverse
    @klass.default_auto_decode.should == false
    @klass.default_lang       .should == 'zh-tw'
  end

  should 'honor rails config' do
    mock(Rails).env { 'test' }
    mock(Rails).root{ File.dirname(__FILE__) }
    RestCore::Config.load_for_rails(@klass)
    check
  end

  should 'honor config' do
    RestCore::Config.load(
      @klass,
      "#{File.dirname(__FILE__)}/config/rest-core.yaml",
      'test')
    check
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rest-core-0.2.3 test/test_load_config.rb
rest-core-0.2.2 test/test_load_config.rb
rest-core-0.2.1 test/test_load_config.rb
rest-core-0.2.0 test/test_load_config.rb