$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "rubygems" require "sidekiq/testing" require "active_support/core_ext/numeric/time" require "timecop" require "simplecov" require "coveralls" pid = Process.pid SimpleCov.at_exit do SimpleCov.result.format! if Process.pid == pid end SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ] SimpleCov.start require "sidekiq/merger" Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f } RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest # assertions if you prefer. config.expect_with :rspec do |expectations| # This option will default to `true` in RSpec 4. It makes the `description` # and `failure_message` of custom matchers include text for helper methods # defined using `chain`, e.g.: # be_bigger_than(2).and_smaller_than(4).description # # => "be bigger than 2 and smaller than 4" # ...rather than: # # => "be bigger than 2" expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| # Prevents you from mocking or stubbing a method that does not exist on # a real object. This is generally recommended, and will default to # `true` in RSpec 4. mocks.verify_partial_doubles = true end if config.files_to_run.one? # Use the documentation formatter for detailed output, # unless a formatter has already been configured # (e.g. via a command-line flag). config.default_formatter = "doc" end config.order = :random Kernel.srand config.seed config.before :suite do Sidekiq::Testing.fake! Sidekiq::Merger.logger = nil Sidekiq.logger = nil end config.before :example do Sidekiq::Merger::Redis.redis do |conn| conn.flushall end end config.after :example do Timecop.return end end