Class: ComponentsTest
- 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
- #setup ⇒ Object
- #test_calling_from_controller ⇒ Object
- #test_calling_from_controller_with_different_status_code ⇒ Object
- #test_calling_from_controller_with_params ⇒ Object
- #test_calling_from_template ⇒ Object
- #test_component_as_string_redirect_renders_redirected_action ⇒ Object
- #test_component_multiple_redirect_redirects ⇒ Object
- #test_component_redirect_redirects ⇒ Object
- #test_etag_is_set_for_parent_template_when_calling_from_template ⇒ Object
- #test_flash ⇒ Object
- #test_internal_calling ⇒ Object
Instance Method Details
#setup ⇒ Object
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_controller ⇒ Object
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_code ⇒ Object
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_params ⇒ Object
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_template ⇒ Object
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_action ⇒ Object
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_redirects ⇒ Object
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_redirects ⇒ Object
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_template ⇒ Object
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_flash ⇒ Object
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_calling ⇒ Object
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 |