1

我在一个依赖于外部 gem 的应用程序中创建了一个引擎:Spree。我尽我所能按照本指南在该引擎中设置 RSpec 。

当我尝试使用一些集成测试来测试控制器时:tests_spec.rb:

require 'spec_helper'

describe "Tests" do
  describe "GET /tests" do
    it "works! (now write some real specs)" do
      # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
      get tests_path
      response.status.should be(200)
    end
  end
end

我在虚拟应用程序的 environment.rb 文件中收到错误消息,表示无法运行以下命令:

# Initialize the rails application
Dummy::Application.initialize!

因为我的控制器使用 Admin::ResourceController 作为在外部 Spree gem 中声明的扩展。好像 rspec 无法从主应用程序(包含引擎插件的那个)的 gemfile 中读取该类。

有人可以解释一下吗?

4

0 回答 0