[rspec-users] RSPEC and RoR undefined method for hash when running model tests

Matt Riches mattriches at gmail.com
Mon Dec 14 16:50:04 EST 2009


Yup, I did.

Thanks all. (unless anyone has any comments on the constants question I just
asked in a previous post?)

Regards

Matt

2009/12/14 Tom Stuart <tom at experthuman.com>

> On 14 Dec 2009, at 21:28, Matt Riches wrote:
> > describe Address do
> >   #Test Fixture - Before Each test Create a Standard Bread with the
> following attributes and properties
> >   before(:each) do
> >     @address = {
> >       :business_name => 'business', :first_line => '10, This Street',
> :second_line=> 'erewhon', :town=> 'town', :county=>'county',
> >       :postcode =>'AB12 3CD', :user_id => 1, :lat=>1.01, :lng=>2.02,
> :status=>Address::JUST_REGISTERED, :route_id=>1
> >     }
> >   end
> >
> >   it "should have a status of deleted after reset" do
> >     @address.reset
> >     @address.status.should == :Address::DELETED
> >   end
> > end
>
> The problem is that you're setting @address to a hash, not an instance of
> Address. Did you mean @address = Address.new :business_name => ...?
>
> Cheers,
> -Tom
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091214/27a2e844/attachment.html>


More information about the rspec-users mailing list