Sha256: 3cb996826c1eba358bc4e08ec5e0722365dd876a1fe7c746d0b409491c564b85

Contents?: true

Size: 938 Bytes

Versions: 14

Compression:

Stored size: 938 Bytes

Contents

shared_examples "A property with flags" do
  before 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 < Ardm::Record
    end

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

  describe ".generated_classes" do
    it "should cache the generated class" do
      expect(@property_klass.generated_classes[@flags]).not_to be_nil
    end
  end

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

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

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 spec/shared/flags_shared.rb
ardm-0.4.0 spec/shared/flags_shared.rb
ardm-0.3.2 spec/shared/flags_shared.rb
ardm-0.3.1 spec/shared/flags_shared.rb
ardm-0.3.0 spec/shared/flags_shared.rb
ardm-0.2.7 spec/shared/flags_shared.rb
ardm-0.2.6 spec/shared/flags_shared.rb
ardm-0.2.5 spec/shared/flags_shared.rb
ardm-0.2.4 spec/shared/flags_shared.rb
ardm-0.2.3 spec/shared/flags_shared.rb
ardm-0.2.2 spec/shared/flags_shared.rb
ardm-0.2.1 spec/shared/flags_shared.rb
ardm-0.2.0 spec/shared/flags_shared.rb
ardm-0.1.0 spec/shared/flags_shared_spec.rb