Permalink
Browse files

add helper method for explicit lazy load

  • Loading branch information...
y-yagi committed Jul 16, 2017
1 parent a18cf23 commit c98a641ff402d3ca5b754f4621a0764f33eab155
Showing with 18 additions and 13 deletions.
  1. +18 −13 railties/test/application/configuration_test.rb
@@ -1130,7 +1130,7 @@ def create
app "development"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal :raise, ActionController::Parameters.action_on_unpermitted_parameters
@@ -1141,7 +1141,7 @@ def create
test "config.action_controller.always_permitted_parameters are: controller, action by default" do
app "development"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal %w(controller action), ActionController::Parameters.always_permitted_parameters
end
@@ -1153,7 +1153,7 @@ def create
app "development"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal %w( controller action format ), ActionController::Parameters.always_permitted_parameters
end
@@ -1177,7 +1177,7 @@ def create
app "development"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal :raise, ActionController::Parameters.action_on_unpermitted_parameters
@@ -1188,23 +1188,23 @@ def create
test "config.action_controller.action_on_unpermitted_parameters is :log by default on development" do
app "development"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal :log, ActionController::Parameters.action_on_unpermitted_parameters
end
test "config.action_controller.action_on_unpermitted_parameters is :log by default on test" do
app "test"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal :log, ActionController::Parameters.action_on_unpermitted_parameters
end
test "config.action_controller.action_on_unpermitted_parameters is false by default on production" do
app "production"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal false, ActionController::Parameters.action_on_unpermitted_parameters
end
@@ -1223,7 +1223,7 @@ def create
app "development"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal true, ActionController::Parameters.permit_all_parameters
end
@@ -1234,7 +1234,7 @@ def create
app "development"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal [], ActionController::Parameters.always_permitted_parameters
end
@@ -1245,7 +1245,7 @@ def create
app "development"
ActionController::Base.object_id # force lazy load hooks to run
lazy_load { ActionController::Base }
assert_equal :raise, ActionController::Parameters.action_on_unpermitted_parameters
end
@@ -1596,7 +1596,7 @@ class Post < ActiveRecord::Base
RUBY
app "development"
Post.object_id # force lazy load hooks to run
lazy_load { Post }
assert_not ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer
end
@@ -1608,7 +1608,7 @@ class Post < ActiveRecord::Base
RUBY
app "development"
Post.object_id # force lazy load hooks to run
lazy_load { Post }
assert ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer
end
@@ -1626,7 +1626,7 @@ class Post < ActiveRecord::Base
RUBY
app "development"
Post.object_id # force lazy load hooks to run
lazy_load { Post }
assert ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer
end
@@ -1737,5 +1737,10 @@ def index
assert_equal 301, last_response.status
assert_equal "https://example.org/", last_response.location
end
private
def lazy_load
yield # Tasty clarifying sugar, homie! We only need to reference a constant to load it.
end
end
end

0 comments on commit c98a641

Please sign in to comment.