mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Fix test naming error
This commit is contained in:
parent
2a58bf3849
commit
7a7cd6be08
2 changed files with 4 additions and 2 deletions
33
test/lib/shunter/shunter_base_test.rb
Normal file
33
test/lib/shunter/shunter_base_test.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
require "action_controller"
|
||||
require "pry"
|
||||
|
||||
class ShunterBaseTest < Minitest::Test
|
||||
ENV["shunter_enabled"] = 'true'
|
||||
|
||||
def test_throttling_works_on_inclusion
|
||||
ENV["shunter_default_adapter"] = "Shunter::Adapters::Memory"
|
||||
ENV["shunter_default_threshold"] = "100"
|
||||
adapter = ENV["shunter_default_adapter"].constantize.new
|
||||
adapter.clear!
|
||||
|
||||
TestKlass.new.throttle do
|
||||
TestKlass.new.test
|
||||
end
|
||||
end
|
||||
|
||||
class TestKlass < ::ActionController::Base
|
||||
THROTTLED_ACTIONS = %i[test].freeze
|
||||
include Shunter::Integration::Throttle
|
||||
|
||||
def test
|
||||
"test"
|
||||
end
|
||||
|
||||
def throttled_user
|
||||
@throttled_user ||= OpenStruct.new(id: 1)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue