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

- old
+ new

@@ -12,22 +12,22 @@ subject.apply!.revert! end end describe 'with definition' do - subject { + subject do described_class.new do |p| p.setup do output.puts 'setup' 42 end p.reset do |memo| output.puts memo end end - } + end let(:output) { double.as_null_object } context 'when applying the patch' do let!(:ret) { subject.apply! } @@ -40,14 +40,14 @@ expect(ret).to eq(subject) end end context 'when reverting the patch' do - let!(:ret) { + let!(:ret) do subject.apply! subject.revert! - } + end it 'should execute the reset' do expect(output).to have_received(:puts).with(42) end @@ -58,46 +58,46 @@ context 'when reverting an unapplied patch' do before { subject.revert! } it 'should not execute the reset' do - expect(output).to_not have_received(:puts).with(42) + expect(output).not_to have_received(:puts).with(42) end end context 'when applying twice' do - before { + before do subject.apply! subject.apply! - } + end it 'should execute the setup once' do expect(output).to have_received(:puts).with('setup').once end end context 'when reverting twice' do - before { + before do subject.apply! subject.revert! subject.revert! - } + end it 'should execute the revert once' do expect(output).to have_received(:puts).with(42).once end end describe 'context' do let(:context) { 42 } - subject { + subject do described_class.new(context) do |p| p.setup do |context| output.puts context end end - } + end before { subject.apply!.revert! } it 'should be accessible from within the patch definition' do expect(output).to have_received(:puts).with(42)