我使用gem bundler(v.0.9.6)和Rails 2.3.5,rubygems 1.3.6和ruby 1.8.7(在Snow上豹)。我的Gemfile看起来像这样:Selenium模式下的黄瓜和WebRat:使用gem包时无法启动mongrel_rails
source :rubyforge
source "http://gems.github.com"
gem "rails", "2.3.5"
gem "ruby-debug"
gem "activemerchant", :require => 'active_merchant'
gem "hpricot"
gem "nokogiri"
gem "state_machine"
gem "fastercsv"
gem "yubikey"
gem "httparty"
gem "ruby-openid"
gem "mongrel"
group :development do
gem 'mongrel'
end
#teste
group :test do
gem 'rspec'
gem 'rspec-rails'
gem 'cucumber'
gem 'cucumber-rails'
gem "mechanize"
gem 'notahat-machinist', :require => 'machinist'
gem 'faker'
gem 'webrat'
gem 'selenium-client'
gem 'database_cleaner'
gem 'fakeweb'
gem 'mongrel' #Selenium needs this
end
到目前为止好。我已经成功使用捆绑器几个星期了。然而,我开始在Selenium模式下使用Cucumber和WebRat来测试站点的一些ajaxy特性,并且每当我运行该功能时,WebRat都告诉我Rails服务器已启动,但我总是得到一个XHR_ERROR,Selenium不能找不到网址。 嗯,它发生了服务器没有启动。
于是,我打开webrat/lib中/ webrat /硒/ application_servers/rails.rb文件,并把一个调试器语句启动方法。再次运行功能,当调试器触发,我打印的START_COMMAND返回闪避,这是:
mongrel_rails start -d --chdir='/Users/fullofcaffeine/Projetos/myproject' --port=3001 --environment=test --pid /Users/fullofcaffeine/Projetos/myproject/tmp/pids/mongrel_selenium.pid
我复制并在控制台贴吧,删除从最终-d和&,这里的我得到的输出:
** Rails loaded.
** Loading any Rails specific GemPlugins
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require': no such file to load -- /Users/fullofcaffeine/.bundle/ruby/1.8/gems/mongrel-1.1.5/lib/mongrel/init.rb (MissingSourceFile)
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:134:in `load'
from /Library/Ruby/Site/1.8/rubygems/source_index.rb:241:in `each'
from /Library/Ruby/Site/1.8/rubygems/source_index.rb:241:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112:in `load'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:231:in `load_plugins'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:117:in `cloaker_'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `call'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `listener'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `call'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `initialize'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
from /usr/bin/mongrel_rails:19:in `load'
from /usr/bin/mongrel_rails:19
检查它试图加载从杂种的路径:“〜/ .bundle/...”,但杂种安装为系统的宝石。 Bundle处理系统宝石的加载在其他情况下罚款,但在这种特殊情况下,我不知道为什么它是失败:(。
我试着再次运行“捆绑安装”,它总是说:
从系统安装杂种(1.1.5) 宝石
我试图从系统中卸载杂种来尽量让捆在〜/ .bundle安装(因为这似乎是错误的来源,因为杂种是在这条路上搜索ing我开始像上面的mongrel_rails),但我无法做到这一点。
gem uninstall mongrel
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d mongrel`
当我运行 “宝石名单| grep的杂种”,我得到:
mongrel (1.1.5)
奇怪。
我只是希望能够在使用gem bundler的同时成功运行Cucumber和WebRat + Selenium,但是这使我疯狂。
任何人都可以启发我吗?
你能否确认这个变通方法是否加载所有从包钢轨的宝石?或者做杂种和所有积极的*宝石结束从系统gemenv加载? – tribalvibes 2010-10-07 00:10:51