我想测试 rake 任务的特定命名空间,但我从 rubocop 收到错误。
desc 'This namespace is test'
namespace :test_namespace do
task test_task: :environment do
在我的耙子任务中,我有以下内容
RSpec.describe 'test_namespace' do
describe 'test_task' do
上面给了我一个错误
The first argument to describe should be the class or module being tested.
您只需将类直接传递到测试的描述行,而不是字符串。对于你的情况:
RSpec.describe TestNamespace do
添加类型::任务修复 rubocop 错误
示例:
describe 'some task description', type: :task do
# test case here
end