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

noreply at rubyforge.org noreply at rubyforge.org
Tue Oct 2 18:00:10 EDT 2007


Feature Requests item #14391, was opened at 2007-10-02 22: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: Nobody (None)
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

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

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