$ruby --version
ruby 1.9.3dev (2011-09-23 revision 33323) [i686-linux]
gem 'rails', '3.2.9'
group :test do
gem 'cucumber-rails', require: false
gem 'capybara', '~> 2.0.3'
gem 'rspec-rails'
gem 'database_cleaner'
gem 'factory_girl'
gem "ffaker"
gem "capybara-firebug", "~> 1.3.0"
gem 'ruby-debug19'
end
以我黃瓜步驟之一我試圖斷言下拉元件 (<選擇>標籤)具有使用水豚API 與選定的特定選項的下拉下面的代碼。水豚斷言具有選擇所希望的值不工作
within('#myForm') do
page.has_select?("#event_type", selected: @event_type).should be_true
end
但是我得到這個錯誤:
expected: true value
got: false (RSpec::Expectations::ExpectationNotMetError)
我使用@firebug對我的方案 (水豚,螢火)的標籤檢查DOM和發現所需的選項(通過舉行@event_type)是越來越選擇在「選擇」屬性沒有得到 添加到選擇的標籤,我猜的DOM然而下拉 導致的預期失敗。
我發現了一個類似的參考這裏:https://github.com/jnicklas/capybara/issues/171 其中提到關於提交具有修復,但我猜承諾不 合併的水豚版本我using.I試圖在源代碼中 挖掘和發現在水豚的代碼庫中不存在在https://github.com/jnicklas/capybara/issues/171 中提到的修復程序。
任何機構可以請讓我知道如何斷言一個選擇標記有選擇 特定的選項?
注意:當我在寶石文件中使用水豚沒有任何版本:
gem 'capybara'
水豚版本2.1.0開始進行安裝但它失敗,錯誤:
capybara requires Ruby version >= 1.9.3
雖然我有所需的紅寶石版本。
以下是
$ rvm info
ruby-1.9.3-rc1:
system:
uname: "Linux jigneshgohel-Inspiron-N5110 3.2.0-40-generic-pae #64-Ubuntu SMP Mon Mar 25 21:44:41 UTC 2013 i686 i686 i386 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.13.4 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
updated: "11 months 4 days 14 hours 20 minutes 18 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3dev"
date: "2011-09-23"
platform: "i686-linux"
patchlevel: "2011-09-23 revision 33323"
full_version: "ruby 1.9.3dev (2011-09-23 revision 33323) [i686-linux]"
homes:
gem: "/home/jigneshgohel/.rvm/gems/ruby-1.9.3-rc1"
ruby: "/home/jigneshgohel/.rvm/rubies/ruby-1.9.3-rc1"
binaries:
ruby: "/home/jigneshgohel/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby"
irb: "/home/jigneshgohel/.rvm/rubies/ruby-1.9.3-rc1/bin/irb"
gem: "/home/jigneshgohel/.rvm/rubies/ruby-1.9.3-rc1/bin/gem"
rake: "/home/jigneshgohel/.rvm/gems/ruby-1.9.3-rc1/bin/rake"
environment:
PATH: "/home/jigneshgohel/.rvm/gems/ruby-1.9.3-rc1/bin:/home/jigneshgohel/.rvm/gems/[email protected]/bin:/home/jigneshgohel/.rvm/rubies/ruby-1.9.3-rc1/bin:/home/jigneshgohel/.rvm/bin:/usr/local/heroku/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/media/work/Environment/Languages/Java/jdk1.7.0_04/bin:/media/work/Environment/BuildTools/apache-maven-3.0.4/bin:/media/work/Environment/BuildTools/apache-ant-1.8.3/bin"
GEM_HOME: "/home/jigneshgohel/.rvm/gems/ruby-1.9.3-rc1"
GEM_PATH: "/home/jigneshgohel/.rvm/gems/ruby-1.9.3-rc1:/home/jigneshgohel/.rvm/gems/[email protected]"
MY_RUBY_HOME: "/home/jigneshgohel/.rvm/rubies/ruby-1.9.3-rc1"
IRBRC: "/home/jigneshgohel/.rvm/rubies/ruby-1.9.3-rc1/.irbrc"
RUBYOPT: ""
gemset: "
繼輸出的輸出:
$rvm list
rvm rubies
=* ruby-1.9.3-rc1 [ i686 ]
# => - current
# =* - current && default
# * - default