summaryrefslogtreecommitdiff
path: root/spec/ruby/library/rexml/attribute/to_string_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/rexml/attribute/to_string_spec.rb')
-rw-r--r--spec/ruby/library/rexml/attribute/to_string_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/ruby/library/rexml/attribute/to_string_spec.rb b/spec/ruby/library/rexml/attribute/to_string_spec.rb
new file mode 100644
index 0000000000..f8cc639a9d
--- /dev/null
+++ b/spec/ruby/library/rexml/attribute/to_string_spec.rb
@@ -0,0 +1,15 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+require 'rexml/document'
+
+describe "REXML::Attribute#to_string" do
+ it "returns the attribute as XML" do
+ attr = REXML::Attribute.new("name", "value")
+ attr_empty = REXML::Attribute.new("name")
+ attr_ns = REXML::Attribute.new("xmlns:ns", "http://uri")
+
+ attr.to_string.should == "name='value'"
+ attr_empty.to_string.should == "name=''"
+ attr_ns.to_string.should == "xmlns:ns='http://uri'"
+ end
+end
+