-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed replica_spec.rb and replica.rb #5649
Fixed replica_spec.rb and replica.rb #5649
Conversation
lib/replica.rb
Outdated
@@ -144,7 144,8 @@ def api_post(endpoint, key, data) | |||
return if response.body.empty? | |||
parsed = Oj.load(response.body) | |||
raise unless parsed['success'] | |||
parsed['data'] | |||
filtered_data = parsed['data'].select { |article| data.include?(article['page_title']) } | |||
return filtered_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change to replica.rb included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this change was not required.
Initially, due to the fact that i was seeing previous vcr response again and again, i thought that the api is not filtering out data with the provided tittle.
Now when i changed the vcr cassette name for recording response, got to know api is working fine as expected.
Found that now article "Autism" does not exist in namespace 118 --> Only reason leading to the failure of previous test case. |
Failing tests are flaky. |
Looks good to me |
What this PR does
Fixes #5647
This pr resolve the issue in the test case 'returns a list of existing articles' spec in spec/lib/replica_spec.rb. The original test was performing multiple tasks and was unreliable. To rectify this, I modularized the test into smaller tests, each focusing on individual articles.
Screenshots
Before:
After: