kinetic_cafe_error 1.9 → 1.10

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: fec4aacd3216e7dd65b34bc85e3c6f6a388de85d
4
- data.tar.gz: b7456d64b7ad2bf4b8c0260d70543e552506de13
3
+ metadata.gz: ed2b06cb85a613bdd8ac56aa6e8216188f257395
4
+ data.tar.gz: 7077a564338ef9bb8f885c51e86c36033b975671
5
5
  SHA512:
6
- metadata.gz: 777e6024ab58cc36d601b584dec51eb5ed0e9e2cc58b37741f75c71232568e5ada44653c283ea59c5aadcafb27b8675d363cec706a5b413ba202c8d84b963064
7
- data.tar.gz: 85348156230d8e3ed1ef759b99202e06e1f0d24e8cc600fb032b0543fceae617f0041659bd9fe09540ab6b25f5648de866055f90d4d955c5e93dc59795f6058d
6
+ metadata.gz: 94f9b44dbd23fe6ac116dae799503402231d89d7ceb76fdec18cd781c6933d09e7ad471626bc515cfdd324275b25d11cd05981f6a1edb71dde6f530e8ab3840b
7
+ data.tar.gz: c0c6d9491699c4b9f184774552688b35c8fe0b21514e865d26811a4e488b7c5239329335850ab4fc6c4b42b3ddc26ac8ec1874e4f21ececbf9c0d2489c3b59b2
data/.travis.yml CHANGED
@@ -1,19 +1,24 @@
1
1
  ---
2
2
  language: ruby
3
3
  rvm:
4
- - 2.2.2
5
- - 2.1.6
6
- - jruby-9.0.0.0
4
+ - 2.3.0
5
+ - 2.2.4
6
+ - 2.1
7
+ - jruby-9.0.4.0
7
8
  - jruby-head
8
9
  - ruby-head
9
10
  - rbx-2
10
11
  matrix:
12
+ exclude:
13
+ - rvm: 2.1
14
+ gemfile: gemfiles/rack_2.gemfile
11
15
  allow_failures:
12
16
  - rvm: rbx-2
13
17
  - rvm: jruby-head
14
18
  - rvm: ruby-head
15
19
  gemfile:
16
- - Gemfile
20
+ - gemfiles/rack_1.6.gemfile
21
+ - gemfiles/rack_2.gemfile
17
22
  before_script:
18
23
  - |
19
24
  case "${TRAVIS_RUBY_VERSION}" in
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise 'rack-1.6' do
2
+ gem 'rack', '~> 1.6'
3
+ end
4
+
5
+ appraise 'rack-2' do
6
+ gem 'rack', '~> 2.0.alpha'
7
+ end
data/History.rdoc CHANGED
@@ -1,3 +1,13 @@
1
+ === 1.10 / 2016-03-25
2
+
3
+ * 1 bug fix:
4
+
5
+ * Protect against names with punctuation in them.
6
+
7
+ * 1 testing change:
8
+
9
+ * Add Appraisals to test against both Rack 1.6 and Rack 2.0.
10
+
1
11
  === 1.9 / 2015-11-30
2
12
 
3
13
  * 2 bug fixes:
data/Manifest.txt CHANGED
@@ -2,6 +2,7 @@
2
2
  .gemtest
3
3
  .rubocop.yml
4
4
  .travis.yml
5
+ Appraisals
5
6
  Contributing.rdoc
6
7
  Gemfile
7
8
  History.rdoc
@@ -23,6 +24,8 @@ config/locales/kinetic_cafe_error.en-US.yml
23
24
  config/locales/kinetic_cafe_error.en.yml
24
25
  config/locales/kinetic_cafe_error.fr-CA.yml
25
26
  config/locales/kinetic_cafe_error.fr.yml
27
+ gemfiles/rack_1.6.gemfile
28
+ gemfiles/rack_2.gemfile
26
29
  lib/kinetic_cafe/error.rb
27
30
  lib/kinetic_cafe/error/minitest.rb
28
31
  lib/kinetic_cafe/error_dsl.rb
data/Rakefile CHANGED
@@ -23,6 +23,7 @@ spec = Hoe.spec 'kinetic_cafe_error' do
23
23
 
24
24
  license 'MIT'
25
25
 
26
+ extra_dev_deps << ['appraisal', '~> 2.1']
26
27
  extra_dev_deps << ['hoe-doofus', '~> 1.0']
27
28
  extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
28
29
  extra_dev_deps << ['hoe-git', '~> 1.6']
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org/"
4
+
5
+ gem "rack", "~> 1.6"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org/"
4
+
5
+ gem "rack", "~> 2.0.alpha"
6
+
7
+ gemspec :path => "../"
@@ -25,7 +25,7 @@ module KineticCafe # :nodoc:
25
25
  # rescue clause and handled there, as is shown in the included
26
26
  # KineticCafe::ErrorHandler controller concern for Rails.
27
27
  class Error < ::StandardError
