Remove useless delegate method on List model

parent 66da64ae
...@@ -9,12 +9,10 @@ class List < ActiveRecord::Base ...@@ -9,12 +9,10 @@ class List < ActiveRecord::Base
validates :label_id, uniqueness: { scope: :board_id }, if: :label? validates :label_id, uniqueness: { scope: :board_id }, if: :label?
validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, if: :label? validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, if: :label?
delegate :name, to: :label, allow_nil: true, prefix: true
before_destroy :can_be_destroyed, unless: :label? before_destroy :can_be_destroyed, unless: :label?
def title def title
label? ? label_name : list_type.humanize label? ? label.name : list_type.humanize
end end
private private
......
...@@ -6,10 +6,6 @@ describe List do ...@@ -6,10 +6,6 @@ describe List do
it { is_expected.to belong_to(:label) } it { is_expected.to belong_to(:label) }
end end
describe 'delegate methods' do
it { is_expected.to delegate_method(:name).to(:label).with_prefix }
end
describe 'validations' do describe 'validations' do
it { is_expected.to validate_presence_of(:board) } it { is_expected.to validate_presence_of(:board) }
it { is_expected.to validate_presence_of(:label) } it { is_expected.to validate_presence_of(:label) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment