spec/configoro_spec.rb in configoro-1.4.0 vs spec/configoro_spec.rb in configoro-1.4.1
- old
+ new
@@ -5,54 +5,54 @@
describe Configoro do
subject { MyApp::Configuration }
describe "#initialize" do
it "should make the configuration available to MyApp::Configuration" do
- subject.should be_kind_of(Configoro::Hash)
+ expect(subject).to be_kind_of(Configoro::Hash)
end
it "should load data from the config files" do
- subject.basic.common_only.should eql('common')
+ expect(subject.basic.common_only).to eql('common')
end
it "should give priority to environment-specific files" do
- subject.basic.env_name.should eql('development')
+ expect(subject.basic.env_name).to eql('development')
end
it "should not load data from other environments" do
- subject.basic['should_not_exist'].should be_nil
+ expect(subject.basic['should_not_exist']).to be_nil
end
it "should convert hashes recursively" do
- subject.hash_test.akey.should eql('value')
+ expect(subject.hash_test.akey).to eql('value')
end
it "should deep-merge hashes" do
- subject.hash_test.subhash.key1.should eql('val1')
- subject.hash_test.subhash.key2.should eql('newval')
+ expect(subject.hash_test.subhash.key1).to eql('val1')
+ expect(subject.hash_test.subhash.key2).to eql('newval')
end
it "should not complain when there is no directory for the current environment" do
- Rails.stub!(:env).and_return('unknown')
+ allow(Rails).to receive(:env).and_return('unknown')
Configoro.initialize
- MyApp::Configuration.should eql({"basic"=>{"common_only"=>"common", "env_name"=>"common"}, "erb_test" => {"sum" => 2}, "hash_test"=>{"akey"=>"value", "subhash"=>{"key1"=>"val1", "key2"=>"val2"}}})
+ expect(MyApp::Configuration).to eql({"basic"=>{"common_only"=>"common", "env_name"=>"common"}, "erb_test" => {"sum_test" => 2}, "hash_test"=>{"akey"=>"value", "subhash"=>{"key1"=>"val1", "key2"=>"val2"}}})
end
context "[custom search paths]" do
before(:each) { Configoro.instance_variable_set :@paths, nil }
it "should use common configuration under a custom search path" do
- Rails.stub!(:env).and_return('unknown')
+ allow(Rails).to receive(:env).and_return('unknown')
Configoro.paths << File.join(File.dirname(__FILE__), 'data', 'other')
Configoro.initialize
- MyApp::Configuration.basic.env_name.should eql('other_common')
+ expect(MyApp::Configuration.basic.env_name).to eql('other_common')
end
it "should use environment-specific configuration under a custom search path" do
- Rails.stub!(:env).and_return('development')
+ allow(Rails).to receive(:env).and_return('development')
Configoro.paths << File.join(File.dirname(__FILE__), 'data', 'other')
Configoro.initialize
- MyApp::Configuration.basic.env_name.should eql('other_development')
+ expect(MyApp::Configuration.basic.env_name).to eql('other_development')
end
end
end
end