Sha256: d4e479348b2a091d8db2df6f1031cf9d9f18fc10bf257c1c2c9fa6e8ee8462a7
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe Loader::Utils do let(:project_folder) { 'Path/To/Project/Folder' } subject { Loader::Utils } describe '#pwd' do before do allow(ENV).to receive(:[]).with('BUNDLE_GEMFILE').and_return(nil) end context 'bundler envernioment variable set' do before do allow(ENV).to receive(:[]).with('BUNDLE_GEMFILE').and_return(File.join(project_folder,'Gemfile')) end it 'should return the project root folder by bundler gemfile env' do expect(subject.pwd).to eq project_folder end end context 'Rails is present and the root methot return not nil object' do let(:rails) { double('rails', :root => project_folder) } before { stub_const('Rails', rails) } it 'should fetch rails root path' do expect(subject.pwd).to eq project_folder end end context 'when everything fails, fall back use build in Dir module' do it 'should use dir pwd on fallback' do expect(Dir).to receive(:pwd).and_return(project_folder) expect(subject.pwd).to eq project_folder end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
loader-3.1.0 | spec/loader/helpers_spec.rb |
loader-3.0.1 | spec/loader/helpers_spec.rb |