Sha256: ff6beb19142c3bbe4cdd569ba8ab21e36a02332ad454be6323be3d0fed5f5091

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

RSpec.describe RuboCop::RSpec::Wording do
  let(:replacements) do
    { 'have' => 'has', 'not' => 'does not' }
  end

  let(:ignores) do
    %w(only really)
  end

  expected_rewrites =
    {
      'should return something'            => 'returns something',
      'should not return something'        => 'does not return something',
      'should do nothing'                  => 'does nothing',
      'should have sweets'                 => 'has sweets',
      'should worry about the future'      => 'worries about the future',
      'should pay for pizza'               => 'pays for pizza',
      'should obey my orders'              => 'obeys my orders',
      'should deploy the app'              => 'deploys the app',
      'should buy the product'             => 'buys the product',
      'should miss me'                     => 'misses me',
      'should fax the document'            => 'faxes the document',
      'should amass debt'                  => 'amasses debt',
      'should echo the input'              => 'echoes the input',
      'should alias the method'            => 'aliases the method',
      'should search the internet'         => 'searches the internet',
      'should wish me luck'                => 'wishes me luck',
      'should really only return one item' => 'really only returns one item',
      "shouldn't return something"         => 'does not return something'
    }

  expected_rewrites.each do |old, new|
    it %(rewrites "#{old}" as "#{new}") do
      rewrite =
        described_class.new(
          old,
          replace: replacements,
          ignore:  ignores
        ).rewrite

      expect(rewrite).to eql(new)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-rspec-1.15.0 spec/rubocop/rspec/wording_spec.rb
rubocop-rspec-1.14.0 spec/rubocop/rspec/wording_spec.rb
rubocop-rspec-1.13.0 spec/rubocop/rspec/wording_spec.rb