[rspec-users] strange mock error

aslak hellesoy aslak.hellesoy at gmail.com
Mon Jun 25 11:06:49 EDT 2007


On 6/25/07, David Smalley <david.smalley.lists at googlemail.com> wrote:
>
>
> 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
>

I will have to set up a new project and fill in a lot of blanks to get
this working. Unless you provide something more complete it will be
rather time consuming to reproduce this.

Aslak

> David
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list