0

I have got rails 3 in action book, in chapter two

Feature: My Account
  In order to manage my account
  As a money minder
  I want to ensure my money doesn't get lost

Scenario: Taking out money
  Given I have an account
  And it has a balance of 100
  When I take 10
  Then my balance should be 90 

In terminal I have got this:

➜  accounts  cucumber features
Feature: My Account
  In order to manage my account
  As a money minder
  I want to ensure my money doesn't get lost

  Scenario: Taking out money     # features/account.feature:6
    Given I have an account      # features/account.feature:7
    And it has a balance of 100  # features/account.feature:8
    When I take 10               # features/account.feature:9
    Then my balance should be 90 # features/account.feature:10

1 scenario (1 undefined)
4 steps (4 undefined)
0m0.002s

You can implement step definitions for undefined steps with these snippets:

Given(/^I have an account$/) do
  pending # express the regexp above with the code you wish you had
end

Given(/^it has a balance of (\d+)$/) do |arg1|
  pending # express the regexp above with the code you wish you had
end

When(/^I take (\d+)$/) do |arg1|
  pending # express the regexp above with the code you wish you had
end

Then(/^my balance should be (\d+)$/) do |arg1|
  pending # express the regexp above with the code you wish you had
end

If you want snippets in a different programming language,
just make sure a file with the appropriate file extension
exists where cucumber looks for step definitions.

I am on

 Rails -v 3.2.12
Ruby -v 1.9.3
cucumber (1.3.2)
cucumber-rails (1.2.1)

What should i do then ? also the book is using cucmber in the next chapters.

Its first time for me using cucumber so i need an explanation , i have searched on google and found an article but i didn't get the point from it , i wish i could find an easier explanation

4

1 に答える 1

0

blog.codeship.ioのTesting Tuesdayシリーズ、特に次の 2 つのスクリーン キャストをご覧ください。

http://blog.codeship.io/2013/04/30/bdd-with-cucumber.html

http://blog.codeship.io/2013/05/07/testing-tuesday-4-continuous-integration-and-deployment-with-cucumber.html

どちらも、あなたが望むことを段階的に説明しています。

于 2013-08-26T15:43:00.343 に答える