Sha256: c647f27088bf4afcc5b51c51d2744613c7c78baa90185d876898b750696cb33b

Contents?: true

Size: 941 Bytes

Versions: 16

Compression:

Stored size: 941 Bytes

Contents

require 'helper'
require 'peddler/structured_list'

class TestPeddlerStructuredList < MiniTest::Test
  def setup
    @list = Peddler::StructuredList.new('OrderStatus', 'Status')
  end

  def test_builds_a_structured_list_for_a_single_value
    exp = { 'OrderStatus.Status.1' => 'foo' }
    assert_equal exp, @list.build('foo')
  end

  def test_builds_a_structured_list_for_an_array_of_values
    exp = { 'OrderStatus.Status.1' => 'foo', 'OrderStatus.Status.2' => 'bar' }
    assert_equal exp, @list.build(%w(foo bar))
  end

  def test_handles_single_key
    list = Peddler::StructuredList.new('Foo')
    exp = { 'Foo.1' => 'bar' }

    assert_equal exp, list.build('bar')
  end

  def test_handles_more_than_two_keys
    list = Peddler::StructuredList.new('QueryList', 'Query', '1', 'FilterOptions', 'FilterOption')
    exp = { 'QueryList.Query.1.FilterOptions.FilterOption.1' => 'foo' }

    assert_equal exp, list.build('foo')
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
peddler-1.3.0 test/unit/peddler/test_structured_list.rb
peddler-1.2.0 test/unit/peddler/test_structured_list.rb
peddler-1.1.1 test/unit/peddler/test_structured_list.rb
peddler-1.1.0 test/unit/peddler/test_structured_list.rb
peddler-1.0.2 test/unit/peddler/test_structured_list.rb
peddler-1.0.1 test/unit/peddler/test_structured_list.rb
peddler-1.0.0 test/unit/peddler/test_structured_list.rb
peddler-0.19.0 test/unit/peddler/test_structured_list.rb
peddler-0.18.0 test/unit/peddler/test_structured_list.rb
peddler-0.17.1 test/unit/peddler/test_structured_list.rb
peddler-0.17.0 test/unit/peddler/test_structured_list.rb
peddler-0.16.0 test/unit/peddler/test_structured_list.rb
peddler-0.15.0 test/unit/peddler/test_structured_list.rb
peddler-0.14.0 test/unit/peddler/test_structured_list.rb
peddler-0.13.0 test/unit/peddler/test_structured_list.rb
peddler-0.12.7 test/unit/peddler/test_structured_list.rb