File tree Expand file tree Collapse file tree 2 files changed +3
-25
lines changed Expand file tree Collapse file tree 2 files changed +3
-25
lines changed Original file line number Diff line number Diff line change 1
- begin
2
- require "action_view"
3
- rescue LoadError
4
- puts "ActionView not available"
5
- end
6
-
7
1
module NextRails
8
2
class GemInfo
9
- if defined? ( ActionView )
10
- include ActionView ::Helpers ::DateHelper
11
- end
12
-
13
3
class NullGemInfo < GemInfo
14
4
def initialize ; end
15
5
Original file line number Diff line number Diff line change 19
19
end
20
20
end
21
21
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" ) }
30
23
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 )
38
26
end
39
27
end
40
28
end
You can’t perform that action at this time.
0 commit comments