2014-03-28 15:34:30 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Oga::XML::Text do
|
|
|
|
context 'setting attributes' do
|
|
|
|
example 'set the text via the constructor' do
|
|
|
|
described_class.new(:text => 'foo').text.should == 'foo'
|
|
|
|
end
|
|
|
|
|
|
|
|
example 'set the text via a setter' do
|
|
|
|
instance = described_class.new
|
|
|
|
instance.text = 'foo'
|
|
|
|
|
|
|
|
instance.text.should == 'foo'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context '#to_xml' do
|
|
|
|
before do
|
|
|
|
@instance = described_class.new(:text => 'foo')
|
|
|
|
end
|
|
|
|
|
|
|
|
example 'generate the corresponding XML' do
|
|
|
|
@instance.to_xml.should == 'foo'
|
|
|
|
end
|
|
|
|
end
|
2014-04-07 07:58:31 +00:00
|
|
|
|
|
|
|
context '#inspect' do
|
|
|
|
before do
|
|
|
|
@instance = described_class.new(:text => 'foo')
|
|
|
|
end
|
|
|
|
|
2014-08-07 19:09:10 +00:00
|
|
|
example 'return the inspect value' do
|
|
|
|
@instance.inspect.should == 'Text("foo")'
|
2014-04-07 07:58:31 +00:00
|
|
|
end
|
|
|
|
end
|
2014-03-28 15:34:30 +00:00
|
|
|
end
|