summaryrefslogtreecommitdiff
path: root/spec/ruby/library/rexml/attribute/to_string_spec.rb
blob: a9d249f5bbb34da2668a974f9c72695c5f5c0dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require_relative '../../../spec_helper'

ruby_version_is ''...'3.0' do
  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
end