Mark Wilden wrote: > On Sun, Feb 8, 2009 at 6:54 PM, Sergio Bayona <li...@ruby-forum.com> > wrote: > >> > On Mon, Feb 9, 2009 at 2:35 AM, Sergio Bayona <li...@ruby-forum.com> >> > wrote: >> >> >> >> assigns[:property].should equal(mock_property) >> >> 1 example, 0 failures >> >> >> >> >> >> why zero failures? more specifically, why would :non_existing_method >> >> return mock_property? >> > > Dogpile! > > ///ark
Evidently I'm still not fully getting it... why would this not pass? I mean I know why it doesn't pass. One instance is a mock object and the other is an AR object. But, shouldn't it return the mock property? There's just something elemental about Rspec I still don't get. describe "responding to GET new" do it "should expose a new property as @property" do @account = mock_model(Account) @account.should_receive(:properties) @property = mock_model(Property, :new_record? => false, :errors => []) @account.properties.should_receive(:build).and_return(@property) get :new assigns[:property].should == @property end end def new @property = @account.properties.build respond_to do |format| format.html # new.html.erb format.xml { render :xml => @property } end end 'PropertiesController responding to GET new should expose a new property as @property' FAILED expected: #<Property:0x1191b84 @name="Property_1002">, got: #<Property id: nil, name: nil, address: nil, city: nil, state: nil, zip: nil, uasap: nil, tax_number: nil, rent_due: nil, units_count: 0, issues_count: 0, account_id: 1, created_at: nil, updated_at: nil> (using ==) -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users