如何标记用于VCR磁带的黄瓜场景概要示例?

时间:2012-08-07 22:10:23

标签: ruby ruby-on-rails-3 cucumber vcr

我想根据示例中的标签应用不同的VCR卡带。据我所知,标记黄瓜场景大纲示例是可能的,但我不能让VCR识别任何标签。这可能吗?

VCR.cucumber_tags do |t|
  t.tag '@premium-successful-payment'
  t.tag '@premium-card-declined'
end


Feature:

  Background:
    Given I am signed in 
    And I am on the premium payment page

  @javascript
  Scenario Outline: Submitting payment information
    When I fill in "Credit Card Number" with "<card_number>"
    And I fill in "Security Code" with "<security_code>"
    And I select "<expires_month>" from "credit_card_expires_month"
    And I select "<expires_year>" from "credit_card_expires_year"
    And I press "Activate Premium"
    Then I should see a payment success message

    @premium-successful-payment
    Examples:
      | card_number      | security_code | expires_month | expires_year |
      | 4242424242424242 | 123           | 6             | 2020         |

    @premium-card-declined
    Examples:
      | card_number      | security_code | expires_month | expires_year |
      | 4000000000000002 | 123           | 6             | 2020         |

1 个答案:

答案 0 :(得分:1)

github上有一个open Pull Request。我想在某个时候合并它,但我对实现有一些担忧,PR的作者还没有回复我的评论。

与此同时,您可以考虑使用可用的黄瓜钩子和VCR的VCR.insert_cassette / VCR.eject_cassette API编写自己的VCR /黄瓜整合。黄瓜融合并不是人们使用VCR与黄瓜的主要或唯一方式;这只是开始满足最常见需求的便捷方式。