Sha256: fd2e97c0e7f4808d2779ee2df6cf1c8b9034476db9e67ad0006dddfeb29fa906

Contents?: true

Size: 616 Bytes

Versions: 4

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

RSpec.describe RuboCop::Cop::RSpec::MessageChain do
  subject(:cop) { described_class.new }

  it 'finds `receive_message_chain`' do
    expect_offense(<<-RUBY)
      before do
        allow(foo).to receive_message_chain(:one, :two) { :three }
                      ^^^^^^^^^^^^^^^^^^^^^ Avoid stubbing using `receive_message_chain`.
      end
    RUBY
  end

  it 'finds old `stub_chain` syntax' do
    expect_offense(<<-RUBY)
      before do
        foo.stub_chain(:one, :two).and_return(:three)
            ^^^^^^^^^^ Avoid stubbing using `stub_chain`.
      end
    RUBY
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-rspec-1.35.0 spec/rubocop/cop/rspec/message_chain_spec.rb
rubocop-rspec-1.34.1 spec/rubocop/cop/rspec/message_chain_spec.rb
rubocop-rspec-1.34.0 spec/rubocop/cop/rspec/message_chain_spec.rb
rubocop-rspec-1.33.0 spec/rubocop/cop/rspec/message_chain_spec.rb