Sha256: 16b9eb6cd3542513a56ffcab1e15cb81d03831f97764d1b329f0b2276a647e17

Contents?: true

Size: 1.73 KB

Versions: 26

Compression:

Stored size: 1.73 KB

Contents

require File.dirname(__FILE__) + '/../../../../../spec_helper'
include OpenEHR::AM::Archetype::ConstraintModel
include OpenEHR::AssumedLibraryTypes

describe Cardinality do
  before(:each) do
    interval = Interval.new(:upper => 1, :lower => 0)
    @cardinality = Cardinality.new(:is_ordered => true,
                                   :is_unique => true,
                                   :interval => interval)
  end

  it 'should be an instance of Cardinality' do
    @cardinality.should be_an_instance_of Cardinality
  end

  it 'is_ordered should be assigned properly' do
    @cardinality.should be_ordered
  end

  it 'is_ordered should be false' do
    @cardinality.is_ordered = false
    @cardinality.should_not be_ordered
  end

  it 'is_unique should be assigned properly' do
    @cardinality.should be_unique
  end

  it 'is_unique should not be true' do
    @cardinality.is_unique = false
    @cardinality.should_not be_unique
  end

  it 'interval should be assigned properly' do
    @cardinality.interval.upper.should be_equal 1
  end

  it 'is_set represent not ordered and unique' do
    @cardinality.should_not be_set
  end

  it 'is_set should be true' do
    @cardinality.is_unique = true
    @cardinality.is_ordered = false
    @cardinality.should be_set
  end

  it 'is_list represent ordered and not unique' do
    @cardinality.is_ordered = true
    @cardinality.is_unique = false
    @cardinality.should be_list
  end

  it 'is_list should not be true' do
    @cardinality.should_not be_list
  end

  it 'is_bag represent not ordered and not unique' do
    @cardinality.is_ordered = false
    @cardinality.is_unique = false
    @cardinality.should be_bag
  end

  it 'is_bag? should not be true' do
    @cardinality.should_not be_bag
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
openehr-1.2.8 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.2.7 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.2.6 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.2.5 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.2.4 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.2.3 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.2.2 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.2.1 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.2.0 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.1.6 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.1.5 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.1.4 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.1.3 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.1.2 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.1.1 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
openehr-1.1.0 spec/lib/openehr/am/archetype/constraint_model/cardinality_spec.rb
open_ehr-1.0.2 spec/lib/open_ehr/am/archetype/constraint_model/cardinality_spec.rb
open_ehr-1.0.1 spec/lib/open_ehr/am/archetype/constraint_model/cardinality_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/am/archetype/constraint_model/cardinality_spec.rb
open_ehr-0.9.5 spec/lib/open_ehr/am/archetype/constraint_model/cardinality_spec.rb