Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 水豚搜索:新方法是什么?_Ruby_Rspec_Capybara - Fatal编程技术网

Ruby 水豚搜索:新方法是什么?

Ruby 水豚搜索:新方法是什么?,ruby,rspec,capybara,Ruby,Rspec,Capybara,我信任的数组搜索方法在bundle安装更新后决定中断 我的老办法: def all_find_and_click(type,data) ... all(type).each do |elem| ... elem.click if elem.text == data ... end end 给我这个 NoMethodError: undefined method `each' for #<RSpec::Matchers::BuiltIn::All:0x3

我信任的数组搜索方法在bundle安装更新后决定中断

我的老办法:

def all_find_and_click(type,data)
...
  all(type).each do |elem|
    ...
    elem.click if elem.text == data
    ...
  end
end
给我这个

 NoMethodError:
 undefined method `each' for #<RSpec::Matchers::BuiltIn::All:0x3c416e8>
 # ./spec/features/capy_support.rb:25:in `all_find_and_click'
这是我的Gemfile.lock

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.1)
  actionpack (= 4.1.1)
  actionview (= 4.1.1)
  mail (~> 2.5.4)
actionpack (4.1.1)
  actionview (= 4.1.1)
  activesupport (= 4.1.1)
  rack (~> 1.5.2)
  rack-test (~> 0.6.2)
actionview (4.1.1)
  activesupport (= 4.1.1)
  builder (~> 3.1)
  erubis (~> 2.7.0)
activemodel (4.1.1)
  activesupport (= 4.1.1)
  builder (~> 3.1)
activerecord (4.1.1)
  activemodel (= 4.1.1)
  activesupport (= 4.1.1)
  arel (~> 5.0.0)
activesupport (4.1.1)
  i18n (~> 0.6, >= 0.6.9)
  json (~> 1.7, >= 1.7.7)
  minitest (~> 5.1)
  thread_safe (~> 0.1)
  tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
builder (3.2.2)
capybara (2.3.0)
  mime-types (>= 1.16)
  nokogiri (>= 1.3.3)
  rack (>= 1.0.0)
  rack-test (>= 0.5.4)
  xpath (~> 2.0)
childprocess (0.5.3)
  ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.15)
  builder (>= 2.1.2)
  diff-lcs (>= 1.1.3)
  gherkin (~> 2.12)
  multi_json (>= 1.7.5, < 2.0)
  multi_test (>= 0.1.1)
cucumber-rails (1.4.1)
  capybara (>= 1.1.2, < 3)
  cucumber (>= 1.3.8, < 2)
  mime-types (~> 1.16)
  nokogiri (~> 1.5)
  rails (>= 3, < 5)
diff-lcs (1.2.5)
erubis (2.7.0)
ffi (1.9.3-x86-mingw32)
gherkin (2.12.2-x86-mingw32)
  multi_json (~> 1.3)
hike (1.2.3)
i18n (0.6.9)
json (1.8.1)
mail (2.5.4)
  mime-types (~> 1.16)
  treetop (~> 1.4.8)
mime-types (1.25.1)
mini_portile (0.6.0)
minitest (5.3.4)
multi_json (1.10.1)
multi_test (0.1.1)
nokogiri (1.6.2.1-x86-mingw32)
  mini_portile (= 0.6.0)
polyglot (0.3.5)
rack (1.5.2)
rack-test (0.6.2)
  rack (>= 1.0)
rails (4.1.1)
  actionmailer (= 4.1.1)
  actionpack (= 4.1.1)
  actionview (= 4.1.1)
  activemodel (= 4.1.1)
  activerecord (= 4.1.1)
  activesupport (= 4.1.1)
  bundler (>= 1.3.0, < 2.0)
  railties (= 4.1.1)
  sprockets-rails (~> 2.0)
railties (4.1.1)
  actionpack (= 4.1.1)
  activesupport (= 4.1.1)
  rake (>= 0.8.7)
  thor (>= 0.18.1, < 2.0)
rake (10.3.2)
rspec (3.0.0)
  rspec-core (~> 3.0.0)
  rspec-expectations (~> 3.0.0)
  rspec-mocks (~> 3.0.0)
rspec-core (3.0.1)
  rspec-support (~> 3.0.0)
rspec-expectations (3.0.1)
  diff-lcs (>= 1.2.0, < 2.0)
  rspec-support (~> 3.0.0)
rspec-mocks (3.0.1)
  rspec-support (~> 3.0.0)
rspec-rails (3.0.1)
  actionpack (>= 3.0)
  activesupport (>= 3.0)
  railties (>= 3.0)
  rspec-core (~> 3.0.0)
  rspec-expectations (~> 3.0.0)
  rspec-mocks (~> 3.0.0)
  rspec-support (~> 3.0.0)
rspec-support (3.0.0)
rubyzip (1.1.4)
selenium-webdriver (2.42.0)
  childprocess (>= 0.5.0)
  multi_json (~> 1.0)
  rubyzip (~> 1.0)
  websocket (~> 1.0.4)
sprockets (2.12.1)
  hike (~> 1.2)
  multi_json (~> 1.0)
  rack (~> 1.0)
  tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.1.3)
  actionpack (>= 3.0)
  activesupport (>= 3.0)
  sprockets (~> 2.8)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
  polyglot
  polyglot (>= 0.3.1)
tzinfo (1.2.1)
  thread_safe (~> 0.1)
websocket (1.0.7)
xpath (2.0.0)
  nokogiri (~> 1.3)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  capybara
  cucumber
  cucumber-rails
  rails
  rspec
  rspec-rails
  selenium-webdriver

有什么想法吗?

错误表明所有的都是rspec匹配器,而不是水豚搜索器。所以你没有得到你认为你得到的东西。你更新了什么宝石?我添加了一个多米诺宝石,我去掉了它,希望牙膏能回到管子里。我更新了这个问题并包含了我的Gemfile.lockUpdate:我找到了一个工作副本并强制执行selenium和capybara版本,得到了相同的错误。gem'capybara'、'2.2.1'、gem'selenium webdriver'、'2.39.0'您以前使用过rspec期望v3吗?他们添加了一个可能与水豚的all冲突的all方法。可能不会,让我看看是否可以回滚它
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.1)
  actionpack (= 4.1.1)
  actionview (= 4.1.1)
  mail (~> 2.5.4)
actionpack (4.1.1)
  actionview (= 4.1.1)
  activesupport (= 4.1.1)
  rack (~> 1.5.2)
  rack-test (~> 0.6.2)
actionview (4.1.1)
  activesupport (= 4.1.1)
  builder (~> 3.1)
  erubis (~> 2.7.0)
activemodel (4.1.1)
  activesupport (= 4.1.1)
  builder (~> 3.1)
activerecord (4.1.1)
  activemodel (= 4.1.1)
  activesupport (= 4.1.1)
  arel (~> 5.0.0)
activesupport (4.1.1)
  i18n (~> 0.6, >= 0.6.9)
  json (~> 1.7, >= 1.7.7)
  minitest (~> 5.1)
  thread_safe (~> 0.1)
  tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
builder (3.2.2)
capybara (2.3.0)
  mime-types (>= 1.16)
  nokogiri (>= 1.3.3)
  rack (>= 1.0.0)
  rack-test (>= 0.5.4)
  xpath (~> 2.0)
childprocess (0.5.3)
  ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.15)
  builder (>= 2.1.2)
  diff-lcs (>= 1.1.3)
  gherkin (~> 2.12)
  multi_json (>= 1.7.5, < 2.0)
  multi_test (>= 0.1.1)
cucumber-rails (1.4.1)
  capybara (>= 1.1.2, < 3)
  cucumber (>= 1.3.8, < 2)
  mime-types (~> 1.16)
  nokogiri (~> 1.5)
  rails (>= 3, < 5)
diff-lcs (1.2.5)
erubis (2.7.0)
ffi (1.9.3-x86-mingw32)
gherkin (2.12.2-x86-mingw32)
  multi_json (~> 1.3)
hike (1.2.3)
i18n (0.6.9)
json (1.8.1)
mail (2.5.4)
  mime-types (~> 1.16)
  treetop (~> 1.4.8)
mime-types (1.25.1)
mini_portile (0.6.0)
minitest (5.3.4)
multi_json (1.10.1)
multi_test (0.1.1)
nokogiri (1.6.2.1-x86-mingw32)
  mini_portile (= 0.6.0)
polyglot (0.3.5)
rack (1.5.2)
rack-test (0.6.2)
  rack (>= 1.0)
rails (4.1.1)
  actionmailer (= 4.1.1)
  actionpack (= 4.1.1)
  actionview (= 4.1.1)
  activemodel (= 4.1.1)
  activerecord (= 4.1.1)
  activesupport (= 4.1.1)
  bundler (>= 1.3.0, < 2.0)
  railties (= 4.1.1)
  sprockets-rails (~> 2.0)
railties (4.1.1)
  actionpack (= 4.1.1)
  activesupport (= 4.1.1)
  rake (>= 0.8.7)
  thor (>= 0.18.1, < 2.0)
rake (10.3.2)
rspec (3.0.0)
  rspec-core (~> 3.0.0)
  rspec-expectations (~> 3.0.0)
  rspec-mocks (~> 3.0.0)
rspec-core (3.0.1)
  rspec-support (~> 3.0.0)
rspec-expectations (3.0.1)
  diff-lcs (>= 1.2.0, < 2.0)
  rspec-support (~> 3.0.0)
rspec-mocks (3.0.1)
  rspec-support (~> 3.0.0)
rspec-rails (3.0.1)
  actionpack (>= 3.0)
  activesupport (>= 3.0)
  railties (>= 3.0)
  rspec-core (~> 3.0.0)
  rspec-expectations (~> 3.0.0)
  rspec-mocks (~> 3.0.0)
  rspec-support (~> 3.0.0)
rspec-support (3.0.0)
rubyzip (1.1.4)
selenium-webdriver (2.42.0)
  childprocess (>= 0.5.0)
  multi_json (~> 1.0)
  rubyzip (~> 1.0)
  websocket (~> 1.0.4)
sprockets (2.12.1)
  hike (~> 1.2)
  multi_json (~> 1.0)
  rack (~> 1.0)
  tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.1.3)
  actionpack (>= 3.0)
  activesupport (>= 3.0)
  sprockets (~> 2.8)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
  polyglot
  polyglot (>= 0.3.1)
tzinfo (1.2.1)
  thread_safe (~> 0.1)
websocket (1.0.7)
xpath (2.0.0)
  nokogiri (~> 1.3)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  capybara
  cucumber
  cucumber-rails
  rails
  rspec
  rspec-rails
  selenium-webdriver