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 all 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: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
User-visible changes worth mentioning.

## master

- [#873] Add hooks to Doorkeeper::ApplicationMetalController
- [#871] Allow downstream users to better utilize doorkeeper spec factories by
eliminating name conflict on `:user` factory.

Expand Down
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"

describe Doorkeeper::ApplicationMetalController do
it "lazy run hooks" do
i = 0
ActiveSupport.on_load(:doorkeeper_metal_controller) { i += 1 }

expect(i).to eq 1
end
end