condensation 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.rubocop_todo.yml +35 -0
  4. data/Rakefile +6 -6
  5. data/condensation.gemspec +18 -16
  6. data/lib/condensation.rb +9 -7
  7. data/lib/condensation/extensions.rb +7 -5
  8. data/lib/condensation/filters.rb +15 -13
  9. data/lib/condensation/filters/advance_date_to_next.rb +13 -9
  10. data/lib/condensation/filters/at_midnight.rb +12 -8
  11. data/lib/condensation/filters/days_since.rb +10 -6
  12. data/lib/condensation/filters/days_until.rb +10 -6
  13. data/lib/condensation/filters/default.rb +2 -2
  14. data/lib/condensation/filters/hmac_sha256.rb +12 -0
  15. data/lib/condensation/filters/hyperlink.rb +1 -1
  16. data/lib/condensation/filters/in_time_zone.rb +6 -6
  17. data/lib/condensation/filters/md5.rb +12 -0
  18. data/lib/condensation/filters/replace_inner_html.rb +4 -4
  19. data/lib/condensation/filters/strip_commas.rb +2 -2
  20. data/lib/condensation/filters/url_encode.rb +4 -2
  21. data/lib/condensation/filters/weeks_since.rb +10 -6
  22. data/lib/condensation/filters/weeks_until.rb +10 -6
  23. data/lib/condensation/sanitizer.rb +4 -2
  24. data/lib/condensation/version.rb +1 -1
  25. data/spec/condensation/filters/advance_date_to_next_spec.rb +39 -39
  26. data/spec/condensation/filters/at_midnight_spec.rb +29 -29
  27. data/spec/condensation/filters/days_since_spec.rb +34 -34
  28. data/spec/condensation/filters/days_until_spec.rb +39 -39
  29. data/spec/condensation/filters/default_spec.rb +19 -19
  30. data/spec/condensation/filters/hmac_sha256_spec.rb +21 -0
  31. data/spec/condensation/filters/hyperlink_spec.rb +23 -23
  32. data/spec/condensation/filters/in_time_zone_spec.rb +10 -10
  33. data/spec/condensation/filters/md5_spec.rb +21 -0
  34. data/spec/condensation/filters/replace_inner_html_spec.rb +10 -10
  35. data/spec/condensation/filters/strip_commas_spec.rb +10 -10
  36. data/spec/condensation/filters/timestamp_spec.rb +34 -34
  37. data/spec/condensation/filters/url_encode_spec.rb +10 -10
  38. data/spec/condensation/filters/weeks_since_spec.rb +34 -34
  39. data/spec/condensation/filters/weeks_until_spec.rb +39 -39
  40. data/spec/condensation/sanitizer_spec.rb +4 -4
  41. data/spec/condensation_spec.rb +1 -1
  42. data/spec/spec_helper.rb +1 -2
  43. metadata +25 -3
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
2
 
3
3
  describe Condensation::Filters::WeeksUntil do
4
4
  def render_with_filter(template, context)
5
- template.render(context, :filters => [Condensation::Filters::WeeksUntil])
5
+ template.render(context, filters: [Condensation::Filters::WeeksUntil])
6
6
  end
7
7
 
8
8
  let(:now) do
@@ -17,59 +17,59 @@ describe Condensation::Filters::WeeksUntil do
17
17
  Timecop.return
18
18
  end
19
19
 
20
- it "should handle UTC ISO 8601 dates" do
21
- created_at = "2014-05-30T10:00:00Z"
22
- template = Liquid::Template.parse("{{ created_at | weeks_until }}")
23
- result = render_with_filter(template, { "created_at" => created_at })
24
- result.must_equal "2"
20
+ it 'should handle UTC ISO 8601 dates' do
21
+ created_at = '2014-05-30T10:00:00Z'
22
+ template = Liquid::Template.parse('{{ created_at | weeks_until }}')
23
+ result = render_with_filter(template, 'created_at' => created_at)
24
+ result.must_equal '2'
25
25
  end
26
26
 
27
- it "should handle non-UTC ISO 8601 dates" do
28
- created_at = "2014-05-30T20:00:00-07:00"
29
- template = Liquid::Template.parse("{{ created_at | weeks_until }}")
30
- result = render_with_filter(template, { "created_at" => created_at })
31
- result.must_equal "2"
27
+ it 'should handle non-UTC ISO 8601 dates' do
28
+ created_at = '2014-05-30T20:00:00-07:00'
29
+ template = Liquid::Template.parse('{{ created_at | weeks_until }}')
30
+ result = render_with_filter(template, 'created_at' => created_at)
31
+ result.must_equal '2'
32
32
  end
33
33
 
34
- it "should handle YMD formatted dates" do
35
- created_at = "2014-05-30"
36
- template = Liquid::Template.parse("{{ created_at | weeks_until }}")
37
- result = render_with_filter(template, { "created_at" => created_at })
38
- result.must_equal "2"
34
+ it 'should handle YMD formatted dates' do
35
+ created_at = '2014-05-30'
36
+ template = Liquid::Template.parse('{{ created_at | weeks_until }}')
37
+ result = render_with_filter(template, 'created_at' => created_at)
38
+ result.must_equal '2'
39
39
  end
40
40
 
41
- it "should handle Time input" do
41
+ it 'should handle Time input' do
42
42
  created_at = Time.utc(2014, 6, 15, 0, 0, 0)
43
- template = Liquid::Template.parse("{{ created_at | weeks_until }}")
44
- result = render_with_filter(template, { "created_at" => created_at })
45
- result.must_equal "4"
43
+ template = Liquid::Template.parse('{{ created_at | weeks_until }}')
44
+ result = render_with_filter(template, 'created_at' => created_at)
45
+ result.must_equal '4'
46
46
  end
47
47
 
48
- it "should handle malformed dates" do
49
- created_at = "foo"
50
- template = Liquid::Template.parse("{{ created_at | weeks_until }}")
51
- result = render_with_filter(template, { "created_at" => created_at })
52
- result.must_equal ""
48
+ it 'should handle malformed dates' do
49
+ created_at = 'foo'
50
+ template = Liquid::Template.parse('{{ created_at | weeks_until }}')
51
+ result = render_with_filter(template, 'created_at' => created_at)
52
+ result.must_equal ''
53
53
  end
54
54
 
55
- it "should be zero for days in the past" do
56
- created_at = "2014-05-01T20:00:00Z"
57
- template = Liquid::Template.parse("{{ created_at | weeks_until }}")
58
- result = render_with_filter(template, { "created_at" => created_at })
59
- result.must_equal "0"
55
+ it 'should be zero for days in the past' do
56
+ created_at = '2014-05-01T20:00:00Z'
57
+ template = Liquid::Template.parse('{{ created_at | weeks_until }}')
58
+ result = render_with_filter(template, 'created_at' => created_at)
59
+ result.must_equal '0'
60
60
  end
61
61
 
62
- it "should handle empty string input" do
63
- created_at = ""
64
- template = Liquid::Template.parse("{{ created_at | weeks_until }}")
65
- result = render_with_filter(template, { "created_at" => created_at })
66
- result.must_equal ""
62
+ it 'should handle empty string input' do
63
+ created_at = ''
64
+ template = Liquid::Template.parse('{{ created_at | weeks_until }}')
65
+ result = render_with_filter(template, 'created_at' => created_at)
66
+ result.must_equal ''
67
67
  end
68
68
 
69
- it "should handle nil input" do
69
+ it 'should handle nil input' do
70
70
  created_at = nil
71
- template = Liquid::Template.parse("{{ created_at | weeks_until }}")
72
- result = render_with_filter(template, { "created_at" => created_at })
73
- result.must_equal ""
71
+ template = Liquid::Template.parse('{{ created_at | weeks_until }}')
72
+ result = render_with_filter(template, 'created_at' => created_at)
73
+ result.must_equal ''
74
74
  end
75
75
  end
@@ -1,11 +1,11 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper.rb'
2
2
 
3
3
  describe Condensation::Sanitizer do
4
- describe "#escape_html" do
5
- it "should escape HTML entities" do
4
+ describe '#escape_html' do
5
+ it 'should escape HTML entities' do
6
6
  html = "<div><a href='http://foo.bar/?x=r%20b&y=z'>Baz</a></div>"
7
- escaped = "&lt;div&gt;&lt;a href=&#39;http://foo.bar/?x=r%20b&amp;y=z&#39;&gt;Baz&lt;/a&gt;&lt;/div&gt;"
7
+ escaped = '&lt;div&gt;&lt;a href=&#39;http://foo.bar/?x=r%20b&amp;y=z&#39;&gt;Baz&lt;/a&gt;&lt;/div&gt;'
8
8
  Condensation::Sanitizer.new(html).escape_html.must_equal(escaped)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,7 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe Condensation do
4
- describe "#register_filters" do
4
+ describe '#register_filters' do
5
5
  # TODO
6
6
  end
7
7
  end
@@ -1,6 +1,5 @@
1
- $:.unshift File.expand_path('../../lib', __FILE__)
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
 
3
3
  require 'condensation'
4
4
  require 'timecop'
5
- require 'minitest/spec'
6
5
  require 'minitest/autorun'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: condensation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derrick Reimer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-04 00:00:00.000000000 Z
11
+ date: 2017-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: liquid
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,8 @@ extensions: []
108
122
  extra_rdoc_files: []
109
123
  files:
110
124
  - ".gitignore"
125
+ - ".rubocop.yml"
126
+ - ".rubocop_todo.yml"
111
127
  - Gemfile
112
128
  - LICENSE.txt
113
129
  - README.md
@@ -121,8 +137,10 @@ files:
121
137
  - lib/condensation/filters/days_since.rb
122
138
  - lib/condensation/filters/days_until.rb
123
139
  - lib/condensation/filters/default.rb
140
+ - lib/condensation/filters/hmac_sha256.rb
124
141
  - lib/condensation/filters/hyperlink.rb
125
142
  - lib/condensation/filters/in_time_zone.rb
143
+ - lib/condensation/filters/md5.rb
126
144
  - lib/condensation/filters/replace_inner_html.rb
127
145
  - lib/condensation/filters/strip_commas.rb
128
146
  - lib/condensation/filters/timestamp.rb
@@ -136,8 +154,10 @@ files:
136
154
  - spec/condensation/filters/days_since_spec.rb
137
155
  - spec/condensation/filters/days_until_spec.rb
138
156
  - spec/condensation/filters/default_spec.rb
157
+ - spec/condensation/filters/hmac_sha256_spec.rb
139
158
  - spec/condensation/filters/hyperlink_spec.rb
140
159
  - spec/condensation/filters/in_time_zone_spec.rb
160
+ - spec/condensation/filters/md5_spec.rb
141
161
  - spec/condensation/filters/replace_inner_html_spec.rb
142
162
  - spec/condensation/filters/strip_commas_spec.rb
143
163
  - spec/condensation/filters/timestamp_spec.rb
@@ -167,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
187
  version: '0'
168
188
  requirements: []
169
189
  rubyforge_project:
170
- rubygems_version: 2.4.5
190
+ rubygems_version: 2.5.1
171
191
  signing_key:
172
192
  specification_version: 4
173
193
  summary: Condensation is a collection of handy extensions to the Liquid templating
@@ -178,8 +198,10 @@ test_files:
178
198
  - spec/condensation/filters/days_since_spec.rb
179
199
  - spec/condensation/filters/days_until_spec.rb
180
200
  - spec/condensation/filters/default_spec.rb
201
+ - spec/condensation/filters/hmac_sha256_spec.rb
181
202
  - spec/condensation/filters/hyperlink_spec.rb
182
203
  - spec/condensation/filters/in_time_zone_spec.rb
204
+ - spec/condensation/filters/md5_spec.rb
183
205
  - spec/condensation/filters/replace_inner_html_spec.rb
184
206
  - spec/condensation/filters/strip_commas_spec.rb
185
207
  - spec/condensation/filters/timestamp_spec.rb