Sha256: 3112279a315919da9dd1a5473cc745e6d47fcac113ea1207bd0249f8aeca9e67

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

Synvert::Rewriter.new "convert_rspec_negative_error_expectation" do
  description <<-EOF
It converts rspec negative error expectation.

    expect { do_something }.not_to raise_error(SomeErrorClass) => expect { do_something }.not_to raise_error
    expect { do_something }.not_to raise_error('message') => expect { do_something }.not_to raise_error
    expect { do_something }.not_to raise_error(SomeErrorClass, 'message') => expect { do_something }.not_to raise_error
  EOF
  if_gem 'rspec', {gte: '2.14.0'}

  within_files 'spec/**/*.rb' do
    # expect { do_something }.not_to raise_error(SomeErrorClass) => expect { do_something }.not_to raise_error
    # expect { do_something }.not_to raise_error('message') => expect { do_something }.not_to raise_error
    # expect { do_something }.not_to raise_error(SomeErrorClass, 'message') => expect { do_something }.not_to raise_error
    within_node type: 'send', receiver: {type: 'block'}, message: 'not_to' do
      with_node type: 'send', message: 'raise_error' do
        replace_with "raise_error"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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