Sha256: 6ebecc9c3e2cd6803c3ff8addace212f4703083353e917dfeb62d022c5127213

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

# ticket 192
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
require 'open_ehr/am/openehr_profile/data_types/basic'
include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Basic
include ::OpenEHR::AssumedLibraryTypes
require 'set'

describe CDvState do
  before(:each) do
    proposed_state = State.new(:name => 'PROPOSED')
    complete_state = TerminalState.new(:name => 'COMPLETED')
    finish = Transition.new(:event => 'finish', :next_state => complete_state)
    transitions = Set[finish]
    non_terminal_state = NonTerminalState.new(:name => 'IN_EXECUTION',
                                              :transitions => transitions)
    states = Set[proposed_state, non_terminal_state, complete_state]
    state_machine = StateMachine.new(:states => states)
    occurrences = Interval.new(:upper => 1, :lower => 1)
    @c_dv_state = CDvState.new(:value => state_machine, :path => '/',
                               :occurrences => occurrences)
  end

  it 'is an instance of StateMachine' do
    @c_dv_state.should be_an_instance_of CDvState
  end

  it 'states size should be 3' do
    @c_dv_state.value.states.size.should be 3
  end

  it 'raise error if value is nil' do
    expect {@c_dv_state.value = nil}.to raise_error
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
open_ehr-1.0.2 spec/lib/open_ehr/am/openehr_profile/data_types/basic/c_dv_state_spec.rb
open_ehr-1.0.1 spec/lib/open_ehr/am/openehr_profile/data_types/basic/c_dv_state_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/am/openehr_profile/data_types/basic/c_dv_state_spec.rb