aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaishi Kasuga <kasuga@livesense.co.jp>2016-11-24 14:17:13 +0900
committerTaishi Kasuga <kasuga@livesense.co.jp>2016-11-24 14:17:13 +0900
commitda1453e6bad5551dd85f9692b921e1ff770d0319 (patch)
treed7ac3ca765727200720eb5d6e93ccc6e0cb99d35
parent28f8914962108a9d3147ed01db1f37a493d79d8a (diff)
downloadrails-da1453e6bad5551dd85f9692b921e1ff770d0319.tar.gz
rails-da1453e6bad5551dd85f9692b921e1ff770d0319.tar.bz2
rails-da1453e6bad5551dd85f9692b921e1ff770d0319.zip
Remove aggressive unit test with mock. And add integration level test.
-rw-r--r--actionpack/test/controller/force_ssl_test.rb24
-rw-r--r--railties/test/application/configuration_test.rb19
-rw-r--r--railties/test/isolation/abstract_unit.rb1
3 files changed, 19 insertions, 25 deletions
diff --git a/actionpack/test/controller/force_ssl_test.rb b/actionpack/test/controller/force_ssl_test.rb
index af3eedabe2..2b3859aa57 100644
--- a/actionpack/test/controller/force_ssl_test.rb
+++ b/actionpack/test/controller/force_ssl_test.rb
@@ -92,22 +92,6 @@ class RedirectToSSL < ForceSSLController
end
end
-class RedirectToSSLIfSessionStoreDisabled < ForceSSLController
- def banana
- request.class_eval do
- alias_method :flash_origin, :flash
- undef_method :flash
- end
-
- force_ssl_redirect || render(plain: "monkey")
- ensure
- request.class_eval do
- alias_method :flash, :flash_origin
- undef_method :flash_origin
- end
- end
-end
-
class ForceSSLControllerLevelTest < ActionController::TestCase
def test_banana_redirects_to_https
get :banana
@@ -337,14 +321,6 @@ class RedirectToSSLTest < ActionController::TestCase
end
end
-class RedirectToSSLIfSessionStoreDisabledTest < ActionController::TestCase
- def test_banana_redirects_to_https_if_not_https_and_session_store_disabled
- get :banana
- assert_response 301
- assert_equal "https://test.host/redirect_to_ssl_if_session_store_disabled/banana", redirect_to_url
- end
-end
-
class ForceSSLControllerLevelTest < ActionController::TestCase
def test_no_redirect_websocket_ssl_request
request.env["rack.url_scheme"] = "wss"
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 7e3bd26212..c409f1ea79 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -1532,5 +1532,24 @@ module ApplicationTests
assert_equal :default, Rails.configuration.debug_exception_response_format
end
+
+ test "controller force_ssl declaration can be used even if session_store is disabled" do
+ make_basic_app do |application|
+ application.config.session_store :disabled
+ end
+
+ class ::OmgController < ActionController::Base
+ force_ssl
+
+ def index
+ render plain: "Yay! You're on Rails!"
+ end
+ end
+
+ get "/"
+
+ assert_equal 301, last_response.status
+ assert_equal "https://example.org/", last_response.location
+ end
end
end
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index aa0a06faf1..1902eac862 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -162,7 +162,6 @@ module TestHelpers
require "rails"
require "action_controller/railtie"
require "action_view/railtie"
- require "action_dispatch/middleware/flash"
@app = Class.new(Rails::Application)
@app.config.eager_load = false