Sha256: d9c3e2d89200bb323d03da72dcadfe9935541fec56b439106c819207cde964b9

Contents?: true

Size: 587 Bytes

Versions: 64

Compression:

Stored size: 587 Bytes

Contents

require 'spec_helper'
require 'r10k/settings/enum_definition'

describe R10K::Settings::EnumDefinition do

  subject { described_class.new(:enum, :enum => %w[one two three]) }

  describe '#validate' do
    it "doesn't raise an error when given an expected value" do
      subject.assign('two')
      subject.validate
    end
    it "raises an error when given a value outside the enum" do
      subject.assign('dos')
      expect {
        subject.validate
      }.to raise_error(ArgumentError, "Setting enum should be one of #{%w[one two three].inspect}, not 'dos'")
    end
  end
end

Version data entries

64 entries across 64 versions & 2 rubygems

Version Path
r10k-3.15.0 spec/unit/settings/enum_definition_spec.rb
akerl-r10k-3.14.2.1 spec/unit/settings/enum_definition_spec.rb
r10k-3.14.2 spec/unit/settings/enum_definition_spec.rb
r10k-3.14.1 spec/unit/settings/enum_definition_spec.rb
r10k-3.14.0 spec/unit/settings/enum_definition_spec.rb
r10k-3.13.0 spec/unit/settings/enum_definition_spec.rb
r10k-3.12.1 spec/unit/settings/enum_definition_spec.rb
r10k-3.12.0 spec/unit/settings/enum_definition_spec.rb
r10k-3.11.0 spec/unit/settings/enum_definition_spec.rb
r10k-3.10.0 spec/unit/settings/enum_definition_spec.rb
r10k-3.9.3 spec/unit/settings/enum_definition_spec.rb
r10k-3.9.2 spec/unit/settings/enum_definition_spec.rb
r10k-3.9.1 spec/unit/settings/enum_definition_spec.rb
r10k-3.9.0 spec/unit/settings/enum_definition_spec.rb
r10k-3.8.0 spec/unit/settings/enum_definition_spec.rb
r10k-3.7.0 spec/unit/settings/enum_definition_spec.rb
r10k-3.6.0 spec/unit/settings/enum_definition_spec.rb
r10k-2.6.9 spec/unit/settings/enum_definition_spec.rb
r10k-3.5.2 spec/unit/settings/enum_definition_spec.rb
r10k-3.5.1 spec/unit/settings/enum_definition_spec.rb