Sha256: 23bdd73c7c4332e5c35d0f72c4e0f1347683662e11bec18f78b00a5906b321b4

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      module Rails
        # @!parse
        #   # Prefer to travel in `before` rather than `around`.
        #   #
        #   # @safety
        #   #   This cop is unsafe because the automatic `travel_back` is only
        #   #   run on test cases that are considered as Rails related.
        #   #
        #   #   And also, this cop's autocorrection is unsafe because the order
        #   #   of execution will change if other steps exist before traveling
        #   #   in `around`.
        #   #
        #   # @example
        #   #   # bad
        #   #   around do |example|
        #   #     freeze_time do
        #   #       example.run
        #   #     end
        #   #   end
        #   #
        #   #   # good
        #   #   before { freeze_time }
        #   #
        #   class TravelAround < RuboCop::Cop::RSpecRails::Base; end
        TravelAround = ::RuboCop::Cop::RSpecRails::TravelAround
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-rspec-2.28.0 lib/rubocop/cop/rspec/rails/travel_around.rb