test/stripe/bitcoin_receiver_test.rb in stripe-1.19.0 vs test/stripe/bitcoin_receiver_test.rb in stripe-1.20.0

- old
+ new

@@ -32,7 +32,30 @@ receiver = Stripe::BitcoinReceiver.retrieve('btcrcv_test_receiver') @mock.expects(:get).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver/transactions", nil, nil).once.returns(test_response(test_bitcoin_transaction_array)) transactions = receiver.transactions.all assert_equal(3, transactions.data.length) end + + should "update should update a bitcoin receiver" do + @mock.expects(:get).once.returns(test_response(test_bitcoin_receiver)) + @mock.expects(:post).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, "description=details").once.returns(test_response(test_bitcoin_receiver)) + receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver) + receiver.refresh + receiver.description = "details" + receiver.save + end + + should "delete a bitcoin receiver with no customer through top-level API" do + @mock.expects(:delete).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, nil).once.returns(test_response({:deleted => true, :id => "btcrcv_test_receiver"})) + receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver) + response = receiver.delete + assert(receiver.deleted) + end + + should "delete a bitcoin receiver with a customer through customer's subresource API" do + @mock.expects(:delete).with("#{Stripe.api_base}/v1/customers/customer_foo/sources/btcrcv_test_receiver", nil, nil).once.returns(test_response({:deleted => true, :id => "btcrcv_test_receiver"})) + receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver(:customer => 'customer_foo')) + response = receiver.delete + assert(receiver.deleted) + end end end