Within my project, I have a number of models that have additional methods
within them other than those provided by active record.
as an example (to keep it short and sweet)
class foo < ActiveRecod::Base
def status
"New Record"
end
def reset
"Reset"
end
end
in my spec file I have
require 'spec_helper'
describe Foo do
before(:each) do
@foo = Foo.new()
end
it "should have a status of New Record"
@foo.status.should == "New Record"
end
it "should have a status of Reset after reset"
@foo.reset.should == "Reset"
end
end
however, when I run rake spec I get
NoMethodError in 'Foo should have a status of New Record'
undefined method 'status' for #<Hash...>
and an equivalent one for the other method.
I am sure that this is something fundamental in my understanding, but I'm
scuppered. I have spent the best part of a day trying to resolve this.
so,
1) Why are my methods undefined, when they are there (I can create the
object via script/console and call the status and reset methods and see them
work)
2) What is the best way of resolving the issue
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091214/67988a7d/attachment-0001.html>