我最近将操作系统更新为ELcaptain,因为我的功能文件失败而且没有识别对象。
这是我运行文件时在终端中遇到的错误:
cannot load such file -- rspec (LoadError)
/Users/xyz/.rvm/rubies/ruby-2.1.6/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `require'
/Users/xyz/.rvm/rubies/ruby-2.1.6/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
/Users/xyz/.rvm/rubies/ruby-2.1.6/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in `require'
/Users/xyz/ttv-cucumber/helper/auto_loader.rb:14:in `<top (required)>'
/Users/xyz/ttv-cucumber/flow-combo-selection/features/support/common.rb:1:in `require_relative'
/Users/xyzr/ttv-cucumber/flow-combo-selection/features/support/common.rb:1:in `<top (required)>'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/rb_support/rb_language.rb:99:in `load'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/rb_support/rb_language.rb:99:in `load_code_file'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/runtime/support_code.rb:232:in `load_file'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/runtime/support_code.rb:99:in `block in load_files!'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/runtime/support_code.rb:98:in `each'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/runtime/support_code.rb:98:in `load_files!'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/runtime.rb:262:in `load_step_definitions'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/runtime.rb:65:in `run!'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/lib/cucumber/cli/main.rb:32:in `execute!'
/Users/xyz/.rvm/gems/ruby-2.1.6/gems/cucumber-2.1.0/bin/cucumber:8:in `<top (required)>'
/Users/xyz/.rvm/gems/ruby-2.1.6/bin/cucumber:23:in `load'
/Users/xyz/.rvm/gems/ruby-2.1.6/bin/cucumber:23:in `<main>'
/Users/xyz/.rvm/gems/ruby-2.1.6/bin/ruby_executable_hooks:15:in `eval'
/Users/xyz/.rvm/gems/ruby-2.1.6/bin/ruby_executable_hooks:15:in `<main>'
在步骤定义中,我收到此错误:
undefined method `expect' for #<Object:0x007fb6b1d1ac80> (NoMethodError)
这是我的宝石清单:
appium_lib (8.0.0, 4.1.0)
awesome_print (1.6.1)
bigdecimal (1.2.7, 1.2.4)
blankslate (3.1.3, 2.1.2.4)
builder (3.2.2)
bundler-unload (1.0.2)
childprocess (0.5.8, 0.5.6)
chunky_png (1.3.5, 1.3.4)
coderay (1.1.0)
cucumber (2.0.0)
cucumber-core (1.3.0, 1.1.3)
diff-lcs (1.2.5)
executable-hooks (1.3.2)
ffi (1.9.10, 1.9.8)
gem-wrappers (1.2.7)
gherkin (2.12.2)
gherkin3 (3.1.2)
io-console (0.4.3)
jar_wrapper (0.1.8)
json (1.8.3, 1.8.1)
method_source (0.8.2)
mini_portile (0.6.2)
minitest (5.8.2, 4.7.5)
multi_json (1.11.1)
multi_test (0.1.2)
nokogiri (1.6.6.2)
parslet (1.5.0)
power_assert (0.2.6)
pry (0.10.1)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
rmagick (2.15.2)
rspec (3.3.0)
rspec-core (3.3.0)
rspec-expectations (3.3.0)
rspec-mocks (3.3.0)
rspec-support (3.3.0)
rubygems-bundler (1.4.4)
rubytest (0.8.1)
rubyzip (1.1.7)
rvm (1.11.3.9)
selenium (0.2.11)
selenium-cucumber (2.1.3)
selenium-webdriver (2.45.0)
slop (3.6.0)
test (1.0.0)
test-unit (2.1.6.0)
toml (0.1.2)
websocket (1.2.2)
zip (2.0.2)
答案 0 :(得分:0)
如果你还没有,请试试这个:
运行bundle install
如果spec目录中没有spec helper或rails helper,请运行:rails generate rspec:install