Sha256: 8774a089e41f10a2d910ca7a524cbe0108c7d0fd3bda5d6b95f43cdf0444bd78

Contents?: true

Size: 738 Bytes

Versions: 13

Compression:

Stored size: 738 Bytes

Contents

require 'forwardable'

class WarningsSpy
  class Partitioner
    extend Forwardable

    attr_reader :relevant_warning_groups, :irrelevant_warning_groups

    def initialize(reader, filesystem)
      @reader = reader
      @search_text = filesystem.project_dir
    end

    def partition
      @relevant_warning_groups, @irrelevant_warning_groups =
        warning_groups.partition { |group| relevant_warnings?(group) }
    end

    protected

    attr_reader :reader, :search_text

    private

    def_delegators :reader, :warning_groups

    def relevant_warnings?(group)
      first_line = group[0]
      first_line.start_with?("#{project_root}/lib")
    end

    def project_root
      File.expand_path('../../..')
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
shoulda-matchers-3.1.3 spec/warnings_spy/partitioner.rb
shoulda-matchers-4.0.0.rc1 spec/warnings_spy/partitioner.rb
shoulda-3.6.0 test/warnings_spy/partitioner.rb
shoulda-matchers-3.1.2 spec/warnings_spy/partitioner.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/spec/warnings_spy/partitioner.rb
shoulda-matchers-3.1.1 spec/warnings_spy/partitioner.rb
shoulda-matchers-3.1.0 spec/warnings_spy/partitioner.rb
shoulda-matchers-3.0.1 spec/warnings_spy/partitioner.rb
shoulda-matchers-3.0.0 spec/warnings_spy/partitioner.rb
shoulda-matchers-3.0.0.rc1 spec/warnings_spy/partitioner.rb
shoulda-matchers-2.8.0 spec/warnings_spy/partitioner.rb
shoulda-matchers-2.8.0.rc2 spec/warnings_spy/partitioner.rb
shoulda-matchers-2.8.0.rc1 spec/warnings_spy/partitioner.rb