Sha256: 445dda4ced6a58b07028f2c678cd17477a3722b9eb008344e65cf1c8a408b0c1

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

require_relative '../../lib/apl-library/recursive_open_struct.rb'

class RecursiveOpenStructTest < BaseModelTest
  include RecursiveOpenStruct

  context 'open struct' do
    setup do
      @invoice = {
          'id' => 'ci20130400000934',
          'invoice_date' => '2013-04-01',
          'party_id_from' => 'flipkart_india',
          'party_id_to' => 'wsretail',
          'product_items' =>
              {
                  'product_category_id' => '20210',
                  'discount_items' => [],
                  'tax_items' => [],
                  'total_amount' => '31271.66'
              },
          'total_amount' => '31271.66'
      }
    end

    should 'verify recursive object creation' do
      obj_inv = build_open_struct @invoice
      assert_equal OpenStruct, obj_inv.class
      assert_equal OpenStruct, obj_inv.product_items.class
    end
  end
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
apl-library-0.0.90 test/unit/recursive_open_struct_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/test/unit/recursive_open_struct_test.rb