Sha256: be20e941f2ea6f891a2e9087d523d61d608d1cd11626dbb4c539a070fc392498

Contents?: true

Size: 610 Bytes

Versions: 5

Compression:

Stored size: 610 Bytes

Contents

require 'rexml/document'

describe "REXML::Attributes#[]=" do
  before :each do
    @e = REXML::Element.new("song")
    @name = REXML::Attribute.new("name", "Holy Smoke!")
    @e.attributes << @name
  end

  it "sets an attribute" do
    @e.attributes["author"] = "_why's foxes"
    @e.attributes["author"].should == "_why's foxes"
  end

  it "overwrites an existing attribute" do
    @e.attributes["name"] = "Chunky Bacon"
    @e.attributes["name"].should == "Chunky Bacon"
  end

  it "deletes an attribute is value is nil" do
    @e.attributes["name"] = nil
    @e.attributes.length.should == 0
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubysl-rexml-2.0.4 spec/attributes/element_set_spec.rb
rubysl-rexml-2.0.3 spec/attributes/element_set_spec.rb
rubysl-rexml-1.0.0 spec/attributes/element_set_spec.rb
rubysl-rexml-2.0.2 spec/attributes/element_set_spec.rb
rubysl-rexml-2.0.1 spec/attributes/element_set_spec.rb