Sha256: 0c2458295017a07ce1a3607640ab3c2ad6b5a6086becac9b0d0bc72d07d2ead2
Contents?: true
Size: 939 Bytes
Versions: 25
Compression:
Stored size: 939 Bytes
Contents
# -*- coding: utf-8 -*- require File.expand_path('../../test_helper', __FILE__) module Stripe class ApiOperationsTest < Test::Unit::TestCase class UpdateableResource < APIResource include Stripe::APIOperations::Save def self.protected_fields [:protected] end end context ".update" do should "post the correct parameters to the resource URL" do stub_request(:post, "#{Stripe.api_base}/v1/updateableresources/id"). with(body: { foo: "bar" }). to_return(body: JSON.generate({ foo: "bar" })) resource = UpdateableResource::update("id", { foo: "bar" }) assert_equal('bar', resource.foo) end should "error on protected fields" do e = assert_raises do UpdateableResource::update("id", { protected: "bar" }) end assert_equal "Cannot update protected field: protected", e.message end end end end
Version data entries
25 entries across 25 versions & 1 rubygems