spec/lib/simple_navigation_spec.rb in simple-navigation-3.12.0 vs spec/lib/simple_navigation_spec.rb in simple-navigation-3.12.1

- old
+ new

@@ -43,19 +43,19 @@ context 'when one config_file_path is set' do before { subject.config_file_paths = ['my_config_file_path'] } context 'and the requested config file exists' do - before { File.stub(exists?: true) } + before { File.stub(exist?: true) } it 'returns the path to the config_file' do expect(subject.config_file).to eq 'my_config_file_path/navigation.rb' end end context 'and the requested config file does not exist' do - before { File.stub(exists?: false) } + before { File.stub(exist?: false) } it 'returns nil' do expect(subject.config_file).to be_nil end end @@ -63,19 +63,19 @@ context 'when multiple config_file_paths are set' do before { subject.config_file_paths = ['first_path', 'second_path'] } context 'and the requested config file exists' do - before { File.stub(exists?: true) } + before { File.stub(exist?: true) } it 'returns the path to the first matching config_file' do expect(subject.config_file).to eq 'first_path/navigation.rb' end end context 'and the requested config file does not exist' do - before { File.stub(exists?: false) } + before { File.stub(exist?: false) } it 'returns nil' do expect(subject.config_file).to be_nil end end @@ -194,11 +194,11 @@ describe 'Regarding caching of the config-files' do before do subject.config_file_path = 'path_to_config' IO.stub(:read).and_return('file_content') - File.stub(exists?: true) + File.stub(exist?: true) end after { subject.config_files = {} } shared_examples 'loading config file' do |env, count| @@ -283,7 +283,18 @@ end it_behaves_like 'loading the right adapter', :rails, :Rails it_behaves_like 'loading the right adapter', :padrino, :Padrino it_behaves_like 'loading the right adapter', :sinatra, :Sinatra + end + + describe '.init_adapter_from' do + let(:adapter) { double(:adapter) } + let(:adapter_class) { double(:adapter_class, new: adapter) } + + it 'sets the adapter to a new instance of adapter_class' do + subject.adapter_class = adapter_class + subject.init_adapter_from(:default) + expect(subject.adapter).to be adapter + end end end