varvet / godmin

Admin framework for Rails 5+
http://godmin-sandbox.herokuapp.com
MIT License
486 stars 47 forks source link

Refactor tests + add generator tests #241

Closed jensljungblad closed 6 years ago

jensljungblad commented 6 years ago

This PR moves current unit tests from test/lib/godmin to test/unit. I also tried removing the wrapping Godmin module from the tests to make them flatter and simpler, but there are some weird things going on, in the resolver test in particular, so I moved on for now...

I have also looked into how to test generators. This is not perfect, but it's a start. There is something weird going on with the assertion count however, it is doubled for each test case. It doesn't seem to run the test code twice, only report it twice... They are also not super fast, but generating a blank rails app was the easiest way I could think to test them. I first considered copying the dummy app but the install generator will need a blank app anyway. Also considered generating the app with the template, but the template creates a bunch of data which we don't need.