RSpec - 当控制器在模块内时创建控制器测试

时间:2015-04-28 17:56:16

标签: ruby-on-rails rspec

实施例

module V1
   class HitsController < ApplicationController
   end
end

我尝试访问

RSpec.describe HitsController, type: :controller do
end

未初始化的常量HitsController(NameError)

1 个答案:

答案 0 :(得分:4)

Rspec需要找到你的班级,所以你必须告诉它在哪里看。

RSpec.describe ::V1::HitsController, type: :controller do
end