Skip to content

Commit

Permalink
Merge pull request #115 from projecthydra/model_name
Browse files Browse the repository at this point in the history
Delegate model_name to the model
  • Loading branch information
mjgiarlo authored Jun 24, 2016
2 parents 401046d + 69de013 commit c2025f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/presenters/hydra/presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(object)
end

delegate :to_key, :to_param, :to_model, :persisted?, :new_record?,
:[], to: :model
:[], :model_name, to: :model

module ClassMethods
def model_name
Expand Down
5 changes: 5 additions & 0 deletions spec/presenters/hydra_editor_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class TestPresenter
let(:object) { TestModel.new(title: ['foo', 'bar'], creator: 'baz') }
let(:presenter) { TestPresenter.new(object) }

describe '#model_name' do
subject { presenter.model_name }
it { is_expected.to eq 'TestModel' }
end

describe '#terms' do
subject { presenter.terms }
it { is_expected.to eq [:title, :creator] }
Expand Down

0 comments on commit c2025f3

Please sign in to comment.