I''m testing using the rspec mocking framework and rspec 1.0.5 and I''m getting the following strange error: #<Spec::Mocks::Mock:0x337f7c8> expected :set_defaults with (#<Service: 0x19c4040 @name="Service_1023">, {"1"=>"1", "2"=>"2"}) but received it with (#<Service:0x19c4040 @name="Service_1023">, {"1"=>"1", "2"=>"2"}) Oddly, it looks like what its expecting and what its receiving are the same. Why would this fail? David -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070625/b284e084/attachment.html
On 6/25/07, David Smalley <david.smalley.lists at googlemail.com> wrote:> I''m testing using the rspec mocking framework and rspec 1.0.5 and I''m > getting the following strange error: > > > #<Spec::Mocks::Mock:0x337f7c8> expected :set_defaults with > (#<Service:0x19c4040 @name="Service_1023">, {"1"=>"1", "2"=>"2"}) but > received it with (#<Service:0x19c4040 @name="Service_1023">, {"1"=>"1", > "2"=>"2"}) > > Oddly, it looks like what its expecting and what its receiving are the same. > Why would this fail? >I don''t know. We need more context information. Can you post some code so we can reproduce this? Aslak> David > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
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
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 >
On 25 Jun 2007, at 16:06, aslak hellesoy wrote:> 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. > > AslakHi Aslak, Sorry, I didn''t want to take up lots of your time and was erring on the side of not filling my email full of code. I''d prefer not to send the full code to list, but I can send the model and the spec for it off list if that would be acceptable? Cheers, David -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070625/6386f065/attachment.html
On 6/25/07, David Smalley <david.smalley.lists at googlemail.com> wrote:> > > On 25 Jun 2007, at 16:06, aslak hellesoy wrote: > > > 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 > Hi Aslak, > > Sorry, I didn''t want to take up lots of your time and was erring on the side > of not filling my email full of code. > > I''d prefer not to send the full code to list, but I can send the model and > the spec for it off list if that would be acceptable? >If you think this is a bug, please follow the guidelines here: http://rspec.rubyforge.org/community/contribute.html (at the bottom) The best is if you can narrow down and isolate the problem into some files (or patches) that we can just run. Cheers Aslak> Cheers, > > David > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Apparently Analagous Threads
- Plotting rpart trees with long list of class members
- sieve filtering utf 8 strings
- [Bug 1184] New: disable implicit concatenating of elements of sets with flag interval
- Reverse engineering pagination and more
- A modern object-oriented machine learning framework in R