Sha256: ac4776c383b87f7114802c20624dd9b7320f7cb057dd8c95a6cf0fb0fd4a26ca

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 KB

Contents

require 'minitest/autorun'
require_relative './common_setup_and_teardown.rb'

class TagsTest < Minitest::Test
  include CommonSetupAndTeardown

  def setup
    @tag_1 = {
      code: 'test_code',
      name: 'テストタグ',
      sort_no: 10_000,
      tag_group_code: 'DEFAULT',
      start_ymd: '2016-01-01',
      finish_ymd: '2016-12-31'
    }
    super("tags")
  end

  def test_create_tag
    tag = @api.create_tag(@tag_1)
    assert_equal 200, tag[:status].to_i, tag.inspect
    assert_equal @tag_1[:code], tag[:json][:code]
  end

  def test_update_tag
    tag = @api.create_tag(@tag_1)
    assert tag[:json][:id], tag
    options = {
      name: '更新タグ'
    }

    updated_tag = @api.update_tag(tag[:json][:id], options)
    assert_equal 200, updated_tag[:status].to_i, updated_tag.inspect
    assert_equal options[:name], updated_tag[:json][:name]
  end

  def test_list_tags
    tag = @api.create_tag(@tag_1)

    tags = @api.list_tags
    assert_equal 200, tags[:status].to_i, tags.inspect
    assert(tags[:json][@tag_1[:tag_group_code].to_sym].any? { |x| x[:id] == tag[:json][:id] })
  end

  def test_show_tag
    tag = @api.create_tag(@tag_1)
    tag = @api.show_tag(tag[:json][:id])

    assert_equal 200, tag[:status].to_i, tag.inspect
    assert_equal @tag_1[:name], tag[:json][:name]
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tsubaiso-sdk-1.2.17 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.16 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.15 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.14 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.13 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.12 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.11 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.10 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.9 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.8 test/tsubaiso_sdk/test_tag.rb
tsubaiso-sdk-1.2.7 test/tsubaiso_sdk/test_tag.rb