Re: [rspec-users] continuing on my quest to learn rspec...

2010-03-24 Thread Patrick J. Collins
Firstly I wonder why you're putting this behaviour on the photo class. Have you ever heard of the code smell 'feature envy'? Photo#set_cover seems to me to be talking mostly to the photo_album, so perhaps this behaviour should move there? Ok.. So I changed that code and put it in my

[rspec-users] How to stub a has_many relationship in Rails 2.3.5

2010-03-24 Thread Ben Fyvie
We have a test that has been working find until we upgraded to rails 2.3.5. I'm not too familiar with mocks/stubs so maybe there is an easy solution. Here is a simple example of our scenario. Class Person ActiveRecord::Base has_many :aliases, :dependent = :nullify before_destroy

[rspec-users] Mock Consent_6335 received unexpected message :marked_for_destruction? with (no args)

2010-03-24 Thread thoen
I have a mock object (Person) that is associated with another object (my_object) through a belongs_to association. When I check whether my_object is valid (my_object.should be_valid), I am getting an error like the following: Mock Person_6338 received unexpected message :marked_for_destruction?

Re: [rspec-users] Mock Consent_6335 received unexpected message :marked_for_destruction? with (no args)

2010-03-24 Thread thoen
Instead of def @target.marked_for_destruction? false end i added marked_for_destruction in the list of stubs included in mock_model options_and_stubs = options_and_stubs.reverse_merge({ :id = id, :to_param = id.to_s, :new_record? = false,

[rspec-users] Specing Ruby Game Development ???

2010-03-24 Thread Peter Fitzgibbons
HI Folks, Roll Call for anyone using Rspec for Ruby Game Development (Rubygame, GOSU, TkRuby, etc.) ??? I'm having trouble finding the latest-and-greatest with Google searches. Happy Gaming! -- Peter Fitzgibbons (847) 859-9550 peter.fitzgibb...@gmail.com IM GTalk: peter.fitzgibbons IM AOL:

Re: [rspec-users] Specing Ruby Game Development ???

2010-03-24 Thread Pat Maddox
Not I, but let me know if you come across anything please. Sounds interesting. On Mar 24, 2010, at 12:36 PM, Peter Fitzgibbons wrote: HI Folks, Roll Call for anyone using Rspec for Ruby Game Development (Rubygame, GOSU, TkRuby, etc.) ??? I'm having trouble finding the

[rspec-users] Problems testing destroy method in rspec2

2010-03-24 Thread Mauricio Aniche
Hi, I am trying to test the destroy method in my rails 3 controller, but I always get an no route matches {} error. But the route do exist, as I can see by running rake routes. I have something like this: delete :destroy, :id = 1 The stack trace: Failure/Error: delete :destroy, :id = 1

Re: [rspec-users] Mock Global method

2010-03-24 Thread J. B. Rainsberger
garren wrote: I'm very new to ruby and mocking a dynamic language. I would like to mock a helper method in Sinatra. So an example is this: helper do def my_helper_method puts Should do something useful here... end end How would I mock that method and how would I mock

Re: [rspec-users] Problems testing destroy method in rspec2

2010-03-24 Thread Julian Leviston
Only thing that springs to mind is that perhaps you haven't specified the :method = :delete option on the link? Julian. On 25/03/2010, at 2:39 PM, Mauricio Aniche wrote: Hi, I am trying to test the destroy method in my rails 3 controller, but I always get an no route matches {} error.