[rspec-users] [NoMethodError] simple problem

David Chelimsky dchelimsky at gmail.com
Sun May 27 11:39:31 EDT 2007


On 5/27/07, Andrew WC Brown <omen.king at gmail.com> wrote:
> I think this test should pass but it doesn't
>
> 1)
> NoMethodError in 'Person should return full name'
> undefined method `full_name?' for #<Person:0x3567964>
> ./spec/models/person_spec.rb:43:
>
> describe Person do
>  it "should return full name" do
>     person = Person.new
>     person.should be_full_name
>   end
> end
>
> class Person < ActiveRecord::Base
>   def full_name
>     true
>   end
> end

The error message says that what is missing is full_name?, not
full_name. Try this:

class Person < ActiveRecord::Base
  def full_name?
    true
  end
end


More information about the rspec-users mailing list