~/Sites/sample_app$ rails test
Running via Spring preloader in process 24338
Run options: --seed 58780
Running:
..
Finished in 0.292172s, 6.8453 runs/s, 6.8453 assertions/s.
/var/lib/gems/2.3.0/gems/railties-5.1.0/lib/rails/test_unit/minitest_plugin.rb:9:in `aggregated_results': wrong number of arguments (given 1, expected 0) (ArgumentError)
Run Code Online (Sandbox Code Playgroud)
我不明白为什么我会收到这个错误.我似乎找不到任何有这个特定错误的人.我正在按照教程https://www.railstutorial.org/book/static_pages.此错误遵循rails test命令.如果有帮助,运行Ubuntu和rails 5.1.我没有传递任何参数,所以我不明白为什么我会收到这个错误.
我的测试文件如下:
require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
test "should get home" do
get static_pages_home_url
assert_response :success
end
test "should get help" do
get static_pages_help_url
assert_response :success
end
Run Code Online (Sandbox Code Playgroud) 我一直在寻找可以解释我遇到的问题的东西。我可能遗漏了一些简单的东西,所以我希望有人能发现我的错误。
Rails.application.routes.draw do
get 'auth/:provider/callback', to: 'sessions#create', as: 'login'
get 'auth/failure', to: redirect('/')
get 'signout', to: 'sessions#destroy', as: 'signout'
resources :sessions, only: [:create, :destroy]
resources :home, only: [:show]
resources :static_pages, only: [:show]
resources :habits
root to: "home#show"
get '/started' => 'home#started'
end
Run Code Online (Sandbox Code Playgroud)
路线:
habit GET /habits/:id(.:format) habits#show
PATCH /habits/:id(.:format) habits#update
PUT /habits/:id(.:format) habits#update
DELETE /habits/:id(.:format) habits#destroy
Run Code Online (Sandbox Code Playgroud)
习惯控制器:
def update
if params[:name].present? && params[:description].present?
Habit.habit_edit(@current_habit, form_params)
flash[:success] = "Edited habit: " + @current_habit.name + '!'
redirect_to habit_path(:id => session[:user_id])
else
flash[:notice] …Run Code Online (Sandbox Code Playgroud)