Sha256: ff4aa382fc5cd9a12a3ec510fd9233af1ebf9d4981170103722dc0b82cfd6b80

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'

describe Houdini::PostbackProcessor, ".process!" do
  let(:houdini_settings) do
    { :environment => "production", :api_key => "MY_KEY", :app_url => "http://localhost:3000" }
  end
  context "when the environments dont match" do
    before do
      Houdini.setup "production", houdini_settings
    end

    it "should raise an EnvironmentMismatchError" do
      lambda{
        Houdini::PostbackProcessor.process 'Class', 42, :environment => "sandbox"
      }.should raise_error(Houdini::PostbackProcessor::EnvironmentMismatchError)
    end
  end

  context "when in production and given API key doesn't match" do
    it "should raise an APIKeyMistmatchError" do
			pending "Houdini doesn't send the API key back."
      lambda{
        Houdini::PostbackProcessor.process 'Class', 42, :environment => "production", :api_key => "ANOTHER_KEY"
      }.should raise_error(Houdini::PostbackProcessor::APIKeyMistmatchError)
    end
  end

  context "given a classname and id" do
    it "should load the object, and have it process the postback, and return the result" do
      task_manager   = double :task_manager
      output         = double :output
      verbose_output = double :verbose_output

      task_manager.should_receive(:process).with('MyClass', 42, 'blueprint_name', output, verbose_output)

      Houdini::PostbackProcessor.process 'MyClass', 42, houdini_settings.merge(
        :blueprint      => 'blueprint_name',
        :output         => output,
        :verbose_output => verbose_output,
        :task_manager   => task_manager
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
houdini-0.3.2 spec/houdini/postback_processor_spec.rb
houdini-0.3.1 spec/houdini/postback_processor_spec.rb
houdini-0.3.0 spec/houdini/postback_processor_spec.rb