Skip to content

Commit

Permalink
titleize human model names to match existing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dlpierce committed Oct 6, 2023
1 parent c5db7f6 commit 7ff255d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/hyrax/resource_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ def initialize(klass, namespace = nil, name = nil)
@route_key = legacy_model.model_name.route_key
@singular_route_key = legacy_model.model_name.singular_route_key
end

def human
super.titleize
end
end
end
10 changes: 9 additions & 1 deletion spec/hyrax/resource_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
expect(name.singular_route_key).to start_with 'hyrax_'
end

context 'when a legacy resource is registered with Wings' do
it 'has a titleized human name' do
expect(name.human).to eq name.human.titleize
end

context 'when a legacy resource is registered with Wings', :active_fedora do
let(:work_class) { Hyrax::Test::BookResource }

it 'uses the legacy route key' do
Expand All @@ -22,5 +26,9 @@
it 'uses the legacy singular route key' do
expect(name.singular_route_key).to eq 'test_book'
end

it 'has a titleized human name' do
expect(name.human).to eq name.human.titleize
end
end
end

0 comments on commit 7ff255d

Please sign in to comment.