module Adapter::ActiveModel::CommonHelpers
Public Instance Methods
modifier_for(key)
click to toggle source
# File lib/rspec/api_helpers/adapter/active_model/common_helpers.rb, line 66 def modifier_for(key) if modifiers_hash[key] return modifiers_hash[key] else return proc{|i| i} end end
object_hash(hash, existing: true)
click to toggle source
# File lib/rspec/api_helpers/adapter/active_model/common_helpers.rb, line 22 def object_hash(hash, existing: true) ObjectHash.new(hash, existing: existing) end
objectize_collection(collection, root: nil, existing: true)
click to toggle source
# File lib/rspec/api_helpers/adapter/active_model/common_helpers.rb, line 2 def objectize_collection(collection, root: nil, existing: true) if root collection = collection[root] end return collection.map{|resource| object_hash(resource, existing: existing) } end
objectize_resource(resource, root: nil, existing: true)
click to toggle source
# File lib/rspec/api_helpers/adapter/active_model/common_helpers.rb, line 12 def objectize_resource(resource, root: nil, existing: true) if root obj = object_hash(resource[root], existing: existing) else obj = object_hash(resource, existing: existing) end return obj end
parse_model(model)
click to toggle source
# File lib/rspec/api_helpers/adapter/active_model/common_helpers.rb, line 60 def parse_model(model) return model unless model.is_a? Hash return object_hash(model) end
superset_mismatch_error(superset, subset)
click to toggle source
# File lib/rspec/api_helpers/adapter/active_model/common_helpers.rb, line 56 def superset_mismatch_error(superset, subset) "Expected \n #{subset.to_a.to_s} \n to be included in \n #{superset.to_a.to_s}" end