Skip to content

Conversation

@nthngoc277
Copy link
Contributor

This PR has solved a part of #1 which is 2. ErrorMapper spec


describe '.mapped_errors' do
it 'returns all the current mapped errors' do
expect(subject.mapped_errors).to eq({})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You set class_variable few lines above, before every single test example, so you don't check how it'll behave without that before block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swilgosz the before block will be redundant in case I already add the initialization for @@mapped_errors in ErrorMapper class.
If there is no initialization for @@mapped_errors, and I try to check how it behaves without before block, it will raise uninitialized class variable @@mapped_errors in JsonapiErrorsHandler::ErrorMapper error.

To fix this, I will remove the before block and just keep the initialization for @@mapped_errors. How do you think?

@swilgosz swilgosz merged commit ad1f0f0 into driggl:master Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants