我在使用黃瓜時遇到了一些問題。如何讓黃瓜獲得javascript?
這裏是我的樹狀
-- app1
|-- features
| |-- addition.feature
| |-- step_definitions
| `-- support
| `-- env.js
|-- public
| `-- javascripts
| |-- Player.js
| `-- Song.js
|-- Rakefile
`-- spec
`-- javascripts
|-- helpers
| `-- SpecHelper.js
|-- PlayerSpec.js
`-- support
|-- jasmine_config.rb
|-- jasmine_runner.rb
`-- jasmine.yml
這裏是我的文件 「addition.feature」
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When press add
Then the result should be 120 on the screen
當我運行
黃瓜功能/ addition.feature
我得到
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers # features/addition.feature:6
Given I have entered 50 into the calculator # features/addition.feature:7
And I have entered 70 into the calculator # features/addition.feature:8
When press add # features/addition.feature:9
Then the result should be 120 on the screen # features/addition.feature:10
1 scenario (1 undefined)
4 steps (4 undefined)
0m0.003s
You can implement step definitions for undefined steps with these snippets:
Given /^I have entered (\d+) into the calculator$/ do |arg1|
pending # express the regexp above with the code you wish you had
end
When /^press add$/ do
pending # express the regexp above with the code you wish you had
end
Then /^the result should be (\d+) on the screen$/ 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.
爲什麼在Ruby語言的輸出,我是不應該得到的JavaScript,考慮到我在‘支持/’目錄「的.js」文件?
我發現解決方案,寶石「therubyracer」失蹤。 謝謝邁克爾科佩爾 – michaelSc