Skip to content

.to_prepare to extend Noticed::Notification class doesn't work in test env #386

Closed Answered by excid3
phil-6 asked this question in Q&A
Discussion options

You must be logged in to vote

Strange. Maybe to_prepare runs earlier there because it's happening on application load. The reason we use to_prepare is classes can be reloaded in development so we want to make sure those extensions are always applied in case Noticed models get reloaded.

# config/initializers/noticed.rb
module EventExtension
  extend ActiveSupport::Concern

  included do
  end
end

module NotificationExtension
  extend ActiveSupport::Concern

  included do
  end
end

Rails.configuration.to_prepare do
  Noticed::Event.include EventExtension
  Noticed::Notification.include NotificationExtension
end

Replies: 2 comments 26 replies

Comment options

You must be logged in to vote
24 replies
@excid3
Comment options

@phil-6
Comment options

@phil-6
Comment options

@excid3
Comment options

Answer selected by phil-6
@phil-6
Comment options

@excid3
Comment options

@phil-6
Comment options

@phil-6
Comment options

Comment options

You must be logged in to vote
2 replies
@phil-6
Comment options

@stephaneliu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants