diff --git a/Gemfile b/Gemfile index 00ba21f..3205947 100644 --- a/Gemfile +++ b/Gemfile @@ -37,6 +37,7 @@ gem 'jbuilder', '~> 2.5' gem 'bootsnap', '>= 1.1.0', require: false gem 'sorcery' +gem 'rails-controller-testing' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Gemfile.lock b/Gemfile.lock index 33941b8..a7d63a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -137,6 +137,10 @@ GEM bundler (>= 1.3.0) railties (= 5.2.2) sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.4) + actionpack (>= 5.0.1.x) + actionview (>= 5.0.1.x) + activesupport (>= 5.0.1.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -220,6 +224,7 @@ DEPENDENCIES listen (>= 3.0.5, < 3.2) puma (~> 3.11) rails (~> 5.2.2) + rails-controller-testing sass-rails (~> 5.0) selenium-webdriver sorcery diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 5f117e3..7e38274 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -18,7 +18,7 @@ class UsersControllerTest < ActionController::TestCase test 'should create user' do assert_difference('User.count') do - post :create, user: { email: 'bla@pitput.com', password: 'gluplup', password_confirmation: 'gluplup' } + post :create, params: { user: { email: 'bla@pitput.com', password: 'gluplup', password_confirmation: 'gluplup' }} end assert_redirected_to users_path @@ -26,26 +26,26 @@ class UsersControllerTest < ActionController::TestCase test 'should show user' do login_user - get :show, id: @user.to_param + get :show, params: { id: @user.id } assert_response :success end test 'should get edit' do login_user - get :edit, id: @user.to_param + get :edit, params: { id: @user.id } assert_response :success end test 'should update user' do login_user - put :update, id: @user.to_param, user: @user.attributes + put :update, params: { id: @user.id, user: @user.attributes } assert_redirected_to user_path(assigns(:user)) end test 'should destroy user' do login_user assert_difference('User.count', -1) do - delete :destroy, id: @user.to_param + delete :destroy, params: { id: @user.id } end assert_redirected_to users_path