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
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
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?
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,
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:
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
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
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
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.