JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
[Refactoring proposal] Test app structure refactoring
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading test/fixtures/active_record.rb and test_helper.rb to map the schema, models, controllers, resources, routes, configurations, and monkey-patches they contain. Extract each component type into the proposed test files and include them from test_helper.rb. Done means the test app retains its behavior while its structure matches the proposed layout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- developer-experience, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100