Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
uoy-faculty-spec-helpers / lib / attribute_matchers.rb
Size: Mime:
# frozen_string_literal: true

# Attribute Matchers from sinatra-base
module AttributeMatchers
  def _has_attribute_with_value?(name, matcher)
    matcher === self[name] # rubocop:disable Style/CaseEquality
  end

  def _has_attribute?(name)
    !self[name].nil?
  end

  # NB: has_attributes? is built in *somewhere*
  def has_attribute?(*attributes, **attribute_values) # rubocop:disable Naming/PredicatePrefix
    attributes.all? { |name| _has_attribute? name } &&
      attribute_values.all? { |name, value| _has_attribute_with_value? name, value }
  end
end