Sha256: 97fc1b273c55b4287db7554e4a8ca9de0c0bdba790eb51f6fd137dcfe37d87cf

Contents?: true

Size: 1.28 KB

Versions: 26

Compression:

Stored size: 1.28 KB

Contents

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

describe ExprBinaryOperator do
  before(:each) do
    operator = OperatorKind.new(:value => 2001)
    right_operand = ExprItem.new(:type => 'Real')
    left_operand = stub(ExprItem, :item => 'ANY')
    @expr_binary_operator =
      ExprBinaryOperator.new(:type => 'Integer',
                             :item => 'ANY',
                             :reference_type => 'operator',
                             :operator => operator,
                             :precedence_overridden => true,
                             :right_operand => right_operand,
                             :left_operand => left_operand)
  end


  it 'right_operand should be assigned properly' do
    @expr_binary_operator.right_operand.type.should == 'Real'
  end

  it 'should raise ArgumentError when right_operand is nil' do
    lambda {
      @expr_binary_operator.right_operand = nil
    }.should raise_error ArgumentError
  end

  it 'left_operand should be assigned properly' do
    @expr_binary_operator.left_operand.item.should == 'ANY'
  end

  it 'should raise ArgumentError when left_oprand is nil' do
    lambda {
      @expr_binary_operator.left_operand = nil
    }.should raise_error ArgumentError
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

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