Index: ruby/branches/0.5/lib/open_ehr/rm/data_types/quantity.rb
===================================================================
--- ruby/branches/0.5/lib/open_ehr/rm/data_types/quantity.rb	(revision 249)
+++ ruby/branches/0.5/lib/open_ehr/rm/data_types/quantity.rb	(revision 250)
@@ -146,5 +146,5 @@
           def initialize(args = {})
             super(args)
-            self.accuracy = accuracy
+            self.accuracy = args[:accuracy]
           end
 
@@ -226,11 +226,9 @@
         class DvQuantity < DvAmount
           attr_reader :units, :precision
-          def initialize(magnitude, units, magnitude_status=nil, precision=nil,
-                         accuracy=nil, accuracy_percent=nil, normal_range=nil,
-                         normal_status = nil, other_reference_ranges=nil)
-            super(magnitude, magnitude_status, accuracy, accuracy_percent,
-                  normal_range, normal_status, other_reference_ranges)
-            self.units = units
-            self.precision = precision
+
+          def initialize(args = {})
+            super(args)
+            self.units = args[:units]
+            self.precision = args[:precision]
           end
 
@@ -248,6 +246,8 @@
 
           def is_strictly_comparable_to?(others)
-            return false if others.nil?
-            if others.instance_of?(DvQuantity) && others.units == @units
+            unless super(others)
+              return false
+            end
+            if others.units == @units
               return true
             else
@@ -262,12 +262,4 @@
               return true
             end
-          end
-# accuracy???
-          def +(other)
-            dv_amount = super(other)
-            return DvQuantity.new(dv_amount.magnitude, @units,
-                                   @magnitude_status, @precision,
-                                   @accuracy, @accuracy_percent, @normal_range,
-                                   @normal_status, @other_reference_ranges)
           end
         end
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/quantity/dv_quantity_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/quantity/dv_quantity_spec.rb	(revision 250)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/quantity/dv_quantity_spec.rb	(revision 250)
@@ -0,0 +1,78 @@
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
+include OpenEHR::RM::DataTypes::Quantity
+
+describe DvQuantity do
+  before(:each) do
+    @dv_quantity = DvQuantity.new(:magnitude => 3,
+                                  :units => 'mg',
+                                  :precision => 0)
+  end
+
+  it 'should be an instance of DvQuantity' do
+    @dv_quantity.should be_instance_of DvQuantity
+  end
+
+  it 's units should be mg' do
+    @dv_quantity.units.should == 'mg'
+  end
+
+  describe 'Mathematical Operation' do
+    before(:each) do
+      @dv_quantity5 = DvQuantity.new(:magnitude => 5,
+                                     :units => 'mg')
+    end
+    
+    it 'should be comparable to 5mg' do
+      @dv_quantity.is_strictly_comparable_to?(@dv_quantity5).should be_true
+    end
+
+    it 'should be 8mg added 5mg' do
+      dv_quantity = @dv_quantity + @dv_quantity5
+      dv_quantity.magnitude.should == 8
+    end
+
+    it 'should be -2mg minus 5mg' do
+      dv_quantity = @dv_quantity - @dv_quantity5
+      dv_quantity.magnitude.should == -2
+    end
+
+    it 's unit should be mg' do
+      (@dv_quantity + @dv_quantity5).units.should == 'mg'
+    end
+  end
+
+  it 'should not be comparable to 8km' do
+    dv_quantity = DvQuantity.new(:magnitude => 8,
+                                 :units => 'km')
+    @dv_quantity.is_strictly_comparable_to?(dv_quantity).should_not be_true
+  end
+
+  it 'should return false with other type' do
+    @dv_quantity.is_strictly_comparable_to?(1).should_not be_true
+  end
+
+  it 's precision should be equal 0' do
+    @dv_quantity.precision.should == 0
+  end
+
+  it 'should be integral' do
+    @dv_quantity.is_integral?.should be_true
+  end
+
+  it 'should not be integral do' do
+    @dv_quantity.precision = 3
+    @dv_quantity.is_integral?.should_not be_true
+  end
+
+  it 'should not raise ArgumentError with -1 precision' do
+    lambda {
+      @dv_quantity.precision = -1
+    }.should_not raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with -2 precision' do
+    lambda {
+      @dv_quantity.precision = -2
+    }.should raise_error ArgumentError
+  end
+end
