lib/synvert/snippets/rspec/block_to_expect.rb in synvert-0.0.11 vs lib/synvert/snippets/rspec/block_to_expect.rb in synvert-0.0.12
- old
+ new
@@ -1,12 +1,12 @@
Synvert::Rewriter.new "convert_rspec_block_to_expect", "RSpec converts block to expect" do
if_gem 'rspec', {gte: '2.11.0'}
- {should: 'to', should_not: 'not_to'}.each do |old_message, new_message|
- within_files 'spec/**/*.rb' do
- # lambda { do_something }.should raise_error => expect { do_something }.to raise_error
- # proc { do_something }.should raise_error => expect { do_something }.to raise_error
- # -> { do_something }.should raise_error => expect { do_something }.to raise_error
+ within_files 'spec/**/*.rb' do
+ # lambda { do_something }.should raise_error => expect { do_something }.to raise_error
+ # proc { do_something }.should raise_error => expect { do_something }.to raise_error
+ # -> { do_something }.should raise_error => expect { do_something }.to raise_error
+ {should: 'to', should_not: 'not_to'}.each do |old_message, new_message|
with_node type: 'send', receiver: {type: 'block'}, message: old_message do
replace_with "expect { {{receiver.body}} }.#{new_message} {{arguments}}"
end
end
end