尝试让save_and_open_page完全起作用会给我以下错误:

1) index page my first test
 Failure/Error: save_and_open_page
 Launchy::ApplicationNotFoundError:
   No application found to handle 'C:/Sites/Sublist_v2/tmp/capybara/capybara-201304211638563116158687.html'
 # ./spec/features/comics_page_spec.rb:6:in `block (2 levels) in <top (required)>'

规范:
require 'spec_helper'

feature 'index page' do
  scenario "my first test" do
    visit root_path
    save_and_open_page
    # Launchy.open('http://stackoverflow.com')
  end
end

如果我取消对Launchy行的注释,它就可以正常工作,所以我不确定是什么问题……可能是c:/路径有问题吗?
Gemfile
group :development, :test do
  gem 'spork-rails'
  gem 'rspec-rails'
  gem 'factory_girl_rails'
end

group :test do
  gem 'faker'
  gem 'capybara'
  gem 'launchy'
  gem 'database_cleaner'
  gem 'shoulda-matchers'
end

最佳答案

这是因为文件路径中的驱动器号被错误地确定为uri方案的一部分。

您可以通过在/launchy/lib/launchy/applications/browser.rb中从以下位置更改第12行来临时修复它:
return true if File.exist?( uri.path ) and uri.scheme.nil?

return true if File.exist?( uri.path ) && !schemes.include?( uri.scheme )

关于ruby-on-rails - Launchy::ApplicationNotFoundError:,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16137410/

10-13 04:44