2

I have the following example:

it 'receives message' do
  expect(Foo).to receive(:bar).with(baz)
  OtherClass.send(baz)
end

class OtherClass
  def self.send(baz)
    Foo.bar(1) # this first one is the problem
    Foo.bar(baz)
  end
end

class Foo
  def self.bar(whatever)
    puts whatever + " was received"
  end
end

This is the error:

Failure/Error: Foo received :bar with unexpected arguments
mehulkar
  • 4,895
  • 5
  • 35
  • 55