Sha256: 7d79b8f8a65a3a5970bd59736a3aae7516b38b5f2c1dc27a2b7910efe1cdca83

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'moosex/attribute/modifiers'

describe MooseX::AttributeModifiers::Is do
  it "should accept only valid parameters" do
    expect { 
      MooseX::AttributeModifiers::Is.new(nil).process({is: :forbidden}, :foo)
    }.to raise_error(MooseX::InvalidAttributeError,
      "invalid value for field 'foo' is 'forbidden', must be one of :private, :rw, :rwp, :ro or :lazy")
  end
end

describe MooseX::AttributeModifiers::Predicate do
  it "should accept only valid parameters" do
    expect { 
      MooseX::AttributeModifiers::Predicate.new(nil).process({predicate: 0}, :foo)
    }.to raise_error(MooseX::InvalidAttributeError,
      "cannot coerce field predicate to a symbol for foo: undefined method `to_sym' for 0:Fixnum")
  end
end

describe MooseX::AttributeModifiers::Handles do
  it "should accept only valid parameters" do
    expect { 
      MooseX::AttributeModifiers::Handles.new(nil).process({handles: BasicObject}, :foo)
    }.to raise_error(MooseX::InvalidAttributeError,
      "ops, should not use BasicObject for handles in foo")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
moosex-0.0.21 spec/modifiers_spec.rb
moosex-0.0.20 spec/modifiers_spec.rb