diff --git a/NEWS.md b/NEWS.md index 0b0260b71..619842abc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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. diff --git a/app/controllers/doorkeeper/application_metal_controller.rb b/app/controllers/doorkeeper/application_metal_controller.rb index 6b73d874f..9f84e79bb 100644 --- a/app/controllers/doorkeeper/application_metal_controller.rb +++ b/app/controllers/doorkeeper/application_metal_controller.rb @@ -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 diff --git a/spec/controllers/application_metal_controller.rb b/spec/controllers/application_metal_controller.rb new file mode 100644 index 000000000..7403f5a86 --- /dev/null +++ b/spec/controllers/application_metal_controller.rb @@ -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