Sha256: e8652661ed4479ea74ffab620c177a618240c98d7ad08e51151f96cc1753df16

Contents?: true

Size: 1.4 KB

Versions: 10

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Arachni::OptionGroups::Datastore do
    include_examples 'option_group'
    subject { described_class.new }

    it 'creates attribute accessors on the fly' do
        subject.test = 1
        subject.test.should == 1
    end

    describe '#to_h' do
        it 'only includes attributes with accessors' do
            method = :stuff=

            subject.instance_variable_set( :@blah, true )

            value = subject.send( method, 'stuff' )
            subject.to_h.should == { method.to_s[0...-1].to_sym => value }
        end
    end

    describe '#update' do
        it 'updates self with the values of the given hash' do
            method = :stuff
            value  = 'stuff'

            subject.update( { method => value } )
            subject.send( method ).should include value
        end

        it 'returns self' do
            subject.update({}).should == subject
        end
    end

    describe '#merge' do
        it 'updates self with the values of the given OptionGroup' do
            method = :stuff
            value  = 'stuff'

            group = described_class.new
            group.update( { method => value } )

            subject.merge( group )
            subject.send( method ).should include value
        end

        it 'returns self' do
            group = described_class.new
            subject.merge( group ).should == subject
        end
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arachni-1.2.1 spec/arachni/option_groups/datastore_spec.rb
arachni-1.2 spec/arachni/option_groups/datastore_spec.rb
arachni-1.1 spec/arachni/option_groups/datastore_spec.rb
arachni-1.0.6 spec/arachni/option_groups/datastore_spec.rb
arachni-1.0.5 spec/arachni/option_groups/datastore_spec.rb
arachni-1.0.4 spec/arachni/option_groups/datastore_spec.rb
arachni-1.0.3 spec/arachni/option_groups/datastore_spec.rb
arachni-1.0.2 spec/arachni/option_groups/datastore_spec.rb
arachni-1.0.1 spec/arachni/option_groups/datastore_spec.rb
arachni-1.0 spec/arachni/option_groups/datastore_spec.rb