Sha256: c4c2149226cf02634b88cf4a71cf722e6f83b5b826e7a90c423954b14095c4c0

Contents?: true

Size: 927 Bytes

Versions: 15

Compression:

Stored size: 927 Bytes

Contents

require "guard/rspec/inspectors/base_inspector.rb"

module Guard
  class RSpec < Plugin
    module Inspectors
      # Inspector that focuses on set of paths if any of them is failing.
      # Returns only that set of paths on all future calls to #paths
      # until they all pass
      class FocusedInspector < BaseInspector
        attr_accessor :focused_locations

        def initialize(options = {})
          super
          @focused_locations = []
        end

        def paths(paths)
          if focused_locations.any?
            focused_locations
          else
            _clean(paths)
          end
        end

        def failed(locations)
          if locations.empty?
            @focused_locations = []
          elsif focused_locations.empty?
            @focused_locations = locations
          end
        end

        def reload
          @focused_locations = []
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 6 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec/inspectors/focused_inspector.rb
guard-rspec-4.7.3 lib/guard/rspec/inspectors/focused_inspector.rb
guard-rspec-4.7.2 lib/guard/rspec/inspectors/focused_inspector.rb
guard-rspec-4.7.1 lib/guard/rspec/inspectors/focused_inspector.rb
guard-rspec-4.7.0 lib/guard/rspec/inspectors/focused_inspector.rb
guard-rspec-4.6.5 lib/guard/rspec/inspectors/focused_inspector.rb