[rspec-users] object_instance.reload and print out a message placed in the model

Daniel Salmeron Amselem daniel.amselem at gmail.com
Mon Feb 21 07:18:17 EST 2011

I'm trying to test this with Ruby 1.9.2, RSpec 2.5.0, and Rails 3.0.4:

  context "toggle_resource method" do
    it "should remove the resource from the group" do
      group = Factory(:unique_group)
      user = Factory(:unique_user, :account => group.account)

      group.should have(1).users
      group.should have(0).users

and I had to add 'group.reload' in order to make this thing work. I would 
appreciate if anyone could explain to me why do I need to do it, and why I 
can't see a message that it's in the model, something like the following:

  def add_resource(resource)
    p "HEY"
    GroupResource.create(:resource => resource, :group => self)

The message "HEY" doesn't appear in the console after running 'rspec 
spec/models/group_spec.rb'. Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110221/9261c264/attachment.html>

More information about the rspec-users mailing list