[rspec-devel] [ rspec-Feature Requests-14391 ] .should respond_to() vs respond_to?()

noreply at rubyforge.org noreply at rubyforge.org
Mon Nov 19 00:33:29 EST 2007


Feature Requests item #14391, was opened at 2007-10-02 18:00
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=14391&group_id=797

Category: expectation module
Group: None
Status: Open
Priority: 3
Submitted By: Garrett Heaver (garrettheaver)
Assigned to: David Chelimsky (dchelimsky)
Summary: .should respond_to() vs respond_to?()

Initial Comment:
In Rails, when methods are declared on an association such as a has_many, these methods are not visible to the respond_to() rSpec method.

for example:

class Item < ActiveRecord::Base
has_many :translations do
    def active
        find(:first, :conditions => {:language_id, Language.active.id})
    end
end
end

it "should add an active method to the translations association" do
  @item.translations.should respond_to(:active)
end

^^ will never pass, however

it "should add an active method to the translations association" do
  @item.translations.respond_to?(:active).should be_true
end

^^ will pass

----------------------------------------------------------------------

Comment By: Chad Humphries (spicycode)
Date: 2007-11-19 00:33

Message:
Moved to http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/122-14391-should-respond_to-vs-respond_to#ticket-122-2

----------------------------------------------------------------------

Comment By: Garrett Heaver (garrettheaver)
Date: 2007-10-02 18:09

Message:
If you think it belongs better as that David, absolutly.

I'm going to try and dig into it a bit myself but someone who knows the matcher 
better might well beat me to it.

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-10-02 18:05

Message:
This strikes me as a bug rather than a feature request - agree?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=14391&group_id=797


More information about the rspec-devel mailing list