Sha256: 977e21e170c048feae31034b555d4127ec881642995fc77c9b32f62c2c23e699

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

class WithAttributes
    include Arachni::Parser::Nodes::Element::WithAttributes
end

describe Arachni::Parser::Nodes::Element::WithAttributes do
    subject { WithAttributes.new }

    describe '#attributes' do
        it "returns #{described_class::Attributes}" do
            expect(subject.attributes).to be_kind_of described_class::Attributes
        end
    end

    describe '#[]' do
        it 'converts the key to string' do
            subject[:key] = 'val'

            expect(subject.attributes).to eq( 'key' => 'val' )
        end

        it 'is case insensitive' do
            subject[:kEy] = 'val'

            expect(subject.attributes).to eq( 'key' => 'val' )
        end
    end

    describe '#[]=' do
        it 'converts the key to string' do
            subject['key'] = 'val'

            expect(subject.attributes).to eq( 'key' => 'val' )
        end

        it 'is case insensitive' do
            subject[:kEy]  = 'val'
            subject['key'] = 'val2'

            expect(subject.attributes).to eq( 'key' => 'val2' )
        end

        it 'freezes the value' do
            subject['key'] = 'val'

            expect(subject['key']).to be_frozen
        end
    end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arachni-1.6.1.3 spec/arachni/parser/nodes/element/with_attributes_spec.rb
arachni-1.6.1.2 spec/arachni/parser/nodes/element/with_attributes_spec.rb
arachni-1.6.1.1 spec/arachni/parser/nodes/element/with_attributes_spec.rb
arachni-1.6.1 spec/arachni/parser/nodes/element/with_attributes_spec.rb
arachni-1.6.0 spec/arachni/parser/nodes/element/with_attributes_spec.rb
arachni-1.5.1 spec/arachni/parser/nodes/element/with_attributes_spec.rb
arachni-1.5 spec/arachni/parser/nodes/element/with_attributes_spec.rb