Tests for the Namespace class.

This commit is contained in:
Yorick Peterse 2014-08-07 20:01:14 +02:00
parent 8e8ea64206
commit f653203220
3 changed files with 31 additions and 0 deletions

View File

@ -25,6 +25,7 @@ require_relative 'oga/xml/cdata'
require_relative 'oga/xml/xml_declaration'
require_relative 'oga/xml/doctype'
require_relative 'oga/xml/attribute'
require_relative 'oga/xml/namespace'
require_relative 'oga/xml/node_set'
require_relative 'oga/html/parser'

View File

@ -24,6 +24,13 @@ module Oga
def to_s
return name.to_s
end
##
# @return [String]
#
def inspect
return "Namespace(name: #{name.inspect})"
end
end # Namespace
end # XML
end # Oga

View File

@ -0,0 +1,23 @@
require 'spec_helper'
describe Oga::XML::Namespace do
context '#initialize' do
example 'set the name' do
described_class.new(:name => 'a').name.should == 'a'
end
end
context '#to_s' do
example 'convert the Namespace to a String' do
described_class.new(:name => 'x').to_s.should == 'x'
end
end
context '#inspect' do
example 'return the inspect value' do
ns = described_class.new(:name => 'x')
ns.inspect.should == 'Namespace(name: "x")'
end
end
end