docbrown/spec/support/shared_context.rb
Michael Kohl 667437ebf2
[15-minute fix] Add ThrottledCall to DisplayAdEventsController (#12924)
* Add ThrottledCall to DisplayAdEventsController

* Update old spec
2021-03-09 09:06:11 +07:00

30 lines
904 B
Ruby

RSpec.shared_context "when proper status" do
before do
Rails.application.env_config["action_dispatch.show_detailed_exceptions"] = false
Rails.application.env_config["action_dispatch.show_exceptions"] = true
end
after do
Rails.application.env_config["action_dispatch.show_detailed_exceptions"] = true
Rails.application.env_config["action_dispatch.show_exceptions"] = false
end
end
RSpec.configure do |rspec|
rspec.include_context "when proper status", proper_status: true
end
RSpec.shared_context "with ThrottledCall" do
let(:redis_cache) { ActiveSupport::Cache.lookup_store(:redis_cache_store) }
before do
allow(Rails).to receive(:cache).and_return(redis_cache)
allow(ThrottledCall).to receive(:perform).and_call_original
end
after { Rails.cache.clear }
end
RSpec.configure do |rspec|
rspec.include_context "with ThrottledCall", throttled_call: true
end