8000 Ensure formatting works for DateTime too · parse/activeadmin@ace76a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit ace76a1

Browse files
author
David Rodríguez
committed
Ensure formatting works for DateTime too
1 parent 1d5b4fd commit ace76a1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spec/unit/pretty_format_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ def method_missing(*args, &block)
1414
end
1515
end
1616

17-
context "given a Date or a Time" do
18-
let(:t) { Time.utc(1985, "feb", 28, 20, 15, 1) }
19-
17+
shared_examples_for 'a time-ish object' do |t|
2018
it "formats it with the default long format" do
2119
expect(pretty_format(t)).to eq "February 28, 1985 20:15"
2220
end
@@ -63,6 +61,9 @@ def method_missing(*args, &block)
6361
end
6462
end
6563

64+
it_behaves_like 'a time-ish object', Time.utc(1985, "feb", 28, 20, 15, 1)
65+
it_behaves_like 'a time-ish object', DateTime.new(1985, 2, 28, 20, 15, 1)
66+
6667
context "given an ActiveRecord object" do
6768
it "should delegate to auto_link" do
6869
post = Post.new

0 commit comments

Comments
 (0)
0