semantic_date_time_tags 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04a9f9eb96b80d36f9d660f34eac82fda8d0fb50
|
4
|
+
data.tar.gz: 483e6454d79275d34e1a2605703e5edc7a5eeee3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4263c6e8e7f5321874423f268f1f88064cbfc2e029e5046bbc7e1fd2084222fb32b17f2de84aab7e471d5c0a6a36169036b237babcfb767d83c0d2bd66c70d9
|
7
|
+
data.tar.gz: 96ae029138cd5ded63b6867e57e2e65cb6a278437939bef313d5d7faeb7460b2df81640494ac548071326dcedbcf496ceb6002601d1ba58c546390d951d15c52
|
data/Gemfile.lock
CHANGED
@@ -26,8 +26,12 @@ module SemanticDateTimeTags
|
|
26
26
|
(date_from - date_to) <= 7
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
date_from == date_to
|
29
|
+
def same_day?
|
30
|
+
date_from.to_date == date_to.to_date
|
31
|
+
end
|
32
|
+
|
33
|
+
def same_time?
|
34
|
+
date_from.to_time == date_to.to_time
|
31
35
|
end
|
32
36
|
|
33
37
|
def both_in_current_year?
|
@@ -44,7 +48,8 @@ module SemanticDateTimeTags
|
|
44
48
|
res << 'current_year' if both_in_current_year?
|
45
49
|
res << 'same_month' unless spans_months?
|
46
50
|
res << 'more_than_a_week' unless within_a_week?
|
47
|
-
res << 'same_day' if
|
51
|
+
res << 'same_day' if same_day?
|
52
|
+
res << 'same_time' if same_time?
|
48
53
|
res
|
49
54
|
end
|
50
55
|
|
@@ -154,11 +154,19 @@ describe SemanticDateTimeTags::ViewHelpers do
|
|
154
154
|
let(:date_time_object_to) { DateTime.parse('11/11/2015') }
|
155
155
|
|
156
156
|
it 'returns the from date wrapped correctly' do
|
157
|
-
semantic_date_range_tag(date_object, date_tomorrow_object).must_match /<time.+?semantic.+?date.+?from.+?>/
|
157
|
+
semantic_date_range_tag(date_object, date_tomorrow_object).must_match /<time.+?semantic.+?date.+?from.+?>.+?<time.+?semantic.+?date.+?to.+?>/
|
158
158
|
end
|
159
159
|
|
160
160
|
it 'adds same_year and current_year class to wrapping span' do
|
161
|
-
semantic_date_range_tag(date_object, date_tomorrow_object).must_match
|
161
|
+
semantic_date_range_tag(date_object, date_tomorrow_object).must_match /\A<span.+?date_range.+?current_year.+?>/
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'adds same_day to wrapping span' do
|
165
|
+
semantic_date_range_tag(date_time_object_from, date_time_object_from).must_match /\A<span.+?date_range.+?same_day.+?>/
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'adds same_time to wrapping span' do
|
169
|
+
semantic_date_range_tag(date_time_object_from, date_time_object_from).must_match /\A<span.+?date_range.+?same_day.+?same_time.+?>/
|
162
170
|
end
|
163
171
|
|
164
172
|
it 'accepts datetime objects' do
|