Sha256: 2e1b8534242f8a7e06c1c8d02d69f8c439c9c213be2e628abc5a6f0ed3af5e91

Contents?: true

Size: 897 Bytes

Versions: 9

Compression:

Stored size: 897 Bytes

Contents

# frozen_string_literal: true
require 'test_helper'

class WebhookTest < Test::Unit::TestCase
  test 'create should create a webhook' do
    fake('webhooks', method: :post, status: 201, body: load_fixture('webhook'))
    webhook = ShopifyAPI::Webhook.create(
      address: "http://www.yoloship.it/webhook", topic: "orders/create", format: "json"
    )
    assert_equal("http://www.yoloship.it/webhook", webhook.address)
  end

  test 'get should retrieve a webhook' do
    fake('webhooks/123456', method: :get, status: 200, body: load_fixture('webhook'))
    webhook = ShopifyAPI::Webhook.find(123456)
    assert_equal("http://www.yoloship.it/webhook", webhook.address)
  end

  test 'find all should return all webhooks' do
    fake('webhooks', method: :get, status: 200, body: load_fixture('webhooks'))
    webhook = ShopifyAPI::Webhook.all
    assert_equal(123456, webhook.first.id)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
shopify_api-9.5.2 test/webhook_test.rb
ruby_shopify_api-1.2.0 test/webhook_test.rb
ruby_shopify_api-1.1.0 test/webhook_test.rb
ruby_shopify_api-1.0.0 test/webhook_test.rb
shopify_api-9.5.1 test/webhook_test.rb
shopify_api-9.5 test/webhook_test.rb
shopify_api-9.4.1 test/webhook_test.rb
shopify_api-9.4.0 test/webhook_test.rb
shopify_api-9.3.0 test/webhook_test.rb