mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00

git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@139 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
39 lines
1.2 KiB
Ruby
39 lines
1.2 KiB
Ruby
require File.dirname(__FILE__) + '/../test_helper'
|
|
require 'users_controller'
|
|
|
|
# Re-raise errors caught by the controller.
|
|
class UsersController; def rescue_action(e) raise e end; end
|
|
|
|
class UsersControllerTest < Test::Unit::TestCase
|
|
load_all_fixtures
|
|
|
|
def setup
|
|
@controller = UsersController.new
|
|
@request = ActionController::TestRequest.new
|
|
@response = ActionController::TestResponse.new
|
|
@user = User.find(:first)
|
|
end
|
|
|
|
should_be_restful do |resource|
|
|
resource.identifier = :id
|
|
resource.klass = User
|
|
resource.object = :user
|
|
resource.parent = []
|
|
resource.actions = [:index, :show, :new, :edit, :update, :create, :destroy]
|
|
resource.formats = [:html, :xml]
|
|
|
|
# resource.denied.actions = [:show]
|
|
# resource.denied.redirect = 'users_url'
|
|
|
|
resource.create.params = { :name => "bob", :email => 'bob@bob.com', :age => 13}
|
|
resource.update.params = { :name => "sue" }
|
|
|
|
resource.create.redirect = "user_url(@user)"
|
|
resource.update.redirect = "user_url(@user)"
|
|
resource.destroy.redirect = "users_url"
|
|
|
|
resource.create.flash = /created/i
|
|
resource.update.flash = /updated/i
|
|
resource.destroy.flash = /removed/i
|
|
end
|
|
end
|