Class: ComponentsTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb,
lib/six-updater-web/vendor/plugins/active_scaffold/test/render_component/components_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



73
74
75
76
77
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 73

def setup
  @controller = CallerController.new
  @request    = ActionController::TestRequest.new
  @response   = ActionController::TestResponse.new
end

#test_calling_from_controllerObject



79
80
81
82
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 79

def test_calling_from_controller
  get :calling_from_controller
  assert_equal "Lady of the House, speaking", @response.body
end

#test_calling_from_controller_with_different_status_codeObject



89
90
91
92
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 89

def test_calling_from_controller_with_different_status_code
  get :calling_from_controller_with_different_status_code
  assert_equal 500, @response.response_code
end

#test_calling_from_controller_with_paramsObject



84
85
86
87
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 84

def test_calling_from_controller_with_params
  get :calling_from_controller_with_params
  assert_equal "David of the House, speaking", @response.body
end

#test_calling_from_templateObject



94
95
96
97
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 94

def test_calling_from_template
  get :calling_from_template
  assert_equal "Ring, ring: Lady of the House, speaking", @response.body
end

#test_component_as_string_redirect_renders_redirected_actionObject



130
131
132
133
134
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 130

def test_component_as_string_redirect_renders_redirected_action
  get :calling_redirected_as_string

  assert_equal "Lady of the House, speaking", @response.body
end

#test_component_multiple_redirect_redirectsObject



125
126
127
128
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 125

def test_component_multiple_redirect_redirects
  test_component_redirect_redirects
  test_internal_calling
end

#test_component_redirect_redirectsObject



119
120
121
122
123
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 119

def test_component_redirect_redirects
  get :calling_redirected

  assert_redirected_to :controller=>"callee", :action => "being_called"
end

#test_etag_is_set_for_parent_template_when_calling_from_templateObject



99
100
101
102
103
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 99

def test_etag_is_set_for_parent_template_when_calling_from_template
  get :calling_from_template
  expected_etag = etag_for("Ring, ring: Lady of the House, speaking")
  assert_equal expected_etag, @response.headers['ETag']
end

#test_flashObject



110
111
112
113
114
115
116
117
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 110

def test_flash
  get :set_flash
  assert_equal 'My stoney baby', flash[:notice]
  get :use_flash
  assert_equal 'My stoney baby', @response.body
  get :use_flash
  assert_equal 'no flash', @response.body
end

#test_internal_callingObject



105
106
107
108
# File 'lib/six-updater-web/vendor/plugins/render_component/test/components_test.rb', line 105

def test_internal_calling
  get :internal_caller
  assert_equal "Are you there? Yes, ma'am", @response.body
end