Sha256: 088a67b809312a73229b2ca0f6980d3bfcf7c4e5ea2ac12f7d8f6f8d92075567

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

Synvert::Rewriter.new "convert_rspec_stub_and_mock_to_double" do
  description <<-EOF
It converts stub and mock to double.

    stub('something') => double('something')
    mock('something') => double('something')
  EOF

  if_gem 'rspec', {gte: '2.14.0'}

  within_files 'spec/**/*.rb' do
    # stub('something') => double('something')
    # mock('something') => double('something')
    with_node type: 'send', receiver: nil, message: 'stub' do
      replace_with "double({{arguments}})"
    end

    with_node type: 'send', receiver: nil, message: 'mock' do
      replace_with "double({{arguments}})"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
synvert-0.0.17 lib/synvert/snippets/rspec/stub_and_mock_to_double.rb
synvert-0.0.16 lib/synvert/snippets/rspec/stub_and_mock_to_double.rb
synvert-0.0.15 lib/synvert/snippets/rspec/stub_and_mock_to_double.rb
synvert-0.0.14 lib/synvert/snippets/rspec/stub_and_mock_to_double.rb