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.add_resource(user)
      group.reload
      group.should have(1).users
      
      group.toggle_resource(user)
      group.reload
      group.should have(0).users
    end
  end

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)
  end

The message "HEY" doesn't appear in the console after running 'rspec 
spec/models/group_spec.rb'. Thanks in advance.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to