Sha256: c1feba57fb39c95426b1c7347871655fa73f3750165846f5e7503e0a5b1d6203

Contents?: true

Size: 1.1 KB

Versions: 19

Compression:

Stored size: 1.1 KB

Contents

require 'test_helper'

class Kaui::PaymentMethodTest < ActiveSupport::TestCase
  fixtures :payment_methods, :plugin_infos, :plugin_info_properties

  include Kaui::PluginInfosHelperTest

  test "can serialize from json" do
    as_json = plugin_infos(:plugin_info_for_pierre)
    plugin_info = create_plugin_info(as_json)

    as_json = payment_methods(:payment_method_for_pierre)
    as_json["pluginInfo"] = plugin_info
    payment_method = Kaui::PaymentMethod.new(as_json)

    assert_equal as_json["accountId"], payment_method.account_id
    assert_equal as_json["isDefault"], payment_method.is_default
    assert_equal as_json["paymentMethodId"], payment_method.payment_method_id
    assert_equal as_json["pluginName"], payment_method.plugin_name
    @@plugin_info_keys.each_with_index do |key, i|
      assert_equal plugin_info_properies[i]["key"], payment_method.plugin_info.properties[i].key
      assert_equal plugin_info_properies[i]["value"], payment_method.plugin_info.properties[i].value
      assert_equal plugin_info_properies[i]["is_updatable"], payment_method.plugin_info.properties[i].is_updatable
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
kaui-0.2.2 test/unit/kaui/payment_method_test.rb
kaui-0.2.1 test/unit/kaui/payment_method_test.rb
kaui-0.2.0 test/unit/kaui/payment_method_test.rb
kaui-0.1.18 test/unit/kaui/payment_method_test.rb
kaui-0.1.17 test/unit/kaui/payment_method_test.rb
kaui-0.1.16 test/unit/kaui/payment_method_test.rb
kaui-0.1.15 test/unit/kaui/payment_method_test.rb
kaui-0.1.14 test/unit/kaui/payment_method_test.rb
kaui-0.1.12 test/unit/kaui/payment_method_test.rb
kaui-0.1.11 test/unit/kaui/payment_method_test.rb
kaui-0.1.10 test/unit/kaui/payment_method_test.rb
kaui-0.1.9 test/unit/kaui/payment_method_test.rb
kaui-0.1.8 test/unit/kaui/payment_method_test.rb
kaui-0.1.7 test/unit/kaui/payment_method_test.rb
kaui-0.1.6 test/unit/kaui/payment_method_test.rb
kaui-0.1.5 test/unit/kaui/payment_method_test.rb
kaui-0.1.4 test/unit/kaui/payment_method_test.rb
kaui-0.1.3 test/unit/kaui/payment_method_test.rb
kaui-0.1.2 test/unit/kaui/payment_method_test.rb