Class: GovukContentSchemaTestHelpers::ValidationErrorMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk-content-schema-test-helpers/rspec_matchers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_name, type, payload) ⇒ ValidationErrorMessage

Returns a new instance of ValidationErrorMessage.



45
46
47
48
49
# File 'lib/govuk-content-schema-test-helpers/rspec_matchers.rb', line 45

def initialize(schema_name, type, payload)
  @schema_name = schema_name
  @type = type
  @payload = payload
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



43
44
45
# File 'lib/govuk-content-schema-test-helpers/rspec_matchers.rb', line 43

def payload
  @payload
end

#schema_nameObject (readonly)

Returns the value of attribute schema_name.



43
44
45
# File 'lib/govuk-content-schema-test-helpers/rspec_matchers.rb', line 43

def schema_name
  @schema_name
end

#typeObject (readonly)

Returns the value of attribute type.



43
44
45
# File 'lib/govuk-content-schema-test-helpers/rspec_matchers.rb', line 43

def type
  @type
end

Instance Method Details

#messageObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/govuk-content-schema-test-helpers/rspec_matchers.rb', line 51

def message
<<-doc
expected the payload to be valid against the '#{schema_name}' schema:

#{formatted_payload}

Validation errors:
#{errors}
doc
end