Displaying 1 result from an estimated 1 matches for "destroy_id".
Did you mean:
destroy_fd
2009 Feb 20
6
How to mock an object defined in the before_filter function?
...uses it.
my_var.stub!(:function).and_return(@var) doesn''t seem to be working.
Is there is something like
my_var.stub!(:function).add_variable(@var).and_return(:true)
?
Thank you,
Evgeny
=============controller_file
before_filter :find_comment, :only => [:destroy]
def destroy
@destroy_id = @comment.id #to be used in rendering partial
@comment.destroy
respond_to do |format|
format.js
end
end
def find_comment
@comment = Comment.find(:first, :conditions => [''id= ?'',params
[:comment_id]])
end
===============spec_file
spec code
describ...