ruby-on-rails – RSpec装置无法装载

ruby-on-rails – RSpec装置无法装载,第1张

概述我正在接管代码库,并试图运行测试.我是 RSpec有点新,所以这可能是一个微不足道的问题. 基本上我可以告诉灯具没有加载.全部100 测试失败并出现类似错误. 但我不知道为什么.下面是代码.你能看到任何东西或给我一个线索在哪里看.到目前为止,我的空洞…… 谢谢! 皮托萨拉斯 在我知道正在运行的spec_helper.rb中,我看到: Spec::Runner.configure do |confi 我正在接管代码库,并试图运行测试.我是
RSpec有点新,所以这可能是一个微不足道的问题.

基本上我可以告诉灯具没有加载.全部100
测试失败并出现类似错误.

但我不知道为什么.下面是代码.你能看到任何东西或给我一个线索在哪里看.到目前为止,我的空洞……

谢谢!

皮托萨拉斯

在我知道正在运行的spec_helper.rb中,我看到:

Spec::Runner.configure do |config|  config.global_fixtures = :allend

spec / controllers / downloads_controller_spec.rb中的一个测试
在下面.我知道它在运行,我知道在’描述’之前,
Partner.count == 0,所以没有夹具.

require file.expand_path(file.dirname(__file__) + '/../spec_helper')describe DownloadsController do  integrate_vIEws  describe "when pdf is ready" do    before(:each) do      @registrant = Factory.create(:step_5_registrant)      stub(@registrant).merge_pdf { `touch #{@registrant.pdf_file_path}`}      @registrant.generate_pdf      @registrant.save!    end    it "provIDes a link to download the pdf" do      get :show,:registrant_ID => @registrant.to_param      assert_not_nil assigns[:registrant]      assert_response :success      assert_template "show"      assert_select "span.button a[target=_blank]"      assert_select "span.button a[onclick]"    end    after(:each) do      `rm #{@registrant.pdf_file_path}`    end  end

以下是各种目录中的内容:

spec/fixtures/partners.yml - which contains 2 yaml records:sponsor:  ID: 1  username: rtv  email: [email protected]  crypted_password:"c8e5b51b237344fe0e72539af0cac7197f094a5e933ffacf6e7fa612363c5933f520710c6427ac31fc4c68a2d7bb48eae601c74b96e7838f9ca1a0740b67576a"  password_salt: "Y4PPzYx2ert3vC0OhEMo"  name: Rocky  organization: Rock The Vote  url: http://rocktheVote.com  address: 123 Wherever  city: Washington  state_ID: 9  zip_code: 20001  phone: 555-555-1234  survey_question_1_en: "What school dID you go to?"  survey_question_2_en: "What is your favorite musical group?"  created_at: <%= Time.Now %>  updated_at: <%= Time.Now %># Todo: remove partner 2 in productionpartner:  ID: 2  username: bull_winkle  email: [email protected]  crypted_password:"c8e5b51b237344fe0e72539af0cac7197f094a5e933ffacf6e7fa612363c5933f520710c6427ac31fc4c68a2d7bb48eae601c74b96e7838f9ca1a0740b67576a"  password_salt: "Y4PPzYx2ert3vC0OhEMo"  name: Bullwinkle  organization: Bullwinkle,Inc.  url: http://example.com  address: 123 Wherever  city: Washington  state_ID: 9  zip_code: 20001  phone: 555-555-1234  survey_question_1_en: "What school dID you go to?"  survey_question_2_en: "What is your favorite musical group?"  created_at: <%= Time.Now %>  updated_at: <%= Time.Now %>
解决方法 也许现在这是自动完成的,你已经解决了,但是你检查过你的“spec / spec_helper.rb”包含:

# Remove this line if you're not using ActiveRecord or ActiveRecord fixturesconfig.fixture_path = "#{::Rails.root}/spec/fixtures"

干杯

总结

以上是内存溢出为你收集整理的ruby-on-rails – RSpec装置无法装载全部内容,希望文章能够帮你解决ruby-on-rails – RSpec装置无法装载所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1279037.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存