我得到错误:没有DRb服务器正在运行。而是在本地进程中运行

时间:2014-08-31 14:18:50

标签: ruby-on-rails rspec

我遵循ROR教程,我使用rspec spec / requests / static_pages_spec.rb进行测试,发生错误" No DRb server is running. Running in local process instead"'我做了一些研究,他们说是因为Spork服务器没有运行,所以我将Spork.each_run do添加到spc文件,它没有帮助,我还修改了{{1的gem文件{}} gem 'guard-spork'还是一样,任何人都可以提供帮助吗?提前致谢!

规格文件:

gem 'guard-spork', :github => 'guard/guard-spork'

Gemfile:

require 'spec_helper'
Spork.each_run do
end
describe "Static pages" do
  let(:base_title) { "Ruby on Rails Tutorial Sample App" }
  describe "Home page" do
    it "should have the content 'Sample App'" do
      visit '/static_pages/home'
      expect(page).to have_content('Sample App')
    end
    it "should have the base title" do
      visit '/static_pages/home'
      expect(page).to have_title("Ruby on Rails Tutorial Sample App")
    end
    it "should not have a custom page title" do
      visit '/static_pages/home'
      expect(page).not_to have_title('| Home')
    end
    describe "Contact page" do
      it "should have the content 'Contact'" do
        visit '/static_pages/contact'
        expect(page).to have_content('Contact')
      end
      it "should have the title 'Contact'" do
        visit '/static_pages/contact'
        expect(page).to have_title("Ruby on Rails Tutorial Sample App | Contact")
      end
    end
  end
end

1 个答案:

答案 0 :(得分:4)

您应该使用命令spork在不同的进程中运行spork。另外,从测试中移除Spork部分并使用this(在spec_helper块中全部移动)修改Spork.prefork文件

另一件事是Spork已被spring替换(不是直接),它做了同样的事情,但没有额外的配置。