Sha256: 1465c99af5d130c1b5177406d8618aff21872accf17c022ec5a7f07a60fd7fea

Contents?: true

Size: 702 Bytes

Versions: 10

Compression:

Stored size: 702 Bytes

Contents

require 'wml_spec_helper'

describe Weskit::WML::Elements do
  include WMLHelpers

  let(:element)  { Weskit::WML::Element.new :foo }
  let(:elements) { Weskit::WML::Elements.new }

  it_should_behave_like 'a searchable' do
    let(:searchable) { elements }
  end

  it 'has hash like access' do
    element = Weskit::WML::Element.new(:foo).push Weskit::WML::Attribute.new(:bat, :baz)
    elements.push element

    elements[0].should be(element)
    elements[:bat].should match_value_of(:baz)
  end

  it 'store elements only' do
    expect { elements.push element }.to change { elements.size }.from(0).to(1)
    expect { elements.push :boo }.to raise_error(Weskit::WML::Errors::InvalidItem)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
weskit-0.3.6 spec/wml/elements_spec.rb
weskit-0.3.5 spec/wml/elements_spec.rb
weskit-0.3.4 spec/wml/elements_spec.rb
weskit-0.3.3 spec/wml/elements_spec.rb
weskit-0.3.2 spec/wml/elements_spec.rb
weskit-0.3.1 spec/wml/elements_spec.rb
weskit-0.3.0 spec/wml/elements_spec.rb
weskit-0.2.1 spec/wml/elements_spec.rb
weskit-0.2.0 spec/wml/elements_spec.rb
weskit-0.1.0 spec/wml/elements_spec.rb