Closed JohnRDOrazio closed 1 year ago
The verify/tests check is failing because it's still trying to compile with webpack, we can fix that later I guess... Or I can try to do a couple more commits on this branch to get it fixed.
I removed the webpack compile step from our CI workflow, and I've tried to fix some tests based on PR #103 by @kas-catholic .
This seems to have fixed a few errors, but there are still a couple popping up that I can't quite figure out:
.F
Failure:
WeddingPartyMembersControllerTest#test_should_create_wedding_party_member [/home/johnrdorazio/development/marriage-booklet/test/controllers/wedding_party_members_controller_test.rb:23]:
Expected response to be a redirect to <http://www.example.com/en/wedding_party_members/b6a70f99-d077-5de1-8522-725ced0fdfbb> but was a redirect to <http://www.example.com/en/wedding_party_members/40aeb736-6804-44a1-ba66-5cc76a099401>.
Expected "http://www.example.com/en/wedding_party_members/b6a70f99-d077-5de1-8522-725ced0fdfbb" to be === "http://www.example.com/en/wedding_party_members/40aeb736-6804-44a1-ba66-5cc76a099401".
rails test test/controllers/wedding_party_members_controller_test.rb:18
......F
Failure:
ProjectsControllerTest#test_should_create_project [/home/johnrdorazio/development/marriage-booklet/test/controllers/projects_controller_test.rb:23]:
Expected response to be a redirect to <http://www.example.com/en/projects/aa67c98c-d81f-5a9c-b0bc-26caa0051aea> but was a redirect to <http://www.example.com/en/projects/47c73933-86f8-49e4-83b7-78084f477d6a>.
Expected "http://www.example.com/en/projects/aa67c98c-d81f-5a9c-b0bc-26caa0051aea" to be === "http://www.example.com/en/projects/47c73933-86f8-49e4-83b7-78084f477d6a".
rails test test/controllers/projects_controller_test.rb:18
............
Finished in 0.566150s, 37.0926 runs/s, 51.2232 assertions/s.
21 runs, 29 assertions, 2 failures, 0 errors, 0 skips
The tests are getting better, but now there are still some errors:
Running 21 tests in a single process (parallelization threshold is 50)
Run options: --seed 36501
# Running:
........E
Error:
UsersControllerTest#test_should_update_user:
ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"users", :id=>#<User id: nil, username: "donkey_kong", email: "donkey@stable.ps", role: "guest", avatar: "MyString", password_digest: [FILTERED], created_at: nil, updated_at: nil>, :locale=>:en}, possible unmatched constraints: [:id]
test/controllers/users_controller_test.rb:43:in `block in <class:UsersControllerTest>'
rails test test/controllers/users_controller_test.rb:42
..E
Error:
UsersControllerTest#test_should_show_user:
ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"users", :id=>#<User id: nil, username: "donkey_kong", email: "donkey@stable.ps", role: "guest", avatar: "MyString", password_digest: [FILTERED], created_at: nil, updated_at: nil>, :locale=>:en}, possible unmatched constraints: [:id]
test/controllers/users_controller_test.rb:33:in `block in <class:UsersControllerTest>'
rails test test/controllers/users_controller_test.rb:32
E
Error:
UsersControllerTest#test_should_get_edit:
ActionController::UrlGenerationError: No route matches {:action=>"edit", :controller=>"users", :id=>#<User id: nil, username: "donkey_kong", email: "donkey@stable.ps", role: "guest", avatar: "MyString", password_digest: [FILTERED], created_at: nil, updated_at: nil>, :locale=>:en}, possible unmatched constraints: [:id]
test/controllers/users_controller_test.rb:38:in `block in <class:UsersControllerTest>'
rails test test/controllers/users_controller_test.rb:37
E
Error:
UsersControllerTest#test_should_destroy_user:
ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"users", :id=>#<User id: nil, username: "donkey_kong", email: "donkey@stable.ps", role: "guest", avatar: "MyString", password_digest: [FILTERED], created_at: nil, updated_at: nil>, :locale=>:en}, possible unmatched constraints: [:id]
test/controllers/users_controller_test.rb:49:in `block (2 levels) in <class:UsersControllerTest>'
test/controllers/users_controller_test.rb:48:in `block in <class:UsersControllerTest>'
rails test test/controllers/users_controller_test.rb:47
.......
Finished in 1.519339s, 13.8218 runs/s, 14.4800 assertions/s.
21 runs, 22 assertions, 0 failures, 4 errors, 0 skips
I'm trying to search for information online, but I again can't quite figure out what's going on here. I fixed the fact that while fixtures need the password_digest
, the test instead needs password
and password_confirmation
on user creation. So instead of using the default generated @user = users(:one)
, which pulls info from the fixture, I simply created a new user ex-novo with @user = User.new
and then set the single fields on that @user
resource.
Seems however that there is still something needs fixing.
I have dedicated quite a bit of time to rebuilding the app from ground up locally, using Rails 7 with Stimulus.
I have documented all the steps I took in the wiki page https://github.com/opensourcecatholic/marriage-booklet/wiki/5b-How-to-create-the-Rails-7-App.
I believe this is a really great approach, much better than the previous attempts with webpack. I'm pretty sure the current state of my local work is quite close to the state of the UI in the current main branch, so we can pretty much pick up where we left off, but with a Rails 7 app, and newer gems (for example
i18n-js
has been updated and is much cleaner now).I figured we might as well bump up the node version to 18, no reason to stick to old outdated versions that might be prone to vulnerabilities.