Index: ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/interval_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/interval_spec.rb	(revision 255)
+++ ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/interval_spec.rb	(revision 256)
@@ -1,2 +1,3 @@
+<<<<<<< .mine
 require File.dirname(__FILE__) + '/../../../spec_helper'
 include OpenEHR::AssumedLibraryTypes
@@ -48,5 +49,5 @@
   end
 
-  it 'should have not have 1' do
+  it 'should not have 1' do
     @interval.has?(1).should_not be_true
   end
@@ -138,2 +139,143 @@
   end
 end
+=======
+require File.dirname(__FILE__) + '/../../../spec_helper'
+include OpenEHR::AssumedLibraryTypes
+
+describe Interval do
+  before(:each) do
+    @interval = Interval.new(:upper => 10,
+                             :lower => 1)
+  end
+
+  it 'should be an instance of Interval' do
+    @interval.should be_an_instance_of Interval
+  end
+
+  it 's upper should be greater than lower' do
+    @interval.upper.should be > @interval.lower
+  end
+
+  it 's upper should be equal 10' do
+    @interval.upper.should == 10
+  end
+
+  it 's lower should be equal 1' do
+    @interval.lower.should == 1
+  end
+
+  it 'should raise ArgumentError with smaller upper' do
+    lambda {@interval.upper = -1}.should raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with greater lower' do
+    lambda {@interval.lower = 11}.should raise_error ArgumentError
+  end
+
+  it 'should have 5' do
+    @interval.has?(5).should be_true
+  end
+
+  it 'should not have 11' do
+    @interval.has?(11).should_not be_true
+  end
+
+  it 'should not have -1' do
+    @interval.has?(-1).should_not be_true
+  end
+
+  it 'should not have 10' do
+    @interval.has?(10).should_not be_true
+  end
+
+  it 'should have not have 1' do
+    @interval.has?(1).should_not be_true
+  end
+
+  describe Interval, 'when lower included' do
+    before do
+      @interval.lower_included = true
+    end
+
+    it 'should be lower_included' do
+      @interval.should be_lower_included
+    end
+
+    it 'should have 1 when lower included' do
+      @interval.has?(1).should be_true
+    end
+
+    after do
+      @interval.lower_included = false
+    end
+  end
+
+  describe Interval, 'when upper included' do
+    before do
+      @interval.upper_included = true
+    end
+
+    it 'should be upper uncluded' do
+      @interval.should be_upper_included
+    end
+
+    it 'should have 10 when upper included' do
+      @interval.has?(10).should be_true
+    end
+
+    after do
+      @interval.upper_included = false
+    end
+  end
+
+  describe Interval, 'when upper unbounded' do
+    before do
+      @interval.upper = nil
+    end
+
+    it 'should be upper unbounded' do
+      @interval.should be_upper_unbounded
+    end
+
+    it 'should have 11' do
+      @interval.has?(11).should be_true
+    end
+
+    it 'should raise ArgumentError, when upper_included is assigned' do
+      lambda{
+        @interval.upper_included = true
+      }.should raise_error ArgumentError
+    end
+
+    after do
+      @interval.upper = 10
+    end
+  end
+
+  describe Interval, 'when lower unbounded' do
+    before do
+      @interval.lower = nil
+    end
+
+    it 'should be lower unbounded' do
+      @interval.should be_lower_unbounded
+    end
+
+    it 'should  have -10' do
+      @interval.has?(-10).should be_true
+    end
+
+    it 'should raise ArgumentError, when lower_included is assigned' do
+      lambda{
+        @interval.lower_included = true
+      }.should raise_error ArgumentError
+    end
+  end
+
+  it 'should raise ArgumentError both upper and lower is nil' do
+    lambda {
+      Interval.new
+    }.should raise_error ArgumentError
+  end
+end
+>>>>>>> .r255
Index: ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso_8601_date_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso_8601_date_spec.rb	(revision 256)
+++ ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso_8601_date_spec.rb	(revision 256)
@@ -0,0 +1,156 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+include OpenEHR::AssumedLibraryTypes
+
+describe ISO8601Date do
+  before do
+    @iso8601date = ISO8601Date.new('2009-09-10')
+  end
+
+  it 'should be an instance of ISO8601Date' do
+    @iso8601date.should be_an_instance_of ISO8601Date
+  end
+
+  it 'year should be equal 2009' do
+    @iso8601date.year.should be_equal 2009
+  end
+
+  it 'month should be equal 9' do
+    @iso8601date.month.should be_equal 9
+  end
+
+  it 'day should be equal 10' do
+    @iso8601date.day.should be_equal 10
+  end
+
+  it 'should be 2009-09-10 as_string' do
+    @iso8601date.as_string.should == '2009-09-10'
+  end
+
+  describe 'year behavior' do
+    it 'should raise ArgumentError with nil year string' do
+      lambda{ISO8601Date.new('-09-02')}.should raise_error ArgumentError
+    end
+
+    it 'should raise ArgumentError with nil year' do
+      lambda{@iso8601date.year = nil}.should raise_error ArgumentError
+    end
+
+    it 'should not raise ArgumentError more than 0 year' do
+      lambda{@iso8601date.year = 0}.should_not raise_error ArgumentError
+    end
+  end
+
+  describe 'month behavior' do
+    it '1 month should not raise ArgumentError' do
+      lambda{@iso8601date.month = 1}.should_not raise_error ArgumentError
+    end
+
+    it '12 month should not raise ArgumentError' do
+      lambda{@iso8601date.month = 12}.should_not raise_error ArgumentError
+    end
+
+    it '13 month should raise ArgumentError' do
+      lambda{@iso8601date.month = 13}.should raise_error ArgumentError
+    end
+
+    it '0 month should raise ArgumentError' do
+      lambda{@iso8601date.month = 0}.should raise_error ArgumentError
+    end
+  end
+
+  describe 'day behavior' do
+    it '0 day should raise ArgumentError' do
+      lambda{@iso8601date.day = 0}.should raise_error ArgumentError
+    end
+  end
+
+  describe 'January behavior' do
+    before do
+      @iso8601date.month = 1
+    end
+
+    it 'January should have 31 days' do
+      lambda{@iso8601date.day = 31}.should_not raise_error ArgumentError
+    end
+
+    it 'January should not have 32 days' do
+      lambda{@iso8601date.month = 32}.should raise_error ArgumentError
+    end
+  end
+
+  describe 'February and leap year behavior' do
+    before do
+      @iso8601date.month = 2
+    end
+
+    describe '2009(not leap year) behavior' do
+      before do
+        @iso8601date.year = 2009
+      end
+
+      it '2009-02-28 should not raise ArgumentError' do
+        lambda{@iso8601date.day = 28}.should_not raise_error ArgumentError
+      end
+
+      it '2009-02-29 should raise ArgumentError' do
+        lambda{@iso8601date.day = 29}.should raise_error ArgumentError
+      end
+    end
+
+    describe '2008(leap year) behavior' do
+      before do
+        @iso8601date.year = 2008
+      end
+
+      it '2008-02-29 should not raise ArgumentError' do
+        lambda{@iso8601date.day = 29}.should_not raise_error ArgumentError
+      end
+
+      it '2008-02-30 should raise ArgumentError' do
+        lambda{@iso8601date.day = 30}.should raise_error ArgumentError
+      end
+    end
+
+    describe '2000(irregular leap year' do
+      before do
+        @iso8601date.year = 2000
+      end
+
+      it '2000-02-29 should not raise ArgumentError' do
+        lambda{@iso8601date.day = 29}.should_not raise_error ArgumentError
+      end
+
+      it '2000-02-30 should raise ArgumentError' do
+        lambda{@iso8601date.day = 30}.should raise_error ArgumentError
+      end
+    end
+  end
+
+  describe 'March behavior' do
+    before do
+      @iso8601date.month = 3
+    end
+
+    it '31 day should not raise ArgumentError' do
+      lambda{@iso8601date.day = 31}.should_not raise_error ArgumentError
+    end
+
+    it '32 day should raise ArgumentError' do
+      lambda{@iso8601date.day = 32}.should raise_error ArgumentError
+    end
+  end
+
+  describe 'April behavior' do
+    before do
+      @iso8601date.month = 4
+    end
+
+    it '30 day should not raise ArgumentError' do
+      lambda{@iso8601date.day = 30}.should_not raise_error ArgumentError
+    end
+
+    it '31 day should raise ArgumentError' do
+      lambda{@iso8601date.day = 31}.should raise_error ArgumentError
+    end
+  end
+end
