Sha256: 62b09319ee4b0d28342285266b513c1e37b71866a59b867a0e93aaa9d8f567d4

Contents?: true

Size: 946 Bytes

Versions: 11

Compression:

Stored size: 946 Bytes

Contents

require 'test_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

11 entries across 11 versions & 1 rubygems

Version Path
peddler-0.12.5 test/unit/peddler/test_structured_list.rb
peddler-0.12.4 test/unit/peddler/test_structured_list.rb
peddler-0.12.2 test/unit/peddler/test_structured_list.rb
peddler-0.12.1 test/unit/peddler/test_structured_list.rb
peddler-0.12.0 test/unit/peddler/test_structured_list.rb
peddler-0.11.1 test/unit/peddler/test_structured_list.rb
peddler-0.11.0 test/unit/peddler/test_structured_list.rb
peddler-0.10.0 test/unit/peddler/test_structured_list.rb
peddler-0.9.2 test/unit/peddler/test_structured_list.rb
peddler-0.9.1 test/unit/peddler/test_structured_list.rb
peddler-0.9.0 test/unit/peddler/test_structured_list.rb