Skip to content

Commit

Permalink
Rename helper to force_lazy_load_hooks.
Browse files Browse the repository at this point in the history
Clarifies the intent that aren't just loading the
model but really caring about triggering the on_load
callbacks.
  • Loading branch information
kaspth committed Jul 17, 2017
1 parent cabad0e commit c24be36
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions railties/test/application/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ def create

app "development"

lazy_load { ActionController::Base }
force_lazy_load_hooks { ActionController::Base }

assert_equal :raise, ActionController::Parameters.action_on_unpermitted_parameters

Expand All @@ -1141,7 +1141,7 @@ def create
test "config.action_controller.always_permitted_parameters are: controller, action by default" do
app "development"

lazy_load { ActionController::Base }
force_lazy_load_hooks { ActionController::Base }

assert_equal %w(controller action), ActionController::Parameters.always_permitted_parameters
end
Expand All @@ -1153,7 +1153,7 @@ def create

app "development"

lazy_load { ActionController::Base }
force_lazy_load_hooks { ActionController::Base }

assert_equal %w( controller action format ), ActionController::Parameters.always_permitted_parameters
end
Expand All @@ -1177,7 +1177,7 @@ def create

app "development"

lazy_load { ActionController::Base }
force_lazy_load_hooks { ActionController::Base }

assert_equal :raise, ActionController::Parameters.action_on_unpermitted_parameters

Expand All @@ -1188,23 +1188,23 @@ def create
test "config.action_controller.action_on_unpermitted_parameters is :log by default on development" do
app "development"

lazy_load { ActionController::Base }
force_lazy_load_hooks { 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"

lazy_load { ActionController::Base }
force_lazy_load_hooks { 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"

lazy_load { ActionController::Base }
force_lazy_load_hooks { ActionController::Base }

assert_equal false, ActionController::Parameters.action_on_unpermitted_parameters
end
Expand All @@ -1223,7 +1223,7 @@ def create

app "development"

lazy_load { ActionController::Base }
force_lazy_load_hooks { ActionController::Base }
assert_equal true, ActionController::Parameters.permit_all_parameters
end

Expand All @@ -1234,7 +1234,7 @@ def create

app "development"

lazy_load { ActionController::Base }
force_lazy_load_hooks { ActionController::Base }
assert_equal [], ActionController::Parameters.always_permitted_parameters
end

Expand All @@ -1245,7 +1245,7 @@ def create

app "development"

lazy_load { ActionController::Base }
force_lazy_load_hooks { ActionController::Base }
assert_equal :raise, ActionController::Parameters.action_on_unpermitted_parameters
end

Expand Down Expand Up @@ -1596,7 +1596,7 @@ class Post < ActiveRecord::Base
RUBY

app "development"
lazy_load { Post }
force_lazy_load_hooks { Post }

assert_not ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer
end
Expand All @@ -1608,7 +1608,7 @@ class Post < ActiveRecord::Base
RUBY

app "development"
lazy_load { Post }
force_lazy_load_hooks { Post }

assert ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer
end
Expand All @@ -1626,7 +1626,7 @@ class Post < ActiveRecord::Base
RUBY

app "development"
lazy_load { Post }
force_lazy_load_hooks { Post }

assert ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer
end
Expand Down Expand Up @@ -1739,7 +1739,7 @@ def index
end

private
def lazy_load
def force_lazy_load_hooks
yield # Tasty clarifying sugar, homie! We only need to reference a constant to load it.
end
end
Expand Down

0 comments on commit c24be36

Please sign in to comment.