Sha256: c7c713dfa3f62871d0d52399ec6c13b54ca6e52f44a638090cfa4646d717ec3e

Contents?: true

Size: 941 Bytes

Versions: 3

Compression:

Stored size: 941 Bytes

Contents

require 'helper'
require 'peddler/structured_list'

class PeddlerStructuredListTest < 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

3 entries across 3 versions & 1 rubygems

Version Path
peddler-0.8.0 test/unit/peddler/test_structured_list.rb
peddler-0.7.11 test/unit/peddler/test_structured_list.rb
peddler-0.7.10 test/unit/peddler/test_structured_list.rb