Sha256: 1b9fc674b88e7ce9744e526a754e23a4e635d4ae572087c7514b9114a54001cf
Contents?: true
Size: 915 Bytes
Versions: 14
Compression:
Stored size: 915 Bytes
Contents
# RSpec matcher to spec delegations. RSpec::Matchers.define :have_unique_field do |expected_field_name| match do |subject| subject.should respond_to(expected_field_name) field_value = subject.send(expected_field_name) field_value.nil? || !field_value.kind_of?(Array) end description do "expected to have a single-valued field named #{expected_field_name}" end failure_message_for_should do |subject| "#{subject.inspect} should respond to #{expected_field_name} as a single-value, not an Array. Responded with #{subject.send(expected_field_name).inspect}" end end RSpec::Matchers.define :have_multivalue_field do |expected_field_name| match do |subject| subject.should respond_to(expected_field_name) subject.send(expected_field_name).should be_instance_of Array end description do "expected to have a multi-valued field named #{expected_field_name}" end end
Version data entries
14 entries across 14 versions & 2 rubygems