semantic_date_time_tags 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ee2c053c9967565aaa846cf164a4e8af240fc5c
4
- data.tar.gz: b67a8b34e50ab27ad27cf1d35e4a116b0617c53a
3
+ metadata.gz: 04a9f9eb96b80d36f9d660f34eac82fda8d0fb50
4
+ data.tar.gz: 483e6454d79275d34e1a2605703e5edc7a5eeee3
5
5
  SHA512:
6
- metadata.gz: ca0eb847461cba0a45b47e2e1a6445d84e4fea670409e59a4d5629a91bfd51f5401243dd2d49fc304ef31020df42fefaad0e0b2491a819f2be1f69af5eaa085b
7
- data.tar.gz: f014843a7000608d2b0f69d50cdd16360c87e26022efbbeb49ab5bb2552e93e1651b6a54c50d98d60e348ce5c117bd20b9e7ad18b56d40ea6bdfdfec91f22ca2
6
+ metadata.gz: e4263c6e8e7f5321874423f268f1f88064cbfc2e029e5046bbc7e1fd2084222fb32b17f2de84aab7e471d5c0a6a36169036b237babcfb767d83c0d2bd66c70d9
7
+ data.tar.gz: 96ae029138cd5ded63b6867e57e2e65cb6a278437939bef313d5d7faeb7460b2df81640494ac548071326dcedbcf496ceb6002601d1ba58c546390d951d15c52
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- semantic_date_time_tags (0.1.2)
4
+ semantic_date_time_tags (0.1.3)
5
5
  rails (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -26,8 +26,12 @@ module SemanticDateTimeTags
26
26
  (date_from - date_to) <= 7
27
27
  end
28
28
 
29
- def one_day?
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 one_day?
51
+ res << 'same_day' if same_day?
52
+ res << 'same_time' if same_time?
48
53
  res
49
54
  end
50
55
 
@@ -1,3 +1,3 @@
1
1
  module SemanticDateTimeTags
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -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 /<time.+?date_range.+?current_year.+?>/
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_date_time_tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna