Sha256: d5dbfd87396ae6621d59ad7c3e5799b65fb6732abbebac8c818353e2edf0beec

Contents?: true

Size: 876 Bytes

Versions: 62

Compression:

Stored size: 876 Bytes

Contents

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

62 entries across 62 versions & 1 rubygems

Version Path
shopify_api-9.2.0 test/webhook_test.rb
shopify_api-9.1.0 test/webhook_test.rb
shopify_api-9.0.4 test/webhook_test.rb
shopify_api-9.0.3 test/webhook_test.rb
shopify_api-9.0.2 test/webhook_test.rb
shopify_api-9.0.1 test/webhook_test.rb
shopify_api-9.0.0 test/webhook_test.rb
shopify_api-8.1.0 test/webhook_test.rb
shopify_api-8.0.0 test/webhook_test.rb
shopify_api-7.1.0 test/webhook_test.rb
shopify_api-7.0.2 test/webhook_test.rb
shopify_api-7.0.1 test/webhook_test.rb
shopify_api-7.0.0 test/webhook_test.rb
shopify_api-6.0.0 test/webhook_test.rb
shopify_api-5.2.4 test/webhook_test.rb
shopify_api-5.2.3 test/webhook_test.rb
shopify_api-5.2.2 test/webhook_test.rb
shopify_api-5.2.1 test/webhook_test.rb
shopify_api-5.2.0 test/webhook_test.rb
shopify_api-5.1.0 test/webhook_test.rb