Sha256: 0407dff54f3e4ef05d3f0be254adbdcc2ae0088d635718fee85234b33edd5a18

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

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

    %w(pool_size job_timeout worker_time_to_live ignore_images screen_width
        screen_height wait_for_elements local_storage).each do |method|
        it { is_expected.to respond_to method }
        it { is_expected.to respond_to "#{method}=" }
    end

    context '#wait_for_elements' do
        it 'converts the keys to Regexp' do
            subject.wait_for_elements = {
                'article' => '.articles'
            }

            expect(subject.wait_for_elements).to eq({
                /article/i => '.articles'
            })
        end
    end

    describe '#to_rpc_data' do
        let(:data) { subject.to_rpc_data }

        it "converts 'wait_for_elements' to strings" do
            subject.wait_for_elements = {
                /stuff/ => '.my-element'
            }

            expect(data['wait_for_elements']).to eq({
                'stuff' => '.my-element'
            })
        end
    end

    describe '#local_storage' do
        context 'when passed a Hash' do
            it 'sets it' do
                subject.local_storage = { 1 => 2 }
                expect(subject.local_storage).to eq({ 1 => 2 })
            end
        end

        context 'when passed anything other than Hash' do
            it 'raises ArgumentError' do
                expect do
                    subject.local_storage = 1
                end.to raise_error ArgumentError
            end
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arachni-1.5.1 spec/arachni/option_groups/browser_cluster_spec.rb
arachni-1.5 spec/arachni/option_groups/browser_cluster_spec.rb
arachni-1.4 spec/arachni/option_groups/browser_cluster_spec.rb