Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hooks for ApplicationMetalController #873

Merged
merged 3 commits into from
Aug 9, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/doorkeeper/application_metal_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ class ApplicationMetalController < ActionController::Metal
MODULES.each do |mod|
include mod
end

ActiveSupport.run_load_hooks(:doorkeeper_metal_controller, self)
end
end
10 changes: 10 additions & 0 deletions spec/controllers/application_metal_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'spec_helper_integration'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


describe Doorkeeper::ApplicationMetalController do
it 'lazy run hooks' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

i = 0
ActiveSupport.on_load(:doorkeeper_metal_controller) { i += 1 }

expect(i).to eq 1
end
end