背景
PaymentProvider类和规范,如下所示.题
如何使测试付款失败?(例如,卡被拒绝,或者卡在未来的订阅付款中过期)
Stripe会让我使用特殊的卡号进行此操作,但Paymill 似乎没有任何此类文档(英文).
payment_provider.rb
class PaymentProvider
Paymill.api_key = ENV['PAYMILL_PRIVATE_KEY']
def self.start_new_subscription(email, description, token)
offer = Paymill::Offer.find(ENV['PAYMILL_OFFER_ID'])
client = Paymill::Client.create(email: email, description: description)
payment = Paymill::Payment.create(token: token, client: client.id)
subscription = Paymill::Subscription.create(client: client.id, offer: offer.id, payment: payment.id)
subscription.id
end
end
Run Code Online (Sandbox Code Playgroud)
require 'spec_helper'
describe PaymentProvider do
describe "#start_new_subscription" do
it "returns a subscription id, starting 'sub_' when successful" do
email = "mike@mike.com"
description = "me"
token = get_payment_token …Run Code Online (Sandbox Code Playgroud) 我有两个不同的应用程序共享相同的数据库.问题是当我有一个应用程序在数据库中更改某些内容时,另一个不会更新.
我试图做一个,session.flush()但它没有用.唯一的方法是关闭整个会话并重新创建它,但当然,这需要太长时间.
以下是我在CentOS机器上的Catalina.out文件中输入的唯一条目.我正在使用Spring 3和我的应用程序运行Tomcat 6.有很多这样的,所以我选择了一些不断重复的东西.这不会一直发生,但每周至少发生一次.
Feb 3, 2011 2:37:48 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Feb 3, 2011 2:37:48 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [com.iteezy.shared.domain.DirEntry.data] but has failed to stop it. This is very likely to create a memory leak.
Feb …Run Code Online (Sandbox Code Playgroud) 如何以编程方式实现相同的结果(如下面的注释将实现)?或者在弹簧配置文件中注入值'SMITH'?
@Filter(name="smithFilter", condition="LAST_NAME = 'SMITH'")
public String getLastName()
{
return this.lastName;
}
Run Code Online (Sandbox Code Playgroud)