class PactBroker::Matrix::RowIgnorer

Public Class Methods

ignore_row?(resolved_ignore_selectors, row) click to toggle source
# File lib/pact_broker/matrix/row_ignorer.rb, line 27
def ignore_row?(resolved_ignore_selectors, row)
  resolved_ignore_selectors.any? do | s |
    s.pacticipant_id == row.consumer_id  && (s.only_pacticipant_name_specified? || s.pacticipant_version_id == row.consumer_version_id) ||
      s.pacticipant_id == row.provider_id  && (s.only_pacticipant_name_specified? || s.pacticipant_version_id == row.provider_version_id)
  end
end
split_rows_into_considered_and_ignored(rows, resolved_ignore_selectors) click to toggle source

Splits the matrix rows into considered rows and ignored rows, based on the ignore selectors specified by the user in the can-i-deploy command (eg. –ignore SomeProviderThatIsNotReadyYet). @param [Array<MatrixRow, EveryRow>] rows @param [<PactBroker::Matrix::ResolvedSelector>] resolved_ignore_selectors @return [Array<MatrixRow, EveryRow>] considered_rows, [Array<MatrixRow, EveryRow>] ignored_rows

# File lib/pact_broker/matrix/row_ignorer.rb, line 11
def split_rows_into_considered_and_ignored(rows, resolved_ignore_selectors)
  if resolved_ignore_selectors.any?
    considered, ignored = [], []
    rows.each do | row |
      if ignore_row?(resolved_ignore_selectors, row)
        ignored << row
      else
        considered << row
      end
    end
    return considered, ignored
  else
    return rows, []
  end
end