Ruby on rails RSpec固定装置未加载

Ruby on rails RSpec固定装置未加载,ruby-on-rails,ruby-on-rails-3,rspec,Ruby On Rails,Ruby On Rails 3,Rspec,我正在接管一个代码库并尝试运行测试。我是 对RSpec来说有些陌生,所以这可能是一个微不足道的问题 基本上,我可以看出,固定装置没有加载。全部100人 测试失败时也会出现类似的错误 但我不知道为什么。下面是代码。你能看到什么或给我一个线索去哪里看吗。到目前为止我是空的 谢谢 皮托萨拉斯 在我知道正在运行的spec_helper.rb中,我看到: Spec::Runner.configure do |config| config.global_fixtures = :all end spec

我正在接管一个代码库并尝试运行测试。我是 对RSpec来说有些陌生,所以这可能是一个微不足道的问题

基本上,我可以看出,固定装置没有加载。全部100人 测试失败时也会出现类似的错误

但我不知道为什么。下面是代码。你能看到什么或给我一个线索去哪里看吗。到目前为止我是空的

谢谢

皮托萨拉斯

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

Spec::Runner.configure do |config|
  config.global_fixtures = :all
end
spec/controllers/downloads\u controller\u 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: rocky@example.com
  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 production
partner:
  id: 2
  username: bull_winkle
  email: bull_winkle@example.com
  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/fixtures/partners.yml-包含2条yaml记录:
赞助商:
身份证号码:1
用户名:rtv
电邮:rocky@example.com
加密密码:
“C8E5B51B23734Fe0E72539AF0CAC7197F094A5E933FFACF6E7FA612363C5933F520710C6427AC31FC4C68A2D7BB48EAE601C74B96E7838F9CA1A0740B67576A”
密码:Y4PPzYx2ert3vC0OhEMo
姓名:洛奇
组织:摇动投票
网址:http://rockthevote.com
地址:123
城市:华盛顿
州编号:9
邮政编码:20001
电话:555-555-1234
调查问题:“你上的是哪所学校?”
调查问题:“你最喜欢的音乐团体是什么?”
创建于:
更新地址:
#TODO:删除生产中的合作伙伴2
合作伙伴:
身份证号码:2
用户名:bull_winkle
电邮:bull_winkle@example.com
加密密码:
“C8E5B51B23734Fe0E72539AF0CAC7197F094A5E933FFACF6E7FA612363C5933F520710C6427AC31FC4C68A2D7BB48EAE601C74B96E7838F9CA1A0740B67576A”
密码:Y4PPzYx2ert3vC0OhEMo
姓名:布尔文克尔
组织:布尔温克尔公司。
网址:http://example.com
地址:123
城市:华盛顿
州编号:9
邮政编码:20001
电话:555-555-1234
调查问题:“你上的是哪所学校?”
调查问题:“你最喜欢的音乐团体是什么?”
创建于:
更新地址:

也许这是自动完成的,您已经解决了它,但是您是否检查了“spec/spec\u helper.rb”是否包含:

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