1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/test/functional/users_controller_test.rb

37 lines
1.2 KiB
Ruby
Raw Normal View History

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.create.params = { :name => "bob", :email => 'bob@bob.com', :age => 13, :ssn => "123456789"}
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