JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

[Refactoring proposal] Test app structure refactoring

Offen
#1,232 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Ruby
Sterne
2.3k
Forks
546
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, test/fixtures/active_record.rb und test_helper.rb zu lesen, um das darin enthaltene Schema, die Modelle, Controller, Ressourcen, Routen, Konfigurationen und Monkey-Patches zu erfassen. Extrahiere jeden Komponententyp in die vorgeschlagenen Testdateien und binde diese aus test_helper.rb ein. Als abgeschlossen gilt die Aufgabe, wenn die Testanwendung ihr Verhalten beibehält und ihre Struktur dem vorgeschlagenen Aufbau entspricht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rails, ruby
Bereich
developer-experience, testing
Issue-Typ
Refactoring
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.