[rspec-users] strange mock error

David Smalley david.smalley.lists at googlemail.com
Mon Jun 25 06:51:35 EDT 2007


On 25 Jun 2007, at 11:08, aslak hellesoy wrote:

> Can you post some code
> so we can reproduce this?

Sure thing.

The TestSet model is:
   create_table "test_sets", :force => true do |t|
     t.column "created_at",    :datetime
     t.column "updated_at",    :datetime
     t.column "name",          :string
     t.column "user_id",       :integer
     t.column "account_id",    :integer
     t.column "service_id",    :integer
     t.column "testable_type", :string
     t.column "testable_id",   :integer
   end


My spec:

describe TestSet, "saving defaults" do

   before(:each) do
     @test_set = TestSet.new
     @test_set.service = mock_model(Service, :slug_name => 'page')
     @test_set.user = mock_model(User, :id => 1)
     @test_set.checked_client_ids = {"1" => "1", "2" => "2"}
   end

  ......

      it "should save defaults from checked_client_ids if save  
defaults is true and use defaults is false" do
     @test_set.use_defaults = false
     @test_set.save_defaults = true
     @test_set.user.should_receive(:set_defaults).with 
(@test_set.service, @test_set.checked_client_ids)
     @test_set.set_defaults
     @test_set.checked_client_ids.should == {"1" => "1", "2" => "2"}
   end

Hope thats enough to go on, thanks

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070625/f9824ed4/attachment.html 


More information about the rspec-users mailing list