Skip to content
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

3555 address skipped tests #3606

Merged
merged 14 commits into from
May 25, 2023
Merged

Conversation

Haradd
Copy link
Contributor

@Haradd Haradd commented May 20, 2023

Resolves #3555

Description

The PR adds missing tests and fixes broken ones.
Additionally, it removes some dead code:

  • after_sign_in_path_for method in ApplicationHelper
  • ItemCategories#index action

Type of change

  • Bug fix (non-breaking change which fixes an issue)

unused helper `after_sign_in_path_for`.

It was supposed to override devise's method `after_sign_in_path_for`. However, to make it acutally wotk, it would need to be defined directly in ApplicationController or the AppliactionHelper would need to be directly included in the ApplicationController.

So in that form, it was only available through `helpers.after_sign_in_path_for` and it was never invoked.
Comment on lines -46 to -55
def after_sign_in_path_for(resource)
# default to the stored location
if resource.is_a?(User) && resource.organization.present?
# go to user's dashboard
dashboard_path(organization_id: resource.organization.id)
else
stored_location_for(resource) || new_organization_path
# send new users to organization creation page
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was the dead code. It didn't actually override devise's method since it was available in ApplicationController as helpers.after_sign_in_path_for and was never invoked. To make it be executed, we would need to either define the method directly in ApplicationController or just include the AppliactionHelper in the ApplicationController.

@@ -54,9 +54,8 @@
# These are scopes that are expressly to integrate with Filterable
context "filters >" do
it "->barcodeable_id shows only barcodes for a specific barcodeable_id" do
skip "TODO: this test can be intermittent see https://travis-ci.org/rubyforgood/diaper/builds/624661379?"
global_barcode_item # initial creation
create(:global_barcode_item) # create a null case
Copy link
Contributor Author

Choose a reason for hiding this comment

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

by default this factory takes BaseItem.all.sample as barcodeable, so that was the reason for the flakiness. It is enough to explicitly pass the base_item to fix it.

@Haradd Haradd marked this pull request as ready for review May 22, 2023 06:01
@Haradd Haradd changed the title 3555 address skipped tests - WIP 3555 address skipped tests May 22, 2023
@Haradd Haradd mentioned this pull request May 22, 2023
1 task
@dorner
Copy link
Collaborator

dorner commented May 22, 2023

@Haradd this looks amazing! It seems like at least one test is failing though :)

@Haradd
Copy link
Contributor Author

Haradd commented May 23, 2023

Thanks for the review! It should pass now. Let's see :)

@dorner
Copy link
Collaborator

dorner commented May 25, 2023

Looks good! Thanks!

@dorner dorner merged commit 215eae5 into rubyforgood:main May 25, 2023
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.

Address skipped tests
2 participants