Skip to content

Commit

Permalink
Merge 75d23bf into 599ef0d
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeCohen committed Jan 13, 2024
2 parents 599ef0d + 75d23bf commit ee569d5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/views/controllers/names/show/_classification.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ end %>
end
end %>
<% if !@name.below_genus? && @name.classification.blank?
<%= if !@name.below_genus? && @name.classification.blank?
tag.p do
link_with_query(:show_name_inherit_classification.t,
inherit_name_classification_form_path(@name.id))
Expand Down
15 changes: 15 additions & 0 deletions test/controllers/names_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,21 @@ def test_show_new_version_missing_user
)
end

def test_show_name_inherit_link
name = names(:pasaria)
assert(!name.below_genus? && name.classification.blank?,
"Need fixture with rank >= Genus and lacking Classification")

login
get(:show, params: { id: name.id })

assert_select(
"#name_classification",
{ text: /#{:show_name_inherit_classification.l}/, count: 1 },
"Classification area lacks a #{:show_name_inherit_classification.l} link"
)
end

def assert_synonym_links(name, approve, deprecate, edit)
assert_select("a[href*=?]", approve_name_synonym_form_path(name.id),
count: approve)
Expand Down
15 changes: 12 additions & 3 deletions test/fixtures/names.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# Strobilurus -- Break NameControllerTest#test_edit_name_add_author
# Verpa -- See :suggested_by_verpa_authored below.
# Adding almost any Name will break ScriptTest#test_refresh_name_lister_cache.
# Fix this by updating mushroom-observer/test/reports/name_list_data.js
# Fix this by updating test/reports/name_list_data.js
# Suggestion: whenever adding a Name, run:
# rails t test/models/script_test.rb test_refresh_name_lister_cache
# If that fails, update name_list_data.js from the Actual results
# rails t test/models/script_test.rb -n test_refresh_name_lister_cache
# If that fails, update test/reports/name_list_data.js from the Actual results

DEFAULTS: &DEFAULTS
author: ""
Expand Down Expand Up @@ -1280,3 +1280,12 @@ lycoperdon_perlatum:
created_at: 2023-11-14 20:00:00
updated_at: 2023-11-14 20:00:00
rank: <%= Name.ranks[:Species] %>

pasaria:
<<: *DEFAULTS
text_name: Pasaria
display_name: '**__Pasaria__**'
search_name: Pasaria
sort_name: Pasaria
rank: <%= Name.ranks[:Genus] %>
classification: "" # to test if inherit link exists
2 changes: 1 addition & 1 deletion test/reports/name_list_data.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ee569d5

Please sign in to comment.