Sha256: a2f26923faf254b470e943c9f37d3f2b290fd50ff3989c4fe22a5fcc6cd48676
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require 'fileutils' require 'janus/configuration' require 'janus/test' describe Janus::Configuration do describe '::load' do it 'merges provided option hashes' do a = { a: '' } b = { b: '' } File.stub(:exists?) { true } IO.stub(:read) { YAML.dump({}) } Janus::Configuration.should_receive(:new).with({ a: '', b: '' }) Janus::Configuration.load(a, b) end it 'includes options from YAML configuration when files exists' do config = { b: '', c: '' } IO.stub(:read) { YAML.dump(config) } File.stub(:exists?) { |f| f == 'Janusfile' } Janus::Configuration.should_receive(:new).with({ a: '', b: '', c: '' }) Janus::Configuration.load({ a: '' }, config) end end describe '#username' do it 'returns username' do configuration = Janus::Configuration.new('username' => 'username') configuration.username.should == 'username' end end describe '#access_key' do it 'returns access key' do configuration = Janus::Configuration.new('access_key' => 'access_key') configuration.access_key.should == 'access_key' end end describe '#tests' do it 'creates test for each entry in configuration file' do test_configuration = [] test_configuration << { 'name' => 'a', 'url' => 'a' } test_configuration << { 'name' => 'b', 'url' => 'b' } configuration = Janus::Configuration.new({ 'tests' => test_configuration }) configuration.tests.each_with_index do |test, i| test.name.should == test_configuration[i]['name'] test.url.should == test_configuration[i]['url'] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
janus-cli-0.1.0 | spec/janus/configuration_spec.rb |