fixing paths to member harvests (with more tests too)

This commit is contained in:
Brenda Wallace
2019-12-19 16:52:59 +13:00
parent 2f3b6b3d22
commit 78e111af80
4 changed files with 13 additions and 10 deletions

View File

@@ -36,7 +36,7 @@
- @harvests.each do |harvest|
- cache harvest do
.card
= link_to harvest_path(id: harvest['id']) do
= link_to harvest_path(slug: harvest['slug']) do
- if harvest['thumbnail_url'].present?
= image_tag harvest['thumbnail_url'], alt: harvest, class: 'img-card'
- else
@@ -44,9 +44,9 @@
.card-body
%h5
%strong
= link_to harvest_path(id: harvest['id']) do
= link_to harvest_path(slug: harvest['slug']) do
= harvest['crop_name']
%span.badge.badge-pill= harvest['plant_part']
.card-footer
.float-right=render 'members/tiny', member: Member.find(harvest['owner_id'])
.float-right.harvest-owner=render 'members/tiny', member: Member.find(harvest['owner_id'])
= will_paginate @harvests

View File

@@ -5,7 +5,7 @@
= link_to timeline_index_path, method: :get, class: 'nav-link text-white' do
= image_tag 'icons/notification.svg', class: 'img img-icon'
%li.nav-item
= link_to member_gardens_path(member_slug: current_member.slug), class: 'nav-link text-white' do
= link_to member_gardens_path(current_member), class: 'nav-link text-white' do
= image_icon 'gardens'
%li.nav-item.dropdown
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"}

View File

@@ -125,7 +125,7 @@ en:
title:
crop_harvests: Everyone's %{crop} harvests
default: Everyone's harvests
owner_harvests: "%{owner} harvests"
owner_harvests: "%{owner}'s harvests"
planting_harvests: Harvests from %{planting}
updated: Harvest was successfully updated.
home:

View File

@@ -38,12 +38,15 @@ describe "Harvesting a crop", :js do
expect(page).to have_content "harvest was successfully created."
end
it "Clicking link to owner's profile" do
visit member_harvests_path(member)
within '.login-name' do
click_link member.login_name
describe 'member harvests' do
before { visit member_harvests_path(member) }
it { expect(page).to have_text "#{member.login_name}'s harvests" }
it "Clicking link to owner's profile" do
within '.login-name' do
click_link member.login_name
end
expect(current_path).to eq member_path(member)
end
expect(current_path).to eq member_path member
end
describe "Harvesting from crop page" do