Ruby on rails Launchy::ApplicationNotFoundError:

Ruby on rails Launchy::ApplicationNotFoundError:,ruby-on-rails,rspec,capybara,integration-testing,Ruby On Rails,Rspec,Capybara,Integration Testing,试图让save_和\u open_页面正常工作会出现以下错误: 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/f

试图让
save_和\u open_页面
正常工作会出现以下错误:

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)>'
如果我取消对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

我是Launchy的作者,刚刚得知这个问题。我通常通过GitHub修复bug,并将此问题放在那里

任何时候当您遇到Launchy问题时,请打开Launchy并进行调试

通过设置环境变量
launchy\u DEBUG=true
,可以启用启动调试。您可以从shell中执行此操作,如果要在应用程序中嵌入launchy,也可以通过ruby代码执行此操作

% export LAUNCHY_DEBUG=true
% launchy http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror
AUNCHY_DEBUG: URI parsing pass 1 : http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror -> {:scheme=>"http", :user=>nil, :password=>nil, :host=>"stackoverflow.com", :port=>nil, :path=>"/questions/16137410/launchyapplicationnotfounderror", :query=>nil, :fragment=>nil}
LAUNCHY_DEBUG: Checking if class Launchy::Application::Browser is the one for handles?(http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(darwin12.2.0)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Darwin is the one for matches?(darwin12.2.0)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::RubyEngine::Mri is the one for is_current_engine?(ruby)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(darwin12.2.0)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Darwin is the one for matches?(darwin12.2.0)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::RubyEngine::Mri is the one for is_current_engine?(ruby)}
LAUNCHY_DEBUG: Launchy::Application : found executable /usr/bin/open
LAUNCHY_DEBUG: Launchy::Application::Browser : possibility : /usr/bin/open
LAUNCHY_DEBUG: Launchy::Application::Browser : Using browser value '/usr/bin/open'
LAUNCHY_DEBUG: wet_run: before exec in child process
LAUNCHY_DEBUG: commandline_normalized => /usr/bin/open http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror
或者,如果您正在嵌入launchy:

% irb
>> require 'launchy'
>> ENV['LAUNCHY_DEBUG']="true"
>> Launchy.open( "http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror" )
LAUNCHY_DEBUG: URI parsing pass 1 : http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror -> {:scheme=>"http", :user=>nil, :password=>nil, :host=>"stackoverflow.com", :port=>nil, :path=>"/questions/16137410/launchyapplicationnotfounderror", :query=>nil, :fragment=>nil}
LAUNCHY_DEBUG: Checking if class Launchy::Application::Browser is the one for handles?(http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(darwin12.2.0)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Darwin is the one for matches?(darwin12.2.0)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::RubyEngine::Mri is the one for is_current_engine?(ruby)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(darwin12.2.0)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Darwin is the one for matches?(darwin12.2.0)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::RubyEngine::Mri is the one for is_current_engine?(ruby)}
LAUNCHY_DEBUG: Launchy::Application : found executable /usr/bin/open
LAUNCHY_DEBUG: Launchy::Application::Browser : possibility : /usr/bin/open
LAUNCHY_DEBUG: Launchy::Application::Browser : Using browser value '/usr/bin/open'
LAUNCHY_DEBUG: wet_run: before exec in child process
>> LAUNCHY_DEBUG: commandline_normalized => /usr/bin/open http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror

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

您可以通过将/launchy/lib/launchy/applications/browser.rb中的第12行从以下位置更改来临时修复它:

如果File.exist?(uri.path)和uri.scheme.nil?

如果File.exist?(uri.path)&&则返回true!方案。包括?(uri.scheme)

我必须做:

fileUri = 'file:///' + outputFile.path

Launchy.open(fileUri)

注意“file:”后面的三个斜杠。这是Windows 8上的github-markdown-0.5.5版本。

有趣的是,我可以将错误消息路径复制粘贴到浏览器中并查看页面。我也有同样的问题。我注意到的一件事是,当我复制url并在命令行中使用
launchy C:/Sites/..
运行它时,我会得到相同的错误,但当我将
文件://
放在
C:
之前时,它会工作。有相同的问题。它以前工作过。不确定错误是否与运行捆绑包更新有关。可能已返回?您安装了哪些版本的capybara和launchy。您是否正在使用旧的软件(例如ruby<1.9.3)?谢谢您的回复。下面是调试输出:请注意刚才的save_和open_页面没有生成任何错误。但是rspec也没有显示页面。@copiousfreetime你能在这个问题上指导我吗,如果launchy找不到任何链接,比如说有输入错误,那么launchy是否有任何方法可以让它搜索“给定的单词或链接”@Abhinay,只是确保我理解你的要求。你想让Launchy告诉你你传递给它的url是否无效,它的哪一部分无效?@copiousfreetime是的,但我正在寻找一些内置函数来帮助它做同样的事情,现在我正在走这条路,我觉得这条路很跛脚,但现在对我来说很好,但是,如果你有任何建议,我愿意尝试。这是代码,解决方案已经过验证,并且有效。请将其标记为答案,以便Brad获得悬赏点数。谢谢
fileUri = 'file:///' + outputFile.path

Launchy.open(fileUri)