teh*_*afe 9 integration-testing rspec ruby-on-rails capybara
试着开始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)>'
Run Code Online (Sandbox Code Playgroud)
规格:
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
Run Code Online (Sandbox Code Playgroud)
如果我取消注释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
Run Code Online (Sandbox Code Playgroud)
这是因为文件路径中的驱动器号被错误地确定为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 )
我是Launchy的作者,刚刚被告知这个问题.我通常通过GitHub进行错误修复并将此问题放在那里.问题#65
每次遇到Launchy问题时,请打开launchy调试并在github上提交项目问题
您可以通过设置环境变量来打开launchy调试LAUNCHY_DEBUG=true.如果要在应用程序中嵌入launchy,可以从shell执行此操作,也可以通过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
Run Code Online (Sandbox Code Playgroud)
或者如果你正在嵌入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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2284 次 |
| 最近记录: |