Forum: RSpec MyModel.stub!l works in 1.1.11 but fails in 1.1.12

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
498c036f89f807d07adde4c4c7854a69?d=identicon&s=25 Brad (Guest)
on 2009-02-05 02:44
(Received via mailing list)
I have a controller spec that works find with Rails 2.2.2 and Rspec-
Rails 1.1.11.  The code is:

  @activity=mock_model(Activity, :id => 7)
  Activity.stub!(:get).with("7").and_return(@activity

When I update to 1.1.12

ArgumentError in 'ActivitiesController' wrong number of arguments (2
for 1)

For some reason the file
  rspec-1.1.12/lib/spec/mocks/proxy.rb at line 149
149        return @target.respond_to?(sym, true)

is attempting to send two arguments. Rspec 1.1.11 did not have the
second argument ('true').  What is going on here?

Any help appreciated.

Brad
5d38ab152e1e3e219512a9859fcd93af?d=identicon&s=25 David Chelimsky (Guest)
on 2009-02-05 04:27
(Received via mailing list)
On Wed, Feb 4, 2009 at 7:42 PM, Brad <brad.forsyth@inspire2go.com>
wrote:
>
> For some reason the file
>  rspec-1.1.12/lib/spec/mocks/proxy.rb at line 149
> 149        return @target.respond_to?(sym, true)
>
> is attempting to send two arguments. Rspec 1.1.11 did not have the
> second argument ('true').  What is going on here?

http://www.ruby-doc.org/core/classes/Object.html#M000333

The optional second argument determines whether to include private
methods or not. We added it to resolve a bug:

http://rspec.lighthouseapp.com/projects/5645/tickets/450

Is the code in question overriding respond_to? ?
498c036f89f807d07adde4c4c7854a69?d=identicon&s=25 Brad (Guest)
on 2009-02-05 14:34
(Received via mailing list)
On Feb 4, 10:22 pm, David Chelimsky <dchelim...@gmail.com> wrote:
> > for 1)
> The optional second argument determines whether to include private
> methods or not. We added it to resolve a bug:
>
> http://rspec.lighthouseapp.com/projects/5645/tickets/450
>
> Is the code in question overriding respond_to? ?
>

That is the problem!  The Activities has a method_missing and
responds_to? that falls back to super.
Thank you very much for your prompt (and helpful) response, David.
Not having my Spec's work drive me crazy : )

Brad
This topic is locked and can not be replied to.