Sha256: 2085f09d97740a287ffa563694b8c975b03aa227964bcade14b7337bbabc38be

Contents?: true

Size: 990 Bytes

Versions: 1

Compression:

Stored size: 990 Bytes

Contents

require 'moosex/attribute/modifiers'

describe MooseX::Attribute::Is do
  it "should accept only valid parameters" do
    expect { 
      MooseX::Attribute::Is.new.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::Attribute::Predicate do
  it "should accept only valid parameters" do
    expect { 
      MooseX::Attribute::Predicate.new.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::Attribute::Handles do
  it "should accept only valid parameters" do
    expect { 
      MooseX::Attribute::Handles.new.process({handles: BasicObject}, :foo)
    }.to raise_error(MooseX::InvalidAttributeError,
      "ops, should not use BasicObject for handles in foo")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moosex-0.0.18 spec/modifiers_spec.rb