Sha256: c3828fdb200a7d0ee97a3dcac5891feff98d5ea0b0f3f6b45a24a5355a480e2e

Contents?: true

Size: 499 Bytes

Versions: 3

Compression:

Stored size: 499 Bytes

Contents

require 'hashie/dash'

module Polytrix
  class Validation < Polytrix::ManifestSection
    ALLOWABLE_STATES = %w(passed pending failed skipped)
    property :validated_by, required: true
    property :result

    def result=(state)
      fail invalidate_state_error unless ALLOWABLE_STATES.include? state
      super
    end

    protected

    def invalidate_state_error(state)
      ArgumentError.new "Invalid result state: #{state}, should be one of #{ALLOWABLE_STATES.inspect}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
polytrix-0.1.2 lib/polytrix/validation.rb
polytrix-0.1.1 lib/polytrix/validation.rb
polytrix-0.1.0 lib/polytrix/validation.rb