Skip to content

Commit 778257c

Browse files
authored
Merge pull request #22 from fastruby/fixes/acts-like-issue
Remove any traces of `actionview`
2 parents 2f0e3b4 + a156ca6 commit 778257c

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

lib/next_rails/gem_info.rb

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
begin
2-
require "action_view"
3-
rescue LoadError
4-
puts "ActionView not available"
5-
end
6-
71
module NextRails
82
class GemInfo
9-
if defined?(ActionView)
10-
include ActionView::Helpers::DateHelper
11-
end
12-
133
class NullGemInfo < GemInfo
144
def initialize; end
155

@@ -52,11 +42,7 @@ def initialize(gem_specification)
5242
end
5343

5444
def age
55-
if respond_to?(:time_ago_in_words)
56-
"#{time_ago_in_words(created_at)} ago"
57-
else
58-
created_at.strftime("%b %e, %Y")
59-
end
45+
created_at.strftime("%b %e, %Y")
6046
end
6147

6248
def sourced_from_git?

spec/ten_years_rails/gem_info_spec.rb

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,10 @@
1919
end
2020
end
2121

22-
context "when ActionView is available" do
23-
it "returns a time ago" do
24-
expect(subject.age).to eq("about 12 hours ago")
25-
end
26-
end
27-
28-
context "when ActionView is not available" do
29-
let(:result) { now.strftime("%b %e, %Y") }
22+
let(:result) { now.strftime("%b %e, %Y") }
3023

31-
before do
32-
subject.instance_eval('undef :time_ago_in_words')
33-
end
34-
35-
it "returns a date" do
36-
expect(subject.age).to eq(result)
37-
end
24+
it "returns a date" do
25+
expect(subject.age).to eq(result)
3826
end
3927
end
4028
end

0 commit comments

Comments
 (0)