spec/railtie_spec.rb in couch_potato-0.6.0 vs spec/railtie_spec.rb in couch_potato-0.7.0.pre.1

- old
+ new

@@ -8,58 +8,60 @@ end class Railtie def self.initializer(*args) end end - + def self.root RSpec::Mocks::Mock.new :join => '' end end require 'couch_potato/railtie' describe "railtie" do before(:all) do - @validation_framework = CouchPotato::Config.validation_framework + @database_name = CouchPotato::Config.database_name + @default_language = CouchPotato::Config.default_language end - + after(:all) do - CouchPotato::Config.validation_framework = @validation_framework + CouchPotato::Config.database_name = @database_name + CouchPotato::Config.default_language = @default_language end - + context 'yaml file contains only database names' do it "should set the database name from the yaml file" do File.stub(:read => "test: test_db") - + CouchPotato::Config.should_receive(:database_name=).with('test_db') - + CouchPotato.rails_init end end - + context 'yaml file contains more configuration' do before(:each) do - File.stub(:read => "test: \n database: test_db\n validation_framework: :active_model") + File.stub(:read => "test: \n database: test_db\n default_language: :erlang") end - - it "should set the database name from the yaml file" do + + it "set the database name from the yaml file" do CouchPotato::Config.should_receive(:database_name=).with('test_db') - + CouchPotato.rails_init end - - it "should set the validation framework from the yaml file" do - CouchPotato::Config.should_receive(:validation_framework=).with(:active_model) - + + it 'sets the default language from the yaml file' do + CouchPotato::Config.should_receive(:default_language=).with(:erlang) + CouchPotato.rails_init end end - + it "should process the yml file with erb" do File.stub(:read => "test: \n database: <%= 'db' %>") CouchPotato::Config.should_receive(:database_name=).with('db') - + CouchPotato.rails_init end end