for associations, among other things, i've been using http://rspec-on- rails-matchers.googlecode.com/svn/trunk/README

linoj


On Mar 31, 2008, at 8:33 PM, Anthony Broad-Crawford wrote:

I have been using the following approach. Looking forward to see if anyone else does something better to test associations ...

describe "Profile Associations" do

        it "should belong to ..." do
                Profile.should_receive(:belongs_to).with(:account)

                load "profile.rb"
        end

end

Anthony Broad-Crawford


On Mar 31, 2008, at 8:21 PM, Tim Haines wrote:
Hi there,

A couple of complete newb questions here.

Should I be spec'ing the existence of attributes on models? While reading through the docs and googling I haven't seen any example that checks if attributes exist on a model. i.e. Game.Description.

Likewise, what I've seen on spec'ing associations seems light. What spec should I be writing before I add a belongs_to :genre to my game model? The closest I've seen is probably this -> http:// blog.imperialdune.com/2007/2/27/rspec-ing-model-associations

Cheers,

Tim.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to