module RoarMatchers

Public Class Methods

extract_options!(args) click to toggle source
# File lib/roar_matchers/support.rb, line 21
def self.extract_options!(args)
  args.last.is_a?(::Hash) ? args.pop : {}
end
get_actual_collection_names(representer) click to toggle source
# File lib/roar_matchers/support.rb, line 25
def self.get_actual_collection_names(representer)
  representer.instance_variable_get("@representable_attrs").select do |key, attrs|
    attrs.options[:collection] && attrs.name != "links_array"
  end.keys
end
get_actual_property_names(representer) click to toggle source
# File lib/roar_matchers/support.rb, line 10
def self.get_actual_property_names(representer)
  representer.instance_variable_get("@representable_attrs").reject do |key, attrs|
    attrs.options[:collection]
  end.keys
end
missing(actual,expected) click to toggle source
# File lib/roar_matchers/support.rb, line 2
def self.missing(actual,expected)
  if (mp = (expected - actual)).any?
    ["Representer", mp]
  else
    ["Spec", actual - expected]
  end
end