28
- VERSION = '1.9' # :nodoc:
28
+ VERSION = '1.10' # :nodoc:
29
29
 
30
30
  # Get the KineticCafe::Error functionality.
31
31
  include KineticCafe::ErrorModule
@@ -103,6 +103,7 @@ module KineticCafe
103
103
  end
104
104
 
105
105
  key.tap do |k|
106
+ k.gsub!(/[^[:word:]]/, '_')
106
107
  k.squeeze!('_')
107
108
  k.gsub!(/^_+/, '')
108
109
  k.gsub!(/_+$/, '')
@@ -177,6 +178,8 @@ module KineticCafe
177
178
 
178
179
  if defined?(Rack::Utils) && rack_status
179
180
  Rack::Utils::SYMBOL_TO_STATUS_CODE.each_key do |name|
181
+ # Make the Rack names safe to use
182
+ name = name.to_s.gsub(/[^[:word:]]/, '_').squeeze('_').to_sym
180
183
  if rack_status.fetch(:methods, true)
181
184
  base.singleton_class.send :define_method, name do |options = {}|
182
185
  define_error(options.merge(status: name))
data/test/test_helper.rb CHANGED
@@ -9,6 +9,8 @@ require 'minitest-bonus-assertions'
9
9
  require 'rack/test'
10
10
  require 'kinetic_cafe_error'
11
11
 
12
+ puts "Testing with Rack.release #{Rack.release}"
13
+
12
14
  unless defined? I18n.translate
13
15
  module I18n
14
16
  def self.translate(*)
@@ -104,6 +104,12 @@ describe KineticCafe::ErrorDSL do
104
104
  refute base.private_instance_methods.include?(:default_severity)
105
105
  assert_equal :error, instance.send(:default_severity)
106
106
  end
107
+
108
+ it 'strips non-word characters from a key' do
109
+ child = base.define_error key: :"child(ren)"
110
+ instance = child.new
111
+ assert_equal 'child_ren', instance.name
112
+ end
107
113
  end
108
114
 
109
115
  describe 'class-based definition' do
@@ -184,6 +190,11 @@ describe KineticCafe::ErrorDSL do
184
190
  refute base.private_instance_methods.include?(:default_status)
185
191
  assert_equal :not_found, instance.send(:default_status)
186
192
  end
193
+
194
+ it 'strips non-word characters from a key' do
195
+ base.define_error class: :"child(ren)", status: :not_found
196
+ assert base.const_defined?(:ChildRenNotFound)
197
+ end
187
198
  end
188
199
 
189
200
  describe 'with numeric status' do
@@ -279,6 +290,20 @@ describe KineticCafe::ErrorDSL do
279
290
  assert base.respond_to?(:not_found)
280
291
  refute base.const_defined?(:NotFound)
281
292
  end
293
+
294
+ it 'protects against badly named Rack status symbols' do
295
+ begin
296
+ Rack::Utils::SYMBOL_TO_STATUS_CODE[:"another_(silly)_love_song"] = 999
297
+ base = Class.new(StandardError) do
298
+ extend KineticCafe::ErrorDSL
299
+ end
300
+ assert base.respond_to?(:another_silly_love_song)
301
+ assert base.const_defined?(:AnotherSillyLoveSong)
302
+ ensure
303
+ Rack::Utils::SYMBOL_TO_STATUS_CODE.delete(:"another_(silly)_love_song")
304
+ $debugme = false
305
+ end
306
+ end
282
307
  end
283
308
 
284
309
  describe 'when Rack::Utils is not defined' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kinetic_cafe_error
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.9'
4
+ version: '1.10'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-30 00:00:00.000000000 Z
12
+ date: 2016-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '4.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: appraisal
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '2.1'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '2.1'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: hoe-doofus
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -317,6 +331,7 @@ files:
317
331
  - ".gemtest"
318
332
  - ".rubocop.yml"
319
333
  - ".travis.yml"
334
+ - Appraisals
320
335
  - Contributing.rdoc
321
336
  - Gemfile
322
337
  - History.rdoc
@@ -338,6 +353,8 @@ files:
338
353
  - config/locales/kinetic_cafe_error.en.yml
339
354
  - config/locales/kinetic_cafe_error.fr-CA.yml
340
355
  - config/locales/kinetic_cafe_error.fr.yml
356
+ - gemfiles/rack_1.6.gemfile
357
+ - gemfiles/rack_2.gemfile
341
358
  - lib/kinetic_cafe/error.rb
342
359
  - lib/kinetic_cafe/error/minitest.rb
343
360
  - lib/kinetic_cafe/error_dsl.rb
@@ -373,7 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
373
390
  version: '0'
374
391
  requirements: []
375
392
  rubyforge_project:
376
- rubygems_version: 2.4.8
393
+ rubygems_version: 2.5.1
377
394
  signing_key:
378
395
  specification_version: 4
379
396
  summary: kinetic_cafe_error provides an API-smart error base class and a DSL for defining