[rspec-users] Having A Problem Understanding mocks with .build

2011-12-04 Thread Ants Pants
Hello everyone, I am trying to do the following before(:each) do @valid_attributes = {:foo => 'bar'} @event_type = event_category.event_types.build(@valid_attributes) $stderr.puts " #{@event_type.class} *" end let (:event_category) { mock_model(EventCategory).as_null_ob

Re: [rspec-users] Having A Problem Understanding mocks with .build

2011-12-04 Thread David Chelimsky
On Dec 4, 2011, at 7:48 AM, Ants Pants wrote: > Hello everyone, > > I am trying to do the following > > before(:each) do > @valid_attributes = {:foo => 'bar'} > @event_type = event_category.event_types.build(@valid_attributes) > $stderr.puts " #{@event_type.class} *" >

Re: [rspec-users] Having A Problem Understanding mocks with .build

2011-12-04 Thread Ants Pants
David, Thanks very much for the reply. I was aware I was dealing with a mock, but I thought in this instance it would fool event_types into thinking it was a genuine object to allow the association to be made and return EventType. So what are my options? To add the data to the DB or to build the

Re: [rspec-users] Having A Problem Understanding mocks with .build

2011-12-04 Thread David Chelimsky
On Dec 4, 2011, at 8:37 AM, Ants Pants wrote: > On 4 December 2011 14:55, David Chelimsky wrote: > > On Dec 4, 2011, at 7:48 AM, Ants Pants wrote: > >> Hello everyone, >> >> I am trying to do the following >> >> before(:each) do >> @valid_attributes = {:foo => 'bar'} >> @event_ty

[rspec-users] Understanding of extend/include

2011-12-04 Thread Gordon
hi, there I have been looking at https://www.relishapp.com/rspec/rspec-core/docs/helper-methods/define-helper-methods-in-a-module. This is the documentation for usage of extend and include. In the section, "Scenario: extend a module in only some example groups", I refer to the setup in RSpec.c

Re: [rspec-users] Understanding of extend/include

2011-12-04 Thread David Chelimsky
On Dec 4, 2011, at 6:15 PM, Gordon wrote: > hi, there > > I have been looking at > https://www.relishapp.com/rspec/rspec-core/docs/helper-methods/define-helper-methods-in-a-module. > > This is the documentation for usage of extend and include. > > In the section, "Scenario: extend a module in o