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

43 lines
1 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
fixtures :all
def setup
@controller = UsersController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@user = User.find(:first)
end
context "on GET to #index" do
setup { get :index }
should_respond_with :success
should_render_with_layout 'users'
should_render_template :index
should_assign_to :users
end
context "on GET to #index.xml" do
setup { get :index, :format => 'xml' }
should_respond_with :success
should_respond_with_xml_for
should_assign_to :users
end
context "on GET to #show" do
setup { get :show, :id => @user }
should_respond_with :success
should_render_with_layout 'users'
should_render_template :show
should_assign_to :user
end
end