Class: ShowActionBaseTest

Inherits:
ActionController::TestCase
  • Object
show all
Includes:
UserTestHelper
Defined in:
lib/vendor/plugins/inherited_resources/test/base_test.rb

Instance Method Summary collapse

Methods included from UserTestHelper

#setup

Instance Method Details

#test_controller_should_render_showObject



62
63
64
65
66
67
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 62

def test_controller_should_render_show
  User.stubs(:find).returns(mock_user)
  get :show
  assert_response :success
  assert_equal 'Show HTML', @response.body.strip
end

#test_expose_the_resquested_userObject



56
57
58
59
60
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 56

def test_expose_the_resquested_user
  User.expects(:find).with('42').returns(mock_user)
  get :show, :id => '42'
  assert_equal mock_user, assigns(:user)
end

#test_render_exposed_user_as_xml_when_mime_type_is_xmlObject



69
70
71
72
73
74
75
76
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 69

def test_render_exposed_user_as_xml_when_mime_type_is_xml
  @request.accept = 'application/xml'
  User.expects(:find).with('42').returns(mock_user)
  mock_user.expects(:to_xml).returns("Generated XML")
  get :show, :id => '42'
  assert_response :success
  assert_equal 'Generated XML', @response.body
end