mardi 24 janvier 2017

How to configure Rails to run custom tests?

I'm using Sidekiq for background jobs.
Sidekiq offers the opportunity to test your code inside its workers, rb files in app/workers
My code scrapes data from external websites and updates the database.
To test it with Minitest Unit, I thought I could create a test/workers directory and insert there my tests, that could inherit directly from Minitest::Test if this could work. In fact, none of my tests, except one that can be defined as integration test, would test models, controllers, mailers or can be defined as integration tests. My question is whether will I be able to run these tests (or my entire test suite included Sidekiq's tests) with either one of the following commands:

rails test:workers
rails test

or am I expected to extend somehow (how?) rake test configuration? From which one of the following class would be better my test inherit from?

ActiveSupport::TestCase
Minitest::Test

Aucun commentaire:

Enregistrer un commentaire