Closed luizkowalski closed 2 years ago
Doesn't have Controller
in the classname, so it doesn't try to make it a controller test...
I think you can tack on :controller
as an argument after the class in your describe... oh, no, I guess it is now :integration
.
Look at the register_spec_type
calls in lib/minitest/rails.rb
for more info.
Doesn't have Controller in the classname, so it doesn't try to make it a controller test...
Looking back now, this makes total sense 🤦🏻 I totally missed this
Thanks for getting back to me, @zenspider but I don't work at the company where I had this issue anymore, unfortunately. I will ping my older team anyway but this can be closed
If you want to override how Minitest Spec matches the class name passed to describe
, you can use the spec DSL's additional descriptors to indicate what test class should be used.
To use ActiveSupport::TestCase
call the following:
describe Banking::Services::BankInformationFetcher, :model do
To use ActionDispatch::IntegrationTest
call the following:
describe Banking::Services::BankInformationFetcher, :integration do
If this answers the question plz close the issue. Thanks!
it does! thanks, I'm closing it now
I have the following configuration for
test_helper.rb
and I have some tests under
tests/controller/...
and they are working fine. they have access toCustomAssertions
andSugar
methods I includedbut tests outside regular Rails directories, in my app,
test/components/banking/services/bank_information_fetcher_test.rb
do no inherit fromActiveSupport::TestCase
and they don't have access to these methods.This is the output of the ancestor list on a controller
I'm not sure what is going on...the tests are described in the exact same way:
and the controller test
have you ever seen something like that? or am I doing something wrong, some config. is missing? let me know if you need more data
Edit: I noticed that if I change the class definition from
to
then it works but now our test codebase has some files using
class xxx < ActiveSupport::TestCase
and others usingdescribe
and I would like to stick to one or another, in this case, describe