我使用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