[deploy] Refactor: Run Display Ad Events Controller in all Envs (#11144)
This commit is contained in:
parent
0067a2124c
commit
f97c822570
2 changed files with 9 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ class DisplayAdEventsController < ApplicationMetalController
|
|||
private
|
||||
|
||||
def update_display_ads_data
|
||||
return if Rails.env.production? && rand(20) != 1 # We need to do this operation only once in a while.
|
||||
return if skip_ad_update?
|
||||
|
||||
@display_ad = DisplayAd.find(display_ad_event_params[:display_ad_id])
|
||||
|
||||
|
|
@ -33,4 +33,9 @@ class DisplayAdEventsController < ApplicationMetalController
|
|||
def display_ad_event_params
|
||||
params[:display_ad_event].slice(:context_type, :category, :display_ad_id)
|
||||
end
|
||||
|
||||
def skip_ad_update?
|
||||
# We need to do this operation only once in a while.
|
||||
rand(20) != 1
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ RSpec.describe "DisplayAdEvents", type: :request do
|
|||
context "when user signed in" do
|
||||
before do
|
||||
sign_in user
|
||||
# rubocop:disable RSpec/AnyInstance
|
||||
allow_any_instance_of(DisplayAdEventsController).to receive(:skip_ad_update?).and_return(false)
|
||||
# rubocop:enable RSpec/AnyInstance
|
||||
end
|
||||
|
||||
it "creates a display ad click event" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue