Sha256: 38eef8af4fb34240261ca256a5b508f33f1aecc3747715b0b587e4b51e9d57dc
Contents?: true
Size: 705 Bytes
Versions: 2
Compression:
Stored size: 705 Bytes
Contents
module CustomMatchers class OnlyHaveAttributesMatcher def initialize(*attrs) @attributes = attrs.map(&:to_s) end def matches?(target) @target_attributes = target.keys.map(&:to_s) @target_attributes == @attributes end def failure_message_for_should "expected to only allow attributes #{@attributes.join(", ")}, allowed #{@target_attributes.join(", ")}" end def failure_message_for_should_not "expected to not only allow attributes #{@attributes.join(", ")}, allowed #{@target_attributes.join(", ")}" end end def only_have_attributes(*attrs) OnlyHaveAttributesMatcher.new(*attrs) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scoped_attr_accessible-0.1.2 | spec/support/custom_matchers.rb |
scoped_attr_accessible-0.1.0 | spec/support/custom_matchers.rb |