Sha256: f71de7b08c2ab6bf813f57fb1bdd91fc751ac8c3da4d54a0ae7ad83670590b54

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8

require 'spec_helper'

module Punchblock
  describe Header do
    it 'will auto-inherit nodes' do
      n = parse_stanza "<header name='boo' value='bah' />"
      h = Header.new n.root
      h.name.should be == :boo
      h.value.should be == 'bah'
    end

    it 'has a name attribute' do
      n = Header.new :boo, 'bah'
      n.name.should be == :boo
      n.name = :foo
      n.name.should be == :foo
    end

    it "substitutes - for _ on the name attribute when reading" do
      n = parse_stanza "<header name='boo-bah' value='foo' />"
      h = Header.new n.root
      h.name.should be == :boo_bah
    end

    it "substitutes _ for - on the name attribute when writing" do
      h = Header.new :boo_bah, 'foo'
      h.to_xml.should be == '<header name="boo-bah" value="foo"/>'
    end

    it 'has a value attribute' do
      n = Header.new :boo, 'en'
      n.value.should be == 'en'
      n.value = 'de'
      n.value.should be == 'de'
    end

    it 'can determine equality' do
      a = Header.new :boo, 'bah'
      a.should be == Header.new(:boo, 'bah')
      a.should_not be == Header.new(:bah, 'bah')
      a.should_not be == Header.new(:boo, 'boo')
    end
  end
end # Punchblock

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
punchblock-1.5.3 spec/punchblock/header_spec.rb
punchblock-1.5.2 spec/punchblock/header_spec.rb
punchblock-1.5.1 spec/punchblock/header_spec.rb
punchblock-1.5.0 spec/punchblock/header_spec.rb
punchblock-1.4.1 spec/punchblock/header_spec.rb
punchblock-1.4.0 spec/punchblock/header_spec.rb
punchblock-1.3.0 spec/punchblock/header_spec.rb
punchblock-1.2.0 spec/punchblock/header_spec.rb
punchblock-1.1.0 spec/punchblock/header_spec.rb
punchblock-1.0.0 spec/punchblock/header_spec.rb
punchblock-0.12.0 spec/punchblock/header_spec.rb
punchblock-0.11.0 spec/punchblock/header_spec.rb
punchblock-0.10.0 spec/punchblock/header_spec.rb