2012-08-28 45 views
0

我有以下有趣的场景:水豚 - 覆盖值

测试系统,在我的情况ActiveMerchant的BogusGateway需要一个“假”式的信用卡,以便有效。当然,这不是我向用户展示的选项之一。

在我的请求规范中,我试图用“伪造”来覆盖签证原始值,但我不清楚它是如何完成的。我试过类似的东西,但没有luck:

# setting the value for the visa card to be 'bogus' 
find(:xpath, "//input[@id='billing_account_card_type_visa']").set "bogus" 

# then clicking on the radio button... 
choose "billing_account_card_type_visa" 

任何帮助将不胜感激。

回答

2

如果用户不能选择该选项时,水豚应该怎么办呢?

而是模仿不能执行的用户动作,才使具有无效的请求参数:

post "/my_billing_path", :billing_account => { :card_type => "bogus }

0

您可以只使用水豚的fill_inchoose方法:

fill_in("billing_acount_card_type_visa", :with => "bogus") 
choose("billing_account_card_type_visa") 
+0

我相信这是行不通的,因为FILL_IN方法仅适用于文本字段/地区。这里我们正在处理单选按钮,因此使用“选择”方法。 – alexs333

+0

哦,我明白了。不确定的话,也许@ zetetic的答案会有所帮助。 –

0

请使用下列号码通过验证来获得并使用测试交易成功水豚和伪造网关:

  • VISA = 4111111111111111
  • MASTERCARD = 5500000000000004
  • AMEX = 340000000000009
  • DISCOVERY = 6011000000000004