From 5e093b67c8acc04896e19fb34ecada59eb15367a Mon Sep 17 00:00:00 2001 From: Hugo Tunius Date: Sun, 10 Aug 2014 15:28:51 +0200 Subject: [PATCH] [Specification::Set::Presenter][Specification] Move depracted? method from Presenter to root attributes in specification --- .../specification/root_attribute_accessors.rb | 7 +++++++ lib/cocoapods-core/specification/set/presenter.rb | 9 +-------- spec/specification/root_attribute_accessors_spec.rb | 11 +++++++++++ spec/specification/set/presenter_spec.rb | 12 ------------ 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/lib/cocoapods-core/specification/root_attribute_accessors.rb b/lib/cocoapods-core/specification/root_attribute_accessors.rb index b0c98eacf..225e9ea02 100644 --- a/lib/cocoapods-core/specification/root_attribute_accessors.rb +++ b/lib/cocoapods-core/specification/root_attribute_accessors.rb @@ -158,6 +158,13 @@ def deprecated_in_favor_of attributes_hash['deprecated_in_favor_of'] end + # @return [Bool] Wether the pod is deprecated either in favor of some other + # pod or simply deprecated. + # + def deprecated? + deprecated || !deprecated_in_favor_of.nil? + end + #---------------------------------------------------------------------# private diff --git a/lib/cocoapods-core/specification/set/presenter.rb b/lib/cocoapods-core/specification/set/presenter.rb index 26297cff9..37696fa12 100644 --- a/lib/cocoapods-core/specification/set/presenter.rb +++ b/lib/cocoapods-core/specification/set/presenter.rb @@ -123,13 +123,6 @@ def description spec.description || spec.summary end - # @return [Bool] Wether the pod is deprecated either in favor of some other - # pod or simply deprecated. - # - def deprecated? - spec.deprecated || !spec.deprecated_in_favor_of.nil? - end - # @return [String] A string that describes the deprecation of the pod. # If the pod is deprecated in favor of another pod it will contain # information about that. If the pod is not deprecated returns nil. @@ -140,7 +133,7 @@ def deprecated? # "[DEPRECATED in favor of NewAwesomePod]" # def deprecation_description - if deprecated? + if spec.deprecated? description = "[DEPRECATED" if spec.deprecated_in_favor_of.nil? description += "]" diff --git a/spec/specification/root_attribute_accessors_spec.rb b/spec/specification/root_attribute_accessors_spec.rb index 8cc97fe0c..31521cb49 100644 --- a/spec/specification/root_attribute_accessors_spec.rb +++ b/spec/specification/root_attribute_accessors_spec.rb @@ -145,5 +145,16 @@ module Pod @spec.deprecated_in_favor_of.should == 'NewMoreAwesomePod' end + it 'it returns wether it is deprecated either by deprecated or deprecated_in_favor_of' do + @spec.deprecated = true + @spec.deprecated?.should == true + @spec.deprecated = false + + @spec.deprecated_in_favor_of = 'NewMoreAwesomePod' + @spec.deprecated?.should == true + @spec.deprecated_in_favor_of = nil + + @spec.deprecated?.should == false + end end end diff --git a/spec/specification/set/presenter_spec.rb b/spec/specification/set/presenter_spec.rb index fa326d9ce..a4de82d98 100644 --- a/spec/specification/set/presenter_spec.rb +++ b/spec/specification/set/presenter_spec.rb @@ -39,18 +39,6 @@ module Pod @presenter.sources.should == %w(master test_repo) end - it 'returns the correct deprecation status when the spec is deprecated' do - @presenter.deprecated?.should == false - @presenter.spec.deprecated = true - @presenter.deprecated?.should == true - end - - it 'returns the correct deprecation status when the spec is deprecated in favor of another pod' do - @presenter.deprecated?.should == false - @presenter.spec.deprecated_in_favor_of = 'NewMoreAwesomePod' - @presenter.deprecated?.should == true - end - it 'returns the correct deprecation description' do @presenter.deprecation_description.should.nil? @presenter.spec.deprecated = true