spec/rake/funnel/support/which_spec.rb in rake-funnel-0.18.0 vs spec/rake/funnel/support/which_spec.rb in rake-funnel-0.19.0

- old
+ new

@@ -1,21 +1,21 @@ require 'tmpdir' describe Rake::Funnel::Support::Which do let(:temp_dir) { Dir.mktmpdir } let(:executable_path) { File.join(temp_dir, 'executable.exe') } - let(:create_entry) { lambda { |p| FileUtils.touch(p) }} + let(:create_entry) { ->(p) { FileUtils.touch(p) } } - before { + before do create_entry.call(executable_path) allow(ENV).to receive(:[]).with('PATH').and_return(temp_dir) - } + end - after { + after do FileUtils.rm_rf(temp_dir) - } + end describe 'executable in PATH' do context 'found' do it 'should yield executable' do expect(described_class.which(File.basename(executable_path))).to eq(executable_path) @@ -27,11 +27,11 @@ expect(described_class.which('does-not-exist.exe')).to be_nil end end context 'found as directory' do - let(:create_entry) { lambda { |p| FileUtils.mkdir_p(p) } } + let(:create_entry) { ->(p) { FileUtils.mkdir_p(p) } } it 'should yield nil' do expect(described_class.which('executable.exe')).to be_nil end end @@ -53,10 +53,10 @@ end end end context 'found as directory' do - let(:create_entry) { lambda { |p| FileUtils.mkdir_p(p) } } + let(:create_entry) { ->(p) { FileUtils.mkdir_p(p) } } it 'should yield nil' do expect(described_class.which('executable.exe')).to be_nil end end