Sha256: 529593b70447d5e6d580cfa3ac1b8214705cb7a437d2426a2b2f6aae5d011df2

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

describe Arachni::Support::KeyFiller do

    describe '#fill' do
        it 'fills in all inputs with appropriate seed values' do
            described_class.fill(
                'nAMe'    => nil,
                'usEr'    => nil,
                'uSR'     => nil,
                'pAsS'    => nil,
                'tXt'     => nil,
                'nUm'     => nil,
                'AmoUnt'  => nil,
                'mAIL'    => nil,
                'aCcouNt' => nil,
                'iD'      => nil
            ).should == {
                'nAMe'    => 'arachni_name',
                'usEr'    => 'arachni_user',
                'uSR'     => 'arachni_user',
                'pAsS'    => '5543!%arachni_secret',
                'tXt'     => 'arachni_text',
                'nUm'     => '132',
                'AmoUnt'  => '100',
                'mAIL'    => 'arachni@email.gr',
                'aCcouNt' => '12',
                'iD'      => '1'
            }
        end

        context 'when there is a value' do
            it 'skips it' do
                with_values = {
                    'stuff' => 'blah'
                }
                described_class.fill( with_values ) == with_values
            end
        end

        context 'when no match is found' do
            it 'uses "1"' do
                with_values = {
                    'stuff' => ''
                }
                described_class.fill( with_values )['stuff'] == '1'
            end

            context 'and a default value has been provided' do
                it 'uses it' do
                    with_values = {
                        'stuff' => ''
                    }
                    described_class.fill( with_values, 'myval' )['stuff'] == 'myval'
                end
            end
        end
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arachni-0.4.7 spec/arachni/support/key_filler.rb
arachni-0.4.6 spec/arachni/support/key_filler.rb