Sha256: 8ff96f8b568822cb39251e2be0f6db46eebb1bd35b15995f938e941e5fb7ef08

Contents?: true

Size: 946 Bytes

Versions: 15

Compression:

Stored size: 946 Bytes

Contents

share_examples_for "A property with flags" do
  before :all do
    %w[ @property_klass ].each do |ivar|
      raise "+#{ivar}+ should be defined in before block" unless instance_variable_defined?(ivar)
    end

    @flags = [ :one, :two, :three ]

    class ::User
      include DataMapper::Resource
    end

    @property = User.property :item, @property_klass[@flags], :key => true
  end

  describe ".generated_classes" do
    it "should cache the generated class" do
      @property_klass.generated_classes[@flags].should_not be_nil
    end
  end

  it "should include :flags in accepted_options" do
    @property_klass.accepted_options.should include(:flags)
  end

  it "should respond to :generated_classes" do
    @property_klass.should respond_to(:generated_classes)
  end

  it "should respond to :flag_map" do
    @property.should respond_to(:flag_map)
  end

  it "should be custom" do
    @property.custom?.should be(true)
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
ardm-types-1.2.3 spec/shared/flags_shared_spec.rb
ardm-types-1.2.2 spec/shared/flags_shared_spec.rb
dm-pg-types-0.8.2 spec/shared/flags_shared_spec.rb
dm-pg-types-0.8.1 spec/shared/flags_shared_spec.rb
dm-types-1.2.2 spec/shared/flags_shared_spec.rb
dm-types-1.2.1 spec/shared/flags_shared_spec.rb
dm-types-1.2.0 spec/shared/flags_shared_spec.rb
dm-types-1.2.0.rc2 spec/shared/flags_shared_spec.rb
dm-types-1.2.0.rc1 spec/shared/flags_shared_spec.rb
dm-types-1.1.0 spec/shared/flags_shared_spec.rb
dm-types-1.1.0.rc3 spec/shared/flags_shared_spec.rb
dm-types-1.1.0.rc2 spec/shared/flags_shared_spec.rb
dm-types-1.1.0.rc1 spec/shared/flags_shared_spec.rb
dm-types-1.0.2 spec/shared/flags_shared_spec.rb
dm-types-1.0.1 spec/shared/flags_shared_spec.rb