Sha256: c0f0280bfeaeec19abce7ab25f69e03939c1b81f30d5f9ef9ff7bceb4e68f4cc

Contents?: true

Size: 1.18 KB

Versions: 13

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path('../../test_helper', __FILE__)

module Payjp
  class CustomerTest < Test::Unit::TestCase
    should "customers should be listable" do
      @mock.expects(:get).once.returns(test_response(test_customer_array))
      c = Payjp::Customer.all.data
      assert c.is_a? Array
      assert c[0].is_a? Payjp::Customer
    end

    should "customers should be deletable" do
      @mock.expects(:delete).once.returns(test_response(test_customer({ :deleted => true })))
      c = Payjp::Customer.new("test_customer")
      c.delete
      assert c.deleted
    end

    should "customers should be updateable" do
      @mock.expects(:get).once.returns(test_response(test_customer({ :mnemonic => "foo" })))
      @mock.expects(:post).once.returns(test_response(test_customer({ :mnemonic => "bar" })))
      c = Payjp::Customer.new("test_customer").refresh
      assert_equal "foo", c.mnemonic
      c.mnemonic = "bar"
      c.save
      assert_equal "bar", c.mnemonic
    end

    should "create should return a new customer" do
      @mock.expects(:post).once.returns(test_response(test_customer))
      c = Payjp::Customer.create
      assert_equal "c_test_customer", c.id
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
payjp-0.0.16 test/payjp/customer_test.rb
payjp-0.0.14 test/payjp/customer_test.rb
payjp-0.0.13 test/payjp/customer_test.rb
payjp-0.0.12 test/payjp/customer_test.rb
payjp-0.0.10 test/payjp/customer_test.rb
payjp-0.0.9 test/payjp/customer_test.rb
payjp-0.0.8 test/payjp/customer_test.rb
payjp-0.0.7 test/payjp/customer_test.rb
payjp-0.0.6 test/payjp/customer_test.rb
payjp-0.0.5 test/payjp/customer_test.rb
payjp-0.0.4 test/payjp/customer_test.rb
payjp-0.0.3 test/payjp/customer_test.rb
payjp-0.0.2 test/payjp/customer_test.rb