ruby: 使用规范进行测试时给出的最小写入设置

ruby: minimal setup for writing given when then tests with spec

我 ruby 在 ruby(不是 rails)

中进行测试

我有一个名为 infrastrucure 的空文件夹。它有一个名为 spec 的文件夹。 其中有一个名为 features 的文件夹。在那里,我有一个名为 foo 的功能,它是这样的:

~/gray/infrastructure (master *)[]$ cat spec/features/foo.feature 
Scenario: View last incidents
  Given Linda is logged in # This will in fact invoke 2 step definitions
  When I go to the incident page

当我运行 spec 命令时,功能文件被忽略。 我错过了什么?

仅供参考,这是我的 gem 环境:

~/gray/infrastructure (master *)[]$ rvm-prompt
ruby-2.3.0-preview1@infrastructure
~/gray/infrastructure (master *)[]$ gem list

*** LOCAL GEMS ***

bigdecimal (1.2.7)
builder (3.2.2)
bundler-unload (1.0.2)
cucumber (2.3.2)
cucumber-core (1.4.0)
cucumber-wire (0.0.1)
did_you_mean (1.0.0.beta3)
diff-lcs (1.2.5)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
gherkin (3.2.0)
io-console (0.4.3)
json (1.8.2)
minitest (5.8.2)
multi_json (1.11.2)
multi_test (0.1.2)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (2.0.14)
rake (10.4.2)
rdoc (4.2.0)
rspec (3.4.0)
rspec-core (3.4.4)
rspec-expectations (3.4.0)
rspec-mocks (3.4.1)
rspec-support (3.4.1)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.1.5)

您编写的是 Cucumber 功能,而不是 RSpec 功能测试。 Cucumber 功能应该在一个名为 features 的文件夹中,与您的 spec 文件夹处于同一级别。他们是 运行 而 cucumber 而不是 spec