Rev | Line | |
---|
[390] | 1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
| 2 | include OpenEHR::AM::Archetype::Assertion
|
---|
| 3 |
|
---|
| 4 | describe ExprBinaryOperator do
|
---|
| 5 | before(:each) do
|
---|
| 6 | operator = OperatorKind.new(:value => 2001)
|
---|
| 7 | right_operand = ExprItem.new(:type => 'Real')
|
---|
| 8 | left_operand = stub(ExprItem, :item => 'ANY')
|
---|
| 9 | @expr_binary_operator =
|
---|
| 10 | ExprBinaryOperator.new(:type => 'Integer',
|
---|
| 11 | :item => 'ANY',
|
---|
| 12 | :reference_type => 'operator',
|
---|
| 13 | :operator => operator,
|
---|
| 14 | :precedence_overridden => true,
|
---|
| 15 | :right_operand => right_operand,
|
---|
| 16 | :left_operand => left_operand)
|
---|
| 17 | end
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 | it 'right_operand should be assigned properly' do
|
---|
| 21 | @expr_binary_operator.right_operand.type.should == 'Real'
|
---|
| 22 | end
|
---|
| 23 |
|
---|
| 24 | it 'should raise ArgumentError when right_operand is nil' do
|
---|
| 25 | lambda {
|
---|
| 26 | @expr_binary_operator.right_operand = nil
|
---|
| 27 | }.should raise_error ArgumentError
|
---|
| 28 | end
|
---|
| 29 |
|
---|
| 30 | it 'left_operand should be assigned properly' do
|
---|
| 31 | @expr_binary_operator.left_operand.item.should == 'ANY'
|
---|
| 32 | end
|
---|
| 33 |
|
---|
| 34 | it 'should raise ArgumentError when left_oprand is nil' do
|
---|
| 35 | lambda {
|
---|
| 36 | @expr_binary_operator.left_operand = nil
|
---|
| 37 | }.should raise_error ArgumentError
|
---|
| 38 | end
|
---|
| 39 | end
|
---|
| 40 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.