Sha256: 77d3bb89776fabdec925e2a250a338e8b281d4b77172a5a20779e6db0d1e07e9

Contents?: true

Size: 1006 Bytes

Versions: 6

Compression:

Stored size: 1006 Bytes

Contents

require 'fake_sqs/api'

class FakeSQS::Actions::TheAction

  def initialize(options)
    @options = options
  end

  def call(params)
    { :options => @options, :params => params }
  end

end

describe FakeSQS::API do

  it "delegates actions to classes" do
    api = FakeSQS::API.new(:queues => [])

    response = api.call("TheAction", {:foo => "bar"})

    response[:options].should eq :queues => []
    response[:params].should eq :foo => "bar"
  end

  it "raises InvalidAction for unknown actions" do
    api = FakeSQS::API.new(:queues => [])

    expect {
      api.call("SomethingDifferentAndUnknown", {:foo => "bar"})
    }.to raise_error(FakeSQS::InvalidAction)

  end

  it "resets queues" do
    queues = double :queues
    api = FakeSQS::API.new(:queues => queues)
    queues.should_receive(:reset)
    api.reset
  end

  it "expires messages in queues" do
    queues = double :queues
    api = FakeSQS::API.new(:queues => queues)
    queues.should_receive(:expire)
    api.expire
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fake_sqs-0.0.9 spec/unit/api_spec.rb
fake_sqs-0.0.8 spec/unit/api_spec.rb
fake_sqs-0.0.7 spec/unit/api_spec.rb
fake_sqs-0.0.6 spec/unit/api_spec.rb
fake_sqs-0.0.5 spec/unit/api_spec.rb
fake_sqs-0.0.4 spec/unit/api_spec.rb