JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

[Refactoring proposal] Test app structure refactoring

Aperta
#1,232 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Ruby
Stelle
2.3k
Fork
546
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

This issue is a (choose one):

  • Problem/bug report.
  • Feature request.
  • Refactor proposal
  • Request for support. Note: Please try to avoid submitting issues for support requests. Use Gitter instead.

Checklist before submitting:

  • I've searched for an existing issue.
  • I've asked my question on Gitter and have not received a satisfactory answer.
  • I've included a complete bug report template. This step helps us and allows us to see the bug without trying to reproduce the problem from your description. It helps you because you will frequently detect if it's a problem specific to your project.
  • The feature I'm asking for is compliant with the JSON:API spec.

Description

Currently, we put all kind of components of our test app in side test/fixtures/active_record.rb. It contains schema, models, controllers and resources. The file’s name is quite misleading since it contains more than active_record related stuffs. And it’s a 2000 lines file, a little bit too long.

And in the meantime, test_helper.rb has the routes, test configurations, monkey-patches and test app configurations.

As a new contributor, I need to spend more time to figure out the test setup under this structure.

So I suggest we can do a small refactoring, to extract and put different types of components into their own files. Like:

test 
 |——— schema.rb # for schema
 |——— models.rb # for models
 |——— controllers.rb # for controllers
 |——— resources.rb # for resources
 |——— routes.rb # for routes
 |——— app.rb # for app configs
 |——— test_helper.rb # test configs, monkey-patchings and requires

Now we can just include these component files inside test_helper.rb and it’ll be more easier for new contributors to understand the test app.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia leggendo test/fixtures/active_record.rb e test_helper.rb per mappare lo schema, i modelli, i controller, le risorse, le route, le configurazioni e le monkey-patch che contengono. Estrai ogni tipo di componente nei file di test proposti e includili da test_helper.rb. Il lavoro è completato quando l’applicazione di test mantiene il proprio comportamento e la sua struttura corrisponde all’organizzazione proposta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rails, ruby
Ambito
developer-experience, testing
Tipo di issue
Refactoring
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.