diff --git a/lib/next_rails/gem_info.rb b/lib/next_rails/gem_info.rb index 6afc825..0a2433d 100644 --- a/lib/next_rails/gem_info.rb +++ b/lib/next_rails/gem_info.rb @@ -1,15 +1,5 @@ -begin - require "action_view" -rescue LoadError - puts "ActionView not available" -end - module NextRails class GemInfo - if defined?(ActionView) - include ActionView::Helpers::DateHelper - end - class NullGemInfo < GemInfo def initialize; end @@ -52,11 +42,7 @@ def initialize(gem_specification) end def age - if respond_to?(:time_ago_in_words) - "#{time_ago_in_words(created_at)} ago" - else - created_at.strftime("%b %e, %Y") - end + created_at.strftime("%b %e, %Y") end def sourced_from_git? diff --git a/spec/ten_years_rails/gem_info_spec.rb b/spec/ten_years_rails/gem_info_spec.rb index 80dd989..f0cbfa8 100644 --- a/spec/ten_years_rails/gem_info_spec.rb +++ b/spec/ten_years_rails/gem_info_spec.rb @@ -19,22 +19,10 @@ end end - context "when ActionView is available" do - it "returns a time ago" do - expect(subject.age).to eq("about 12 hours ago") - end - end - - context "when ActionView is not available" do - let(:result) { now.strftime("%b %e, %Y") } + let(:result) { now.strftime("%b %e, %Y") } - before do - subject.instance_eval('undef :time_ago_in_words') - end - - it "returns a date" do - expect(subject.age).to eq(result) - end + it "returns a date" do + expect(subject.age).to eq(result) end end end