Sha256: d83ca4eb57b682036203ab36bf62a8a50faf7c54db88c0c4de8f1024c4bf87d0

Contents?: true

Size: 961 Bytes

Versions: 1

Compression:

Stored size: 961 Bytes

Contents

describe Onfido::Webhook do
  subject(:webhook) { described_class.new }
  let(:params) do
    {
      "url" => "https://webhookendpoint.url",
      "enabled" => true,
      "events" => [
        "report completion",
        "report withdrawal",
        "check completion",
        "check in progress"
      ]
    }
  end

  describe "#create" do
    it "cretes the webhook" do
      response = webhook.create(params)
      expect(response['id']).to_not be_nil
    end

    it "responds with the right url" do
      response = webhook.create(params)
      expect(response["url"]).to eq params["url"]
    end
  end

  describe "#all" do
    it "returns all the registered webhooks" do
      response = webhook.all
      expect(response["webhooks"].count).to eq 2
    end

    it "returns with id" do
      response = webhook.all
      expect(response["webhooks"][0]["id"]).to_not be_nil
      expect(response["webhooks"][1]["id"]).to_not be_nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onfido-0.3.0 spec/integrations/webhook_spec.rb