spec/railtie_spec.rb in couch_potato-0.7.0.pre.1 vs spec/railtie_spec.rb in couch_potato-0.7.0
- old
+ new
@@ -4,18 +4,23 @@
module Rails
def self.env
'test'
end
+
class Railtie
def self.initializer(*args)
end
end
def self.root
RSpec::Mocks::Mock.new :join => ''
end
+
+ def self.logger
+ RSpec::Mocks::Mock.new :warn => nil
+ end
end
require 'couch_potato/railtie'
describe "railtie" do
@@ -25,9 +30,25 @@
end
after(:all) do
CouchPotato::Config.database_name = @database_name
CouchPotato::Config.default_language = @default_language
+ end
+
+ before(:each) do
+ File.stub(exist?: true)
+ end
+
+ context 'when the yml file does not exist' do
+ before(:each) do
+ File.stub(exist?: false)
+ end
+
+ it 'does not configure the database' do
+ CouchPotato::Config.should_not_receive(:database_name=)
+
+ CouchPotato.rails_init
+ end
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")