Sha256: 7037aca92538f3b4909214f8338b507a725e0bbb1627c8ece18981a473e06aa0

Contents?: true

Size: 673 Bytes

Versions: 5

Compression:

Stored size: 673 Bytes

Contents

require 'tester/definition/fields/field'

class ObjectField < Field
    attr_accessor :fields

    def initialize name
        super(name)
        self.fields = []
    end

    def with_field(newField)
        self.fields << newField
        self
    end

    def has_subfields?
        true
    end

    def default_value
        obj = Hash.new

        self.fields.each do |field|
            obj[field.name] = field.default_value
        end

        obj
    end

    def negative_boundary_values
        super +
          [
            "string",
            [],
            123,
            1,
            0,
            true,
            false
          ]
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
api-tester-0.1.0 lib/tester/definition/fields/object_field.rb
api-tester-0.0.5 lib/tester/definition/fields/object_field.rb
api-tester-0.0.4 lib/tester/definition/fields/object_field.rb
api-tester-0.0.3 lib/tester/definition/fields/object_field.rb
api-tester-0.0.1 lib/tester/definition/fields/object_field.rb