Index: /ruby/branches/0.5/lib/open_ehr/rm/data_types/text.rb
===================================================================
--- /ruby/branches/0.5/lib/open_ehr/rm/data_types/text.rb	(revision 220)
+++ /ruby/branches/0.5/lib/open_ehr/rm/data_types/text.rb	(revision 221)
@@ -48,7 +48,8 @@
         class CodePhrase
           attr_reader :terminology_id, :code_string
-          def initialize(code_string, terminology_id)
-            self.code_string = code_string
-            self.terminology_id = terminology_id
+
+          def initialize(args = {})
+            self.code_string = args[:code_string]
+            self.terminology_id = args[:terminology_id]
           end
 
@@ -86,5 +87,5 @@
 
           def formatting=(formatting)
-            unless formatting.nil? or formatting.empty?
+            if !formatting.nil? and formatting.empty?
               raise ArgumentError, "formatting is not valid"
             end
@@ -93,5 +94,5 @@
 
           def encoding=(encoding)
-            unless encoding.nil? or encoding.empty?
+            if !encoding.nil? and encoding.empty?
               raise ArgumentError, "encoding is not valid"
             end
@@ -108,5 +109,5 @@
           end
           def language=(language)
-            unless language.nil? or language.empty?
+            if !@language.nil? and language.empty?
               raise ArgumentError, "langage is not valid"
             end
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb	(revision 220)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb	(revision 221)
@@ -7,5 +7,6 @@
   before(:each) do
     @terminology_id = TerminologyId.new('openher')
-    code_phrase = CodePhrase.new('524', @terminology_id)
+    code_phrase = CodePhrase.new(:code_string => '524',
+                                 :terminology_id => @terminology_id)
     dv_coded_text = DvCodedText.new(:value => "initial",
                                     :defining_code => code_phrase)
@@ -23,5 +24,6 @@
 
   it 'should change other value assigned' do
-    code_phrase = CodePhrase.new('526',@terminology_id)
+    code_phrase = CodePhrase.new(:code_string => '526',
+                                 :terminology_id => @terminology_id)
     dv_coded_text = DvCodedText.new(:value =>'planned',
                                     :defining_code => code_phrase)
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb	(revision 221)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb	(revision 221)
@@ -0,0 +1,46 @@
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
+include OpenEHR::RM::DataTypes::Text
+include OpenEHR::RM::Support::Identification
+
+describe DvText do
+  before(:each) do
+    @dv_text = DvText.new(:value => 'test')
+  end
+
+  it 'should be an instance of DvText' do
+    @dv_text.should be_an_instance_of DvText
+  end
+
+  it 's value should be test' do
+    @dv_text.value.should == 'test'
+  end
+
+  it 'should raise ArgumentError, when value include \n' do
+    lambda {
+      @dv_text.value = "not valid value\n"
+    }.should raise_error(ArgumentError)
+  end
+
+  it 'should raise ArgumentError, when value is nil' do
+    lambda {
+      @dv_text.value = nil
+    }.should raise_error(ArgumentError)
+  end
+
+  it 'formatting should be font' do
+    @dv_text.formatting = 'font = 12pt'
+    @dv_text.formatting.should == 'font = 12pt'
+  end
+
+  it 'should raise ArgumentError, when formatting is empty' do
+    lambda{@dv_text.formatting = ""}.should raise_error(ArgumentError)
+  end
+
+  it 'should be mapping list'
+
+  it 'should be hyperlink'
+
+  it 'should be language'
+
+  it 'should be encoding'
+end
