Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (50 sloc) 1.23 KB
require 'helper'
describe Awesome::Client do
before do
@keys = Awesome::Configuration::VALID_CONFIG_KEYS
end
describe 'with module configuration' do
before do
Awesome.configure do |config|
@keys.each do |key|
config.send("#{key}=", key)
end
end
end
after do
Awesome.reset
end
it "should inherit module configuration" do
api = Awesome::Client.new
@keys.each do |key|
api.send(key).must_equal key
end
end
describe 'with class configuration' do
before do
@config = {
:api_key => 'ak',
:format => 'of',
:endpoint => 'ep',
:user_agent => 'ua',
:method => 'hm',
}
end
it 'should override module configuration' do
api = Awesome::Client.new(@config)
@keys.each do |key|
api.send(key).must_equal @config[key]
end
end
it 'should override module configuration after' do
api = Awesome::Client.new
@config.each do |key, value|
api.send("#{key}=", value)
end
@keys.each do |key|
api.send("#{key}").must_equal @config[key]
end
end
end
end
end