Skip to content

Instantly share code, notes, and snippets.

@jstewart
Created August 21, 2009 21:33
Show Gist options
  • Save jstewart/172449 to your computer and use it in GitHub Desktop.
Save jstewart/172449 to your computer and use it in GitHub Desktop.
class CommentsController < CorporateBaseController
resource_controller
belongs_to :product_list
actions :only => [:create, :update, :destroy]
create.before do
raise @comment.inspect
end
create.wants.html
create.wants.js
create.failure.wants.js { render :action => "comments/display_errors.js" }
update.failure.wants.js { render :action => "comments/display_errors.js" }
grants_access_to :denies_with => :improper_role do
parent_object.owner == current_user
end
end
1) Failure:
test: when signed in as the owner of the list a XHR POST to :create unsuccessfully should render template :display_errors. (CommentsControllerTest)
[/Library/Ruby/Gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/action_controller/macros.rb:164:in `__bind_1250890362_131045'
/Library/Ruby/Gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:351:in `call'
/Library/Ruby/Gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:351:in `test: when signed in as the owner of the list a XHR POST to :create unsuccessfully should render template :display_errors. ']:
expecting <"display_errors"> but rendering with <"comments/create.js.rjs">
6 tests, 7 assertions, 1 failures, 0 errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment