Sha256: 0f47a06186de9cf0596eed7e1ab323632139ffa1d08896ee44667bd8b19b287d

Contents?: true

Size: 1.34 KB

Versions: 9

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true
require 'test_helper'

class ScriptTagTest < Test::Unit::TestCase
  test "get all should get all script tags" do
    fake('script_tags', method: :get, status: 200, body: load_fixture('script_tags'))
    script_tags = ShopifyAPI::ScriptTag.all
    assert_equal("http://js-aplenty.com/bar.js", script_tags.first.src)
  end

  test "get should get a script tag" do
    fake('script_tags/421379493', method: :get, status: 200, body: load_fixture('script_tag'))
    script_tag = ShopifyAPI::ScriptTag.find(421379493)
    assert_equal("http://js-aplenty.com/bar.js", script_tag.src)
  end

  test "create should create a new script tag" do
    fake('script_tags', method: :post, status: 201, body: load_fixture('script_tag'))
    script_tag = ShopifyAPI::ScriptTag.create(event: "onload", src: "http://js-aplenty.com/bar.js")
    assert_equal("http://js-aplenty.com/bar.js", script_tag.src)
  end

  test "editing script tag should update script tag" do
    fake('script_tags/421379493', method: :get, status: 200, body: load_fixture('script_tag'))
    script_tag = ShopifyAPI::ScriptTag.find(421379493)
    script_tag.src = "http://js-aplenty.com/bar.js"
    fake('script_tags/421379493', method: :put, status: 200, body: load_fixture('script_tag'))
    script_tag.save
    assert_equal("http://js-aplenty.com/bar.js", script_tag.src)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

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