我需要帮助来构建这个Rails应用

问题描述 投票:0回答:2

这个错误一直困扰着我

Recipes App
  displays 'Recipes for chocolate' when visiting the root (FAILED - 1)
  displays 'Recipes for chocolate' when visiting recipes/index (FAILED - 2)
  displays page for alternate search term (bread) (FAILED - 3)
  displays utf-8 chars in the title correctly (FAILED - 4)
  examine page content (view) after visiting recipes/index
    displays table header row with 3 columns (FAILED - 5)
    displays table element that has a row with 3 columns (FAILED - 6)
    column 1 should have the thumbnail inside img tag inside a link tag (FAILED - 7)
    title should be inside a second column inside a link tag (FAILED - 8)

Failures:

  1) Recipes App displays 'Recipes for chocolate' when visiting the root
     Failure/Error: visit '/'

     OpenSSL::SSL::SSLError:
       SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
     # ./spec/recipes_app_spec.rb:5:in `block (2 levels) in <top (required)>'

  2) Recipes App displays 'Recipes for chocolate' when visiting recipes/index
     Failure/Error: visit '/recipes/index'

     OpenSSL::SSL::SSLError:
       SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
     # ./spec/recipes_app_spec.rb:10:in `block (2 levels) in <top (required)>'

  3) Recipes App displays page for alternate search term (bread)
     Failure/Error: visit "recipes/index?search=bread"

     OpenSSL::SSL::SSLError:
       SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
     # ./spec/recipes_app_spec.rb:15:in `block (2 levels) in <top (required)>'

  4) Recipes App displays utf-8 chars in the title correctly
     Failure/Error: visit "/recipes/index?search=amarula"

     OpenSSL::SSL::SSLError:
       SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
     # ./spec/recipes_app_spec.rb:20:in `block (2 levels) in <top (required)>'

  5) Recipes App examine page content (view) after visiting recipes/index displays table header row 
with 3 columns
     Failure/Error: before { visit '/recipes/index' }

     OpenSSL::SSL::SSLError:
       SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
     # ./spec/recipes_app_spec.rb:25:in `block (3 levels) in <top (required)>'

  6) Recipes App examine page content (view) after visiting recipes/index displays table element that has a row with 3 columns
     Failure/Error: before { visit '/recipes/index' }

     OpenSSL::SSL::SSLError:
       SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
     # ./spec/recipes_app_spec.rb:25:in `block (3 levels) in <top (required)>'

  7) Recipes App examine page content (view) after visiting recipes/index column 1 should have the thumbnail inside img tag inside a link tag
     Failure/Error: before { visit '/recipes/index' }

     OpenSSL::SSL::SSLError:
       SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
     # ./spec/recipes_app_spec.rb:25:in `block (3 levels) in <top (required)>'

  8) Recipes App examine page content (view) after visiting recipes/index title should be inside a second column inside a link tag
     Failure/Error: before { visit '/recipes/index' }

     OpenSSL::SSL::SSLError:
       SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
     # ./spec/recipes_app_spec.rb:25:in `block (3 levels) in <top (required)>'

Finished in 10.74 seconds (files took 1.55 seconds to load)
8 examples, 8 failures

Failed examples:

rspec ./spec/recipes_app_spec.rb:4 # Recipes App displays 'Recipes for chocolate' when visiting the 
root
rspec ./spec/recipes_app_spec.rb:9 # Recipes App displays 'Recipes for chocolate' when visiting recipes/index
rspec ./spec/recipes_app_spec.rb:14 # Recipes App displays page for alternate search term (bread)   
rspec ./spec/recipes_app_spec.rb:19 # Recipes App displays utf-8 chars in the title correctly       
rspec ./spec/recipes_app_spec.rb:27 # Recipes App examine page content (view) after visiting recipes/index displays table header row with 3 columns
rspec ./spec/recipes_app_spec.rb:34 # Recipes App examine page content (view) after visiting recipes/index displays table element that has a row with 3 columns
rspec ./spec/recipes_app_spec.rb:38 # Recipes App examine page content (view) after visiting recipes/index column 1 should have the thumbnail inside img tag inside a link tag
rspec ./spec/recipes_app_spec.rb:42 # Recipes App examine page content (view) after visiting recipes/index title should be inside a second column inside a link tag

我很累了,我觉得要放弃这个过时的课程。

这是源码

该应用在以下情况下运行良好 铁轨 命令,我对此很有信心,只是需要添加一个santize代码,我可以做到,但我不知道该死的rspec或OpenSSL可能有什么问题。我使用的是Ruby 2.6.6p146,并且已经将所有的gems更新到最新的、稳定的、兼容的版本。

我甚至尝试了Railsinstaller里面的cacert.pem,然后用环境变量(之前用的是Ruby 2.3.x)的方法,然后删除了Railsinstaller,并安装了新的Ruby 2.6.x和'default_options.update(verify: false)里面的Ruby 2.6.x。recipe.rb'方法也是如此。

这是我下面的代码,只有应用程序和配置内的文件被改变,只是拖放

ruby-on-rails ruby rspec openssl
2个回答
1
投票

这应该是正常的,如果你这样做 test 环境

# Add to config/application.rb
if Rails.env.test?
  OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
end

注意: 这是我不会做的事情,为 production 环境


0
投票

谢谢大家的回复.我再次尝试了cacert.pem方法.然后添加到环境变量为SSL_CERT_FILE,和路径到cacert.pem它看起来像我不得不安装Firefox,然后替换Capybara驱动程序与硒,而不是硒_headless, rack_test,硒_chrome或甚至硒_chrome_headless.这将无法与Edgium工作,这是我的主要浏览器。 甚至在chrome上也不行,我猜是因为Edgium和Chromium有某种冲突,或者什么的,不确定,但是是的,Web-kit冲突.我不知道实际的原因是什么,而且,不,请,如果你们都是新的Ruby,不要像我一样是个笨蛋,买一本真正的书,特别是敏捷-for-rails或eloquent-ruby.它有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.