Added Attribute#parent
This commit is contained in:
parent
d0177633f8
commit
07658dadb1
|
@ -17,6 +17,8 @@ module Oga
|
||||||
# @return [Oga::XML::Element]
|
# @return [Oga::XML::Element]
|
||||||
attr_accessor :element
|
attr_accessor :element
|
||||||
|
|
||||||
|
alias_method :parent, :element
|
||||||
|
|
||||||
##
|
##
|
||||||
# The default namespace available to all attributes. This namespace can
|
# The default namespace available to all attributes. This namespace can
|
||||||
# not be modified.
|
# not be modified.
|
||||||
|
|
|
@ -11,6 +11,15 @@ describe Oga::XML::Attribute do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#parent' do
|
||||||
|
it 'returns the parent Element' do
|
||||||
|
element = Oga::XML::Element.new(:name => 'foo')
|
||||||
|
attr = described_class.new(:element => element)
|
||||||
|
|
||||||
|
attr.parent.should == element
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#namespace' do
|
describe '#namespace' do
|
||||||
before do
|
before do
|
||||||
@namespace = Oga::XML::Namespace.new(:name => 'b')
|
@namespace = Oga::XML::Namespace.new(:name => 'b')
|
||||||
|
|
Loading…
Reference in New Issue