Sha256: d597a3ad2cd783f77ab0495dbd6ac07fe56b895b0a95864fc1358bef98e9aea5

Contents?: true

Size: 1.32 KB

Versions: 8

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe Arachni::Reactor::Tasks::Persistent do
    it_should_behave_like 'Arachni::Reactor::Tasks::Base'

    let(:list) { Arachni::Reactor::Tasks.new }
    subject { described_class.new{} }

    describe '#initialize' do
        context 'when no task have been given' do
            it "raises #{ArgumentError}" do
                expect { described_class.new }.to raise_error ArgumentError
            end
        end
    end

    describe '#call' do
        it 'calls the given task' do
            callable = proc {}
            callable.should receive(:call)

            task = described_class.new(&callable)
            list << task

            task.call
        end

        it 'passes the task to it' do
            callable = proc {}
            task = described_class.new(&callable)

            callable.should receive(:call).with(task)

            list << task

            task.call
        end

        context 'when arguments have been provided' do
            it 'passes them to the task' do
                got = nil
                callable = proc do |_, arg|
                    got = arg
                end

                task = described_class.new(&callable)
                list << task

                task.call :stuff
                got.should == :stuff
            end
        end
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
arachni-reactor-0.1.3.2 spec/arachni/reactor/tasks/persistent_spec.rb
arachni-reactor-0.1.3.1 spec/arachni/reactor/tasks/persistent_spec.rb
arachni-reactor-0.1.3 spec/arachni/reactor/tasks/persistent_spec.rb
arachni-reactor-0.1.2 spec/arachni/reactor/tasks/persistent_spec.rb
arachni-reactor-0.1.1 spec/arachni/reactor/tasks/persistent_spec.rb
arachni-reactor-0.1.0 spec/arachni/reactor/tasks/persistent_spec.rb
arachni-reactor-0.1.0.beta5 spec/arachni/reactor/tasks/persistent_spec.rb
arachni-reactor-0.1.0.beta4 spec/arachni/reactor/tasks/persistent_spec.rb