Sha256: a37264f79ceacb3673410234f19267843328c93418bc07bea07ca1d0c09e0ae9
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require 'fileutils' require 'simple_navigation/config_file_finder' module SimpleNavigation describe ConfigFileFinder do subject(:finder) { ConfigFileFinder.new(paths) } let(:paths) { ['/path/one', '/path/two'] } describe '#find', memfs: true do before { FileUtils.mkdir_p(paths) } context 'when the context is :default' do let(:context) { :default } context 'and a navigation.rb file is found in one of the paths' do before { FileUtils.touch('/path/one/navigation.rb') } it 'returns its full path' do expect(finder.find(context)).to eq '/path/one/navigation.rb' end end context 'and no navigation.rb file is found in the paths' do it 'raises an exception' do expect { finder.find(context) }.to raise_error(RuntimeError, /Config file 'navigation.rb' not found in path\(s\)/) end end end context 'when the context is :other' do let(:context) { :other } context 'and a other_navigation.rb file is found in one of the paths' do before { FileUtils.touch('/path/two/other_navigation.rb') } it 'returns its full path' do expect(finder.find(context)).to eq '/path/two/other_navigation.rb' end end context 'and no other_navigation.rb file is found in the paths' do it 'raise an exception' do expect{ finder.find(context) }.to raise_error(RuntimeError, /Config file 'other_navigation.rb' not found in path\(s\)/) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple-navigation-4.4.0 | spec/simple_navigation/config_file_finder_spec.rb |
simple-navigation-4.3.0 | spec/simple_navigation/config_file_finder_spec.rb |