psyho / bogus

Fake library for Ruby
Other
359 stars 14 forks source link

Spying on object creation gets "undefined method should" #47

Closed IanWhitney closed 10 years ago

IanWhitney commented 10 years ago

ruby 1.9.3-p194 bogus 0.1.4 minitest 4.7.5

No other gems are being loaded.

describe SoapRequestBuilder::RequestBuilder do
  fake_class(SoapRequestBuilder::BodyBuilder)

  describe "#body" do
    it "lets SoapRequestBuilder::BodyBuilder do the work" do
      @model = Person.new
      SoapRequestBuilder::RequestBuilder.new(@model).body
      SoapRequestBuilder::BodyBuilder.should have_received.new(@model)
    end
  end
end

Running this gives me

NoMethodError: undefined method `should' for SoapRequestBuilder::BodyBuilder:Class

Not sure if this is a Bogus problem or a problem with my setup.

psyho commented 10 years ago

You are using minitest and should is a part of RSpec syntax. Check out the docs for our minitest support to learn the correct syntax: https://www.relishapp.com/bogus/bogus/v/0-1-4/docs/minitest-support#spying-on-method-calls-with-expectation-syntax