1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/spec/warnings_spy/partitioner.rb
Elliot Winkler 12cc7aaace Remove all Ruby-emitted warnings
Run RSpec tests with warnings enabled so we stay on top of this better
in the future.
2014-07-18 18:00:08 -06:00

29 lines
594 B
Ruby

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 do |group|
group.any? { |line| line.include?(search_text) }
end
end
protected
attr_reader :reader, :search_text
private
def_delegators :reader, :warning_groups
end
end