Sha256: 0cb24d1ac174026f98c8a3d7988c1ceb09553693a3d0a8fcf9c772f6e7b011d4
Contents?: true
Size: 1.17 KB
Versions: 3
Compression:
Stored size: 1.17 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper' def temp_remove_const(where, which) around do |example| if where.const_defined?(which) old = where.send(:const_get, which) where.send(:remove_const, which) example.run where.send(:remove_const, which) if where.const_defined?(which) where.const_set(which, old) else example.run end end end describe 'RailsRoot' do before do @root = mock('root') @root.should_receive(:to_s).and_return(@root) end temp_remove_const Object, :Rails temp_remove_const Object, :RAILS_ROOT temp_remove_const DumpRake, :RailsRoot it "should use Rails if it is present" do Object.const_set('Rails', mock('rails')) Rails.should_receive(:root).and_return(@root) load 'dump_rake/rails_root.rb' DumpRake::RailsRoot.should === @root end it "should use RAILS_ROOT if it is present" do Object.const_set('RAILS_ROOT', @root) load 'dump_rake/rails_root.rb' DumpRake::RailsRoot.should === @root end it "should use Dir.pwd else" do Dir.should_receive(:pwd).and_return(@root) load 'dump_rake/rails_root.rb' DumpRake::RailsRoot.should === @root end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dump-1.0.2 | spec/lib/dump_rake/rails_root_spec.rb |
dump-1.0.1 | spec/lib/dump_rake/rails_root_spec.rb |
dump-1.0.0 | spec/lib/dump_rake/rails_root_spec.rb |