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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display feature pets on org home page [558] #660

Conversation

VonTeacher
Copy link
Contributor

馃敆 Issue

Display feature pets on org home page #558

鉁嶏笍 Description

  • Created instance variable in the Organizations::HomeController#index action to sample from the adoptable_pets (though I'm not sure the pattern matches what is used in other controllers).
  • Replaced four static pet cards on the /<org>/home page with a sample of the adoptable pets from that organization.

馃摲 Screenshots/Demos

Before:

image

After:

Screen Shot 2024-04-11 at 17 59 11

@kasugaijin
Copy link
Collaborator

FYI tests failures and need to run the linter.

@kasugaijin
Copy link
Collaborator

@all-contributors
please add @VonTeacher for code.

Copy link
Contributor

@kasugaijin

I've put up a pull request to add @VonTeacher! 馃帀

@kasugaijin
Copy link
Collaborator

@VonTeacher let me know if you have any questions!

@kasugaijin
Copy link
Collaborator

@VonTeacher hey are you still able to finish this? Please let me know in the next couple of days. I usually re-assign issues that sit without communication for a week or more. Thanks :)

@VonTeacher
Copy link
Contributor Author

VonTeacher commented May 3, 2024

Thanks for the reminder and apologies for the delay. I'll spend some time this weekend now.

Edit: I updated the test file, taking into account your comments on the script and resolving conflicts that occurred as a result of #618. Awaiting workflow approval and any other comments you might have had on the home#index method.

@kasugaijin
Copy link
Collaborator

@VonTeacher No worries at all! Just making sure you have what you need and still able to work on it.

@@ -12,7 +13,14 @@ class Organizations::HomeControllerTest < ActionDispatch::IntegrationTest
get home_index_path(script_name: "/#{@organization.slug}")

assert_response :success
assert_select "title", text: "#{@organization.name} | \"Pet Rescue\""
assert_select "title", text: "#{ActsAsTenant.current_tenant.name} | \"Pet Rescue\""
Copy link
Collaborator

@kasugaijin kasugaijin May 5, 2024

Choose a reason for hiding this comment

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

This is failing. Although we assert specific dom elements in this app's test suite, I am recommending we steer away from it as it couples the test suite too tightly with the dom and leads to test failures whenever we touch the dom in the future.

I personally don't think we need to test this particular feature, but if we wanted to test something, I would just test the index action on the controller returns a collection of 4 pets that belong to the organization set in the test context. However, unless someone thinks otherwise, I vote we just remove the test changes here altogether. We can always add a test later if this feature becomes more complex.

@@ -4,6 +4,7 @@ class Organizations::HomeControllerTest < ActionDispatch::IntegrationTest
setup do
@organization = create(:organization, :with_page_text)
@organization.save
@pets = create_list(:pet, 4, :with_image, organization_id: @organization.id)
Copy link
Collaborator

@kasugaijin kasugaijin May 5, 2024

Choose a reason for hiding this comment

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

Should we need this? The Index action should be performing a query to retrieve 4 pets from the given Org, and we should be able to access that via hitting the index action and accessing the instance var within a controller test? If we delete these test changes per my other comment, then this is a non-issue.

@nsiwnf nsiwnf linked an issue May 6, 2024 that may be closed by this pull request
@kasugaijin
Copy link
Collaborator

@VonTeacher let me know if you can update re my feedback above. If not, I can also finish this off if you're busy. Let me know :)

@maebeale
Copy link
Collaborator

@kasugaijin (and @VonTeacher) might we want to merge this PR this weekend?

@kasugaijin
Copy link
Collaborator

@maebeale yes we can it just needs the tests removing or updating. I personally don鈥檛 think m this needs to be tested.

@meg-gutshall meg-gutshall mentioned this pull request May 31, 2024
@meg-gutshall
Copy link
Member

Resolved by #784

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.

Display "Featured pets" on the org home page
4 participants