spec/rake/funnel/tasks/paket_spec.rb in rake-funnel-0.21.0 vs spec/rake/funnel/tasks/paket_spec.rb in rake-funnel-0.21.1

- old
+ new

@@ -1,11 +1,8 @@ -include Rake -include Rake::Funnel::Support - describe Rake::Funnel::Tasks::Paket do before do - Task.clear + Rake::Task.clear end describe 'defaults' do its(:name) { should == :paket } its(:paket) { should == '.paket/paket.exe' } @@ -15,11 +12,11 @@ end describe 'execution' do before do allow(subject).to receive(:sh) - allow(Mono).to receive(:invocation).and_wrap_original do |_original_method, *args, &_block| + allow(Rake::Funnel::Support::Mono).to receive(:invocation).and_wrap_original do |_original_method, *args, &_block| args.compact end end context 'overriding defaults' do @@ -36,11 +33,11 @@ allow(File).to receive(:exist?).and_return(false) allow(subject).to receive(:sh) end before do - Task[subject.name].invoke + Rake::Task[subject.name].invoke end it 'should use custom bootstrapper' do expect(subject).to have_received(:sh).with(subject.bootstrapper, subject.bootstrapper_args) end @@ -50,19 +47,23 @@ end end describe 'mono invocation' do before do - Task[subject.name].invoke + Rake::Task[subject.name].invoke end it 'should use mono invocation for bootstrapper' do - expect(Mono).to have_received(:invocation).with(subject.bootstrapper, subject.bootstrapper_args) + expect(Rake::Funnel::Support::Mono).to have_received(:invocation) + .with(subject.bootstrapper, + subject.bootstrapper_args) end it 'should use mono invocation for paket' do - expect(Mono).to have_received(:invocation).with(subject.paket, subject.paket_args) + expect(Rake::Funnel::Support::Mono).to have_received(:invocation) + .with(subject.paket, + subject.paket_args) end end describe 'optional download' do before do @@ -70,11 +71,11 @@ allow(subject).to receive(:sh).with(subject.bootstrapper) end context 'success' do before do - Task[subject.name].invoke + Rake::Task[subject.name].invoke end context 'paket.exe exists' do let(:paket_exists) { true } @@ -108,34 +109,34 @@ before do allow(subject).to receive(:sh).with(subject.paket, anything).and_raise end it 'should fail' do - expect { Task[subject.name].invoke }.to raise_error(RuntimeError) + expect { Rake::Task[subject.name].invoke }.to raise_error(RuntimeError) end end end context 'paket.exe does not exist' do let(:paket_exists) { false } context 'bootstrapper failed' do before do - allow(subject).to receive(:sh).with(subject.bootstrapper).and_raise + allow(subject).to receive(:sh).with(subject.bootstrapper).and_raise(RuntimeError) end it 'should not run paket' do begin - Task[subject.name].invoke - rescue + Rake::Task[subject.name].invoke + rescue RuntimeError nil end expect(subject).not_to have_received(:sh).with(subject.paket, subject.paket_args) end it 'should fail' do - expect { Task[subject.name].invoke }.to raise_error(RuntimeError) + expect { Rake::Task[subject.name].invoke }.to raise_error(RuntimeError) end end end end end