spec/spec_helper.rb in sidekiq-bus-0.8.1 vs spec/spec_helper.rb in sidekiq-bus-0.8.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'timecop'
require 'queue-bus'
require 'adapter/support'
require 'pry'
@@ -26,12 +28,12 @@
class Runner
def self.value
@value ||= 0
end
- def self.attributes
- @attributes
+ class << self
+ attr_reader :attributes
end
def self.run(attrs)
@value ||= 0
@value += 1
@@ -49,13 +51,13 @@
class Runner2 < Runner
end
end
-def test_sub(event_name, queue="default")
- matcher = {"bus_event_type" => event_name}
- QueueBus::Subscription.new(queue, event_name, "::QueueBus::Rider", matcher, nil)
+def test_sub(event_name, queue = 'default')
+ matcher = { 'bus_event_type' => event_name }
+ QueueBus::Subscription.new(queue, event_name, '::QueueBus::Rider', matcher, nil)
end
def test_list(*args)
out = QueueBus::SubscriptionList.new
args.each do |sub|
@@ -63,11 +65,10 @@
end
out
end
RSpec.configure do |config|
-
config.run_all_when_everything_filtered = true
config.filter_run focus: true
config.alias_example_to :fit, focus: true
config.mock_with :rspec do |c|
@@ -81,11 +82,11 @@
reset_test_adapter
Sidekiq::Testing.disable!
end
config.after(:each) do
begin
- QueueBus.redis { |redis| redis.flushall }
- rescue
+ QueueBus.redis(&:flushall)
+ rescue StandardError
end
QueueBus.send(:reset)
QueueBus::Runner1.reset
QueueBus::Runner2.reset
end