Index: ruby/branches/0.5/lib/open_ehr/assumed_library_types.rb
===================================================================
--- ruby/branches/0.5/lib/open_ehr/assumed_library_types.rb	(revision 288)
+++ ruby/branches/0.5/lib/open_ehr/assumed_library_types.rb	(revision 289)
@@ -481,5 +481,5 @@
     end # end of ISO8601Timezone
 
-    module ISO8601_DURATION_MODULE
+    module ISO8601DurationModule
       attr_reader :years, :months, :weeks, :days
       attr_reader :hours, :minutes, :seconds, :fractional_second
@@ -572,6 +572,6 @@
     end
 
-    class ISO8601_DURATION < TimeDefinitions
-      include ISO8601_DURATION_MODULE
+    class ISO8601Duration < TimeDefinitions
+      include ISO8601DurationModule
       def initialize(str)
         /^P((\d+)Y)?((\d+)M)?((\d+)W)?((\d)D)?(T((\d+)H)?((\d+)M)?((\d+)(\.\d+)?S)?)?$/ =~ str
@@ -585,5 +585,5 @@
         self.fractional_second = $16.to_f
       end
-    end # end of ISO8601_DURATION
+    end # end of ISO8601Duration
   end # end of Assumed_Types
 end # end of OpenEHR
Index: ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso8601_duration_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso8601_duration_spec.rb	(revision 289)
+++ ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso8601_duration_spec.rb	(revision 289)
@@ -0,0 +1,150 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+include OpenEHR::AssumedLibraryTypes
+
+describe ISO8601Duration do
+  before(:each) do
+    @iso8601duration = ISO8601Duration.new('P1Y2M3W4DT5H6M7.8S')
+  end
+
+  it 'should be an instance of ISO8601Duration' do
+    @iso8601duration.should be_an_instance_of ISO8601Duration
+  end
+
+  it 'years should be 1' do
+    @iso8601duration.years.should be_equal 1
+  end
+
+  it 'months should be 2' do
+    @iso8601duration.months.should be_equal 2
+  end
+
+  it 'weeks should be 3' do
+    @iso8601duration.weeks.should be_equal 3
+  end
+
+  it 'days should be 4' do
+    @iso8601duration.days.should be_equal 4
+  end
+
+  it 'hours should be 5' do
+    @iso8601duration.hours.should be_equal 5
+  end
+
+  it 'minutes should be 6' do
+    @iso8601duration.minutes.should be_equal 6
+  end
+
+  it 'seconds should be 7' do
+    @iso8601duration.seconds.should be_equal 7
+  end
+
+  it 'fractional_seconds should be .8' do
+    @iso8601duration.fractional_second.should == 0.8
+  end
+
+  it 'should be equal P1Y2M3W4DT5H6M7.8S as string' do
+    @iso8601duration.as_string.should == 'P1Y2M3W4DT5H6M7.8S'
+  end
+
+  it 'should not raise ArgumentError with 0 yaers' do
+    lambda {
+      @iso8601duration.years = 0
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -1 yaers' do
+    lambda {
+      @iso8601duration.years = -1
+    }.should raise_error ArgumentError
+  end
+
+  it 'should not raise ArgumentError with 0 months' do
+    lambda {
+      @iso8601duration.months = 0
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -1 months' do
+    lambda {
+      @iso8601duration.months = -1
+    }.should raise_error ArgumentError
+  end
+    
+  it 'should not raise ArgumentError with 0 weeks' do
+    lambda {
+      @iso8601duration.weeks = 0
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -1 weeks' do
+    lambda {
+      @iso8601duration.weeks = -1
+    }.should raise_error ArgumentError
+  end
+
+  it 'should not raise ArgumentError with 0 days' do
+    lambda {
+      @iso8601duration.days = 0
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -1 days' do
+    lambda {
+      @iso8601duration.days = -1
+    }.should raise_error ArgumentError
+  end
+
+  it 'should not raise ArgumentError with 0 hours' do
+    lambda {
+      @iso8601duration.hours = 0
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -1 hours' do
+    lambda {
+      @iso8601duration.hours = -1
+    }.should raise_error ArgumentError
+  end
+
+  it 'should not raise ArgumentError with 0 minutes' do
+    lambda {
+      @iso8601duration.minutes = 0
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -1 minutes' do
+    lambda {
+      @iso8601duration.minutes = -1
+    }.should raise_error ArgumentError
+  end
+
+  it 'should not raise ArgumentError with 0 seconds' do
+    lambda {
+      @iso8601duration.seconds = 0
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -1 seconds' do
+    lambda {
+      @iso8601duration.seconds = -1
+    }.should raise_error ArgumentError
+  end
+
+  it 'should not raise ArgumentError with 0 fractional_second' do
+    lambda {
+      @iso8601duration.fractional_second = 0
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -1 fractional_second' do
+    lambda {
+      @iso8601duration.fractional_second = -1
+    }.should raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with 1.0 fractional_second' do
+    lambda {
+      @iso8601duration.fractional_second = 1.0
+    }.should raise_error ArgumentError
+  end
+end
