Sha256: 2e61208087ac98a84d0d54863c2bc2d6eb7128433231748f4f186187eed7b4d6

Contents?: true

Size: 784 Bytes

Versions: 5

Compression:

Stored size: 784 Bytes

Contents

require 'coverage_helper'
require 'minitest/autorun'
require 'minitest/colorin'
require 'pry-nav'
require 'rasti-types'

module Minitest
  class Test
    def as_string(value)
      value.is_a?(::String) ? "'#{value}'" : value.inspect
    end
  end
end

class Point

  attr_reader :x, :y

  def initialize(attributes={})
    errors = {}

    if attributes.key? :x
      @x = attributes[:x]
    else
      errors[:x] = ['not present']
    end

    if attributes.key? :y
      @y = attributes[:y]
    else
      errors[:y] = ['not present']
    end

    raise Rasti::Types::CompoundError, errors if errors.any?
  end

end


module Colors

  extend Rasti::Enum

  class Red < Rasti::Enum::Value
  end

  class Green < Rasti::Enum::Value
  end

  class Blue < Rasti::Enum::Value
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rasti-types-2.0.1 spec/minitest_helper.rb
rasti-types-2.0.0 spec/minitest_helper.rb
rasti-types-1.1.2 spec/minitest_helper.rb
rasti-types-1.1.1 spec/minitest_helper.rb
rasti-types-1.1.0 spec/minitest_helper.rb