Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Improve Rails5 test support #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

neko314
Copy link

@neko314 neko314 commented Sep 14, 2019

How to reproduce

Some tests failed on my MacOS Mojave 10.14.6

docker-compose up
docker exec -it sorcery_example bash
bin/rails db:migrate
bundle install
# bin/rails test
Run options: --seed 31025

# Running:

.....E

Error:
UsersControllerTest#test_should_show_user:
ArgumentError: unknown keyword: id
    test/functional/users_controller_test.rb:29:in `block in <class:UsersControllerTest>'


bin/rails test test/functional/users_controller_test.rb:27

E

Error:
UsersControllerTest#test_should_update_user:
ArgumentError: unknown keywords: id, user
    test/functional/users_controller_test.rb:41:in `block in <class:UsersControllerTest>'


bin/rails test test/functional/users_controller_test.rb:39

E

Error:
UsersControllerTest#test_should_create_user:
ArgumentError: unknown keyword: user
    test/functional/users_controller_test.rb:21:in `block (2 levels) in <class:UsersControllerTest>'
    test/functional/users_controller_test.rb:20:in `block in <class:UsersControllerTest>'


bin/rails test test/functional/users_controller_test.rb:19

.E

Error:
UsersControllerTest#test_should_destroy_user:
ArgumentError: unknown keyword: id
    test/functional/users_controller_test.rb:48:in `block (2 levels) in <class:UsersControllerTest>'
    test/functional/users_controller_test.rb:47:in `block in <class:UsersControllerTest>'


bin/rails test test/functional/users_controller_test.rb:45

E

Error:
UsersControllerTest#test_should_get_edit:
ArgumentError: unknown keyword: id
    test/functional/users_controller_test.rb:35:in `block in <class:UsersControllerTest>'


bin/rails test test/functional/users_controller_test.rb:33

E

Error:
UsersControllerTest#test_should_get_index:
NoMethodError: assigns has been extracted to a gem. To continue using it,
        add `gem 'rails-controller-testing'` to your Gemfile.
    test/functional/users_controller_test.rb:11:in `block in <class:UsersControllerTest>'


bin/rails test test/functional/users_controller_test.rb:8



Finished in 0.893892s, 13.4244 runs/s, 10.0683 assertions/s.
12 runs, 9 assertions, 0 failures, 6 errors, 0 skips

Fix

  • Add gem 'rails-controller-testing' .
  • All parameters should be passed to the methods with param hashes.

Suggested by an error message from
UsersControllerTest#test_should_get_index
All parameters should be passed to the methods with param hashes.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant