semantic_date_time_tags 0.1.0 → 0.1.1

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: aeed110b330e1302a7615ba2f93304b79e62a30c
4
- data.tar.gz: cdca5a50d3f7f8e526eaf41e96edd931415d86f4
3
+ metadata.gz: 79bb159f76d3aae87754132521256adb42d4af3b
4
+ data.tar.gz: 238f627566b3faa219b34c7372bdf032c6d02ccd
5
5
  SHA512:
6
- metadata.gz: 79e1b964be9feb59c656b2737c6262fba6c6ae850cc4582e0ad77f6d458c0b2730ec0169ed470bbfc5d1d5611985965b03cb9fda99c869e9bc7d54ab81df8054
7
- data.tar.gz: 5262805904fb6d6ce1411f4bb230b5dc7f537a777d1c20b133b04ef38003d781993d9d12e8bf79631804666cacd2202ae07c64c5db1f8ee49f0d85d03ae89a92
6
+ metadata.gz: 19a967ab0238fec82409a75e7c0f1353d2226249581c82210d2ed83c72fac2c9cab7c83794e8a9c6649a2d4449ff9313e94b9e8349b32562bd4ba99d72ee046d
7
+ data.tar.gz: 8369d436ddba33829a3f1903866b78fb4ed5f4f2c09d2a4c420600e721480cf62ca3934c6b810720d7600da6584218b42be190f334dbfc2610b2b0e95a085509
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- semantic_date_time_tags (0.1.0)
4
+ semantic_date_time_tags (0.1.1)
5
5
  rails (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -18,6 +18,7 @@ module SemanticDateTimeTags
18
18
  end
19
19
 
20
20
  options[:class] = dom_classes
21
+ options[:data] = dom_data
21
22
 
22
23
  value = SemanticDateTimeTags::FormatParser.new(format_string, localized_obj).to_html.html_safe
23
24
 
@@ -77,9 +77,7 @@ module SemanticDateTimeTags
77
77
  # ---------------------------------------------------------------------
78
78
 
79
79
  def dom_data
80
- {
81
- in_words: in_words
82
- }
80
+ { in_words: in_words }
83
81
  end
84
82
 
85
83
  private # =============================================================
@@ -1,3 +1,3 @@
1
1
  module SemanticDateTimeTags
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -4,10 +4,9 @@ require 'semantic_date_time_tags/view_helpers'
4
4
  describe SemanticDateTimeTags::ViewHelpers do
5
5
  include SemanticDateTimeTags::ViewHelpers
6
6
 
7
- let(:time_object) { Time.parse('31/10/2015') }
8
7
  let(:date_object) { Date.parse('31/10/2015') }
9
8
  let(:date_tomorrow_object) { Date.parse('31/10/2015')+1.day }
10
- let(:date_time_object) { DateTime.parse('31/10/2015') }
9
+ let(:time_object) { Time.parse('31/10/2015') }
11
10
 
12
11
  # ---------------------------------------------------------------------
13
12
 
@@ -123,6 +122,10 @@ describe SemanticDateTimeTags::ViewHelpers do
123
122
  # ---------------------------------------------------------------------
124
123
 
125
124
  describe '#semantic_date_time_tag' do
125
+ let(:date_time_object) { DateTime.parse('31/10/2015') }
126
+ let(:date_time_object_noon) { DateTime.parse('31/10/2015').noon }
127
+ let(:date_time_object_midnight) { DateTime.parse('31/10/2015').midnight }
128
+
126
129
  it 'only works with a time or date_time object' do
127
130
  proc { semantic_date_time_tag(time_object) }.must_raise RuntimeError
128
131
  end
@@ -131,8 +134,16 @@ describe SemanticDateTimeTags::ViewHelpers do
131
134
  semantic_date_time_tag(date_time_object).must_match /\A<time.+?<\/time>\z/
132
135
  end
133
136
 
137
+ it 'adds noon as data-in-words if time is noon' do
138
+ semantic_date_time_tag(date_time_object_noon).must_match /\A<time.+?data-in-words=\"noon\".+?<\/time>\z/
139
+ end
140
+
141
+ it 'adds midnight as data-in-words if time is midnight' do
142
+ semantic_date_time_tag(date_time_object_midnight).must_match /\A<time.+?data-in-words=\"midnight\".+?<\/time>\z/
143
+ end
144
+
134
145
  it 'allows to pass :format' do
135
- semantic_date_time_tag(date_time_object, all_day: false, format: :test).must_include '~'
146
+ semantic_date_time_tag(date_time_object, format: :test).must_include '~'
136
147
  end
137
148
  end
138
149
 
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna