Class: NewActionBaseTest

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_newObject



88
89
90
91
92
93
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 88

def test_controller_should_render_new
  User.stubs(:new).returns(mock_user)
  get :new
  assert_response :success
  assert_equal 'New HTML', @response.body.strip
end

#test_expose_a_new_userObject



82
83
84
85
86
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 82

def test_expose_a_new_user
  User.expects(:new).returns(mock_user)
  get :new
  assert_equal mock_user, assigns(:user)
end

#test_render_exposed_a_new_user_as_xml_when_mime_type_is_xmlObject



95
96
97
98
99
100
101
102
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 95

def test_render_exposed_a_new_user_as_xml_when_mime_type_is_xml
  @request.accept = 'application/xml'
  User.expects(:new).returns(mock_user)
  mock_user.expects(:to_xml).returns("Generated XML")
  get :new
  assert_response :success
  assert_equal 'Generated XML', @response.body
end