不知道如何构建任务 'recipe_test.rb'

Don't know how to build task 'recipe_test.rb'

我知道之前有人问过同样的问题,但那些场景与我的完全不同。我的 rails_app/test/integration 中有一个 .rb 文件

recipe_test.rb

require "test_helper"

class RecipeFlowsTest < ActionDispatch::IntegrationTest
  fixtures :recipes
  test 'create recipes' do
    https! # sign in emulation
    curry = recipes(:curry)
    get '/recipes/new'
    assert_response :success

    post_via_redirect '/recipes/new', title: recipes(:curry).title
    assert_equal '/recipes', path
    assert_equal 'Create Recipe', flash[:notice]

    https!(false) # sign out emulation
    get '/recipes'
    assert_response :success
    assert assigns(:recipes) # fetch out inst var :recipes (in controller)
  end
end

还有一个test/fixture/recipe_test.yml

curry:
  title: Curry
  food_preference_id: 1
  food_type: 1
  cuisine_id: 1
  servings: 1
  cooking_time: 1
  level_of_difficulty: Easy
  ingredients: Onions Tomatoes Salt Oil
  procedure: Heat Oil Chop Onions,
             tomatoes and Salt to it.

这是我的 test/helper_test.rb

ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

class ActiveSupport::TestCase
integration tests
  fixtures :all
end

现在当我做 rake test recipe_test.rb --trace

它给我以下错误

** Invoke test (first_time)
** Execute test
** Invoke test:run (first_time)
** Execute test:run
rake aborted!
Don't know how to build task 'recipe_test.rb'

您的 rake 任务无效。 Here's a list of proper rake test tasks.

你只需要

rake test

对于你的recipe_test,你也可以rake test:integration