Sha256: 6a3e4790c7b42a313c9c0d08a22e85c0a687fcc849e728c8d9cc71e88ce4fad2

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

require 'spec_helper'

describe CrystalApi::ReceivedWebhookParser do
  let(:raw_post) {{'foo' => 'bar'}.to_json}
  let(:webhook_envelope) { mock("WebhookEnvelope") }

  before(:each) do
    CrystalApi::WebhookEnvelope.stub(:new).and_return(webhook_envelope)
  end

  subject { CrystalApi::ReceivedWebhookParser.new(raw_post) }

  describe "#webhook" do
    it "instantiates a new webhook envelope with the parsed raw post" do
      CrystalApi::WebhookEnvelope.should_receive(:from_json).with({'foo' => 'bar'})
      subject.webhook
    end

    it "returns the instantiated webhook envelope" do
      subject.webhook.should == webhook_envelope
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crystal_api-0.1.0 spec/crystal_api/received_webhook_parser_spec.rb
crystal_api-0.0.1 spec/crystal_api/received_webhook_parser_spec.rb