diff options
Diffstat (limited to 'spec/ruby/library/rexml/attributes/shared/length.rb')
-rw-r--r-- | spec/ruby/library/rexml/attributes/shared/length.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/library/rexml/attributes/shared/length.rb b/spec/ruby/library/rexml/attributes/shared/length.rb new file mode 100644 index 0000000000..94681882a6 --- /dev/null +++ b/spec/ruby/library/rexml/attributes/shared/length.rb @@ -0,0 +1,13 @@ +require File.expand_path('../../../../../spec_helper', __FILE__) +require 'rexml/document' + +describe :rexml_attribute_length, shared: true do + it "returns the number of attributes" do + e = REXML::Element.new("root") + e.attributes.send(@method).should == 0 + + e.attributes << REXML::Attribute.new("name", "John") + e.attributes << REXML::Attribute.new("another_name", "Leo") + e.attributes.send(@method).should == 2 + end +end |