lib/synvert/snippets/rspec/method_stub.rb in synvert-0.0.10 vs lib/synvert/snippets/rspec/method_stub.rb in synvert-0.0.11

- old
+ new

@@ -1,7 +1,7 @@ Synvert::Rewriter.new "convert_rspec_method_stub", "RSpec converts method stub" do - gem_spec 'rspec', '2.14.0' + if_gem 'rspec', {gte: '2.14.0'} within_files 'spec/**/*.rb' do # obj.stub!(:message) => obj.stub(:message) # obj.unstub!(:message) => obj.unstub(:message) {stub!: 'stub', unstub!: 'unstub'}.each do |old_message, new_message| @@ -34,10 +34,10 @@ replace_with "allow({{receiver}}).to receive({{arguments}})" end end end - gem_spec 'rspec', '3.0.0' + if_gem 'rspec', {gte: '3.0.0'} within_files 'spec/**/*.rb' do # obj.stub_chain(:foo, :bar, :baz) => allow(obj).to receive_message_chain(:foo, :bar, :baz) with_node type: 'send', message: 'stub_chain' do if_exist_node type: 'send', message: 'any_instance' do