| Class | ThoughtBot::Shoulda::Controller::ClassMethods::ResourceOptions::DeniedOptions |
| In: |
lib/shoulda/controller_tests/controller_tests.rb
|
| Parent: | Object |
Configuration options for the denied actions under should_be_restful
Example:
context "The public" do
setup do
@request.session[:logged_in] = false
end
should_be_restful do |resource|
resource.parent = :user
resource.denied.actions = [:index, :show, :edit, :new, :create, :update, :destroy]
resource.denied.flash = /get outta here/i
resource.denied.redirect = 'new_session_url'
end
end
| actions | [RW] | Actions that should be denied (only used by resource.denied). Note that these actions will only be tested if they are also listed in +resource.actions+ The special value of :all will deny all of the REST actions. |
| flash | [RW] |
String or Regexp describing a value expected in the flash. Will match
against any flash key.
Example: resource.create.flash = /created/ |
| redirect | [RW] |
String evaled to get the target of the redirection. All of the instance
variables set by the controller will be available to the evaled code.
Example: resource.create.redirect = "user_url(@user.company, @user)" |