Sha256: 141e1f680aad63953ea1f43afa4164b54fd9ef315b8ed7681a2755bbf3a20fa3

Contents?: true

Size: 497 Bytes

Versions: 5

Compression:

Stored size: 497 Bytes

Contents

require 'tester/definition/fields/field'

class EnumField < Field
  attr_accessor :acceptable_values

  def initialize name, acceptable_values, default_value=nil
    if default_value
      super name, default_value
    else
      super name, acceptable_values[0]
    end

    self.acceptable_values = acceptable_values
  end

  def negative_boundary_values
    super +
        [
            123,
            0,
            1,
            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/enum_field.rb
api-tester-0.0.5 lib/tester/definition/fields/enum_field.rb
api-tester-0.0.4 lib/tester/definition/fields/enum_field.rb
api-tester-0.0.3 lib/tester/definition/fields/enum_field.rb
api-tester-0.0.1 lib/tester/definition/fields/enum_field.rb