Sha256: 86050745e50d50a65f85892c0b673996f693c70ae1fa09fd978825e8e45ccabe
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 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 = double('root') expect(@root).to 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', double('rails')) expect(Rails).to receive(:root).and_return(@root) load 'dump_rake/rails_root.rb' expect(DumpRake::RailsRoot).to be === @root end it "should use RAILS_ROOT if it is present" do Object.const_set('RAILS_ROOT', @root) load 'dump_rake/rails_root.rb' expect(DumpRake::RailsRoot).to be === @root end it "should use Dir.pwd else" do expect(Dir).to receive(:pwd).and_return(@root) load 'dump_rake/rails_root.rb' expect(DumpRake::RailsRoot).to be === @root end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dump-1.0.4 | spec/lib/dump_rake/rails_root_spec.rb |