scorpion-ioc 0.5.12 → 0.5.13

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: 26f6b97f16d1b60f0a4643d3490011b0f9243249
4
- data.tar.gz: 2e17bdbf0e8b42afc657e9ed32f70ff72e571ca8
3
+ metadata.gz: 2707ee5f873ced43d6fcbbd383fc2d055dc71fb7
4
+ data.tar.gz: de8955d86ecb98696c7734d89e539463aafe26a7
5
5
  SHA512:
6
- metadata.gz: dda56d8d4eb81fcccfa1a74d8bab69780cbef9dbec885d3708fe524ae654f8e40a96442363804c259a3e21152d0406eac39b1e5ded82f3b1fbd1eb4cdba86995
7
- data.tar.gz: 6fb8b248262d963cbcf41d5fe852406fe64005521999287a3983f140ce5999b7931fa673963ddf8b321c2e403e3c69168f2a9531af1eb01c805a0a47f2b99f83
6
+ metadata.gz: ac6c07abf770a6d836d8031cc35dd1825e45066bbad7d0cc11077f2c5af2f492963e412f4fedfad5f3c5b8b9e8295ba7b6a84cb4fac45545a52e7efe3bd3cac4
7
+ data.tar.gz: f2982774adc0dbe4ed94247917a5e869b8be1bf819e8da78103302bd9b9ca692b5ec44b7dfe8b3c10a0264382127c0df526bf79eec2adc248c2db95faacf15f3
@@ -5,6 +5,7 @@ en:
5
5
  unsuccessful_hunt: "Couldn't find a %{contract} builder with traits '%{traits}'"
6
6
  builder_required: A custom builder must be provided to resolve this dependency
7
7
  arity_mismatch: The block must accept %{expected} arguments, but actually expects %{actual}
8
+ rack_missing_scorpion: Scorpion not set. Add Scorpion::Rack::Middleware before %{middleware}.
8
9
  warnings:
9
10
  messages:
10
11
  mixed_scorpions: A scorpion has already been assigned. Mixing scorpions can result in unexpected results.
@@ -0,0 +1,15 @@
1
+ module Scorpion
2
+
3
+ # Add scorpion support to a Rack middleware.
4
+ module Rack
5
+ private
6
+
7
+ def scorpion( env )
8
+ env[ Middleware::ENV_KEY ] || fail( MissingScorpionError.new( self.class.name ) )
9
+ end
10
+ end
11
+ end
12
+
13
+ require "scorpion/rack/env"
14
+ require "scorpion/rack/middleware"
15
+ require "scorpion/rack/missing_scorpion_error"
@@ -0,0 +1,11 @@
1
+ module Scorpion
2
+ module Rack
3
+ class MissingScorpionError < Scorpion::Error
4
+
5
+ def initialize( middleware )
6
+ super translate( :rack_missing_scorpion, middleware: middleware )
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module Scorpion
2
- VERSION_NUMBER = "0.5.12"
2
+ VERSION_NUMBER = "0.5.13"
3
3
  VERSION_SUFFIX = ""
4
4
  VERSION = "#{VERSION_NUMBER}#{VERSION_SUFFIX}"
5
5
  end
@@ -0,0 +1,19 @@
1
+ require "spec_helper"
2
+ require "scorpion/rack"
3
+
4
+ describe Scorpion::Rack do
5
+ it "it raises error when out of order" do
6
+ klass = Class.new do
7
+ include Scorpion::Rack
8
+
9
+ def call( env )
10
+ scorpion( env )
11
+ end
12
+ end
13
+
14
+ expect do
15
+ request = Rack::MockRequest.new( klass.new() )
16
+ request.get "/"
17
+ end.to raise_error Scorpion::Rack::MissingScorpionError
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorpion-ioc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Alexander
@@ -150,8 +150,10 @@ files:
150
150
  - lib/scorpion/nest.rb
151
151
  - lib/scorpion/object.rb
152
152
  - lib/scorpion/object_constructor.rb
153
+ - lib/scorpion/rack.rb
153
154
  - lib/scorpion/rack/env.rb
154
155
  - lib/scorpion/rack/middleware.rb
156
+ - lib/scorpion/rack/missing_scorpion_error.rb
155
157
  - lib/scorpion/rails.rb
156
158
  - lib/scorpion/rails/active_record.rb
157
159
  - lib/scorpion/rails/active_record/association.rb
@@ -187,6 +189,7 @@ files:
187
189
  - spec/lib/scorpion/object_constructor_spec.rb
188
190
  - spec/lib/scorpion/object_spec.rb
189
191
  - spec/lib/scorpion/rack/middleware_spec.rb
192
+ - spec/lib/scorpion/rack_spec.rb
190
193
  - spec/lib/scorpion/rails/active_record/association_spec.rb
191
194
  - spec/lib/scorpion/rails/active_record/model_spec.rb
192
195
  - spec/lib/scorpion/rails/active_record/relation_spec.rb
@@ -240,6 +243,7 @@ test_files:
240
243
  - spec/lib/scorpion/object_constructor_spec.rb
241
244
  - spec/lib/scorpion/object_spec.rb
242
245
  - spec/lib/scorpion/rack/middleware_spec.rb
246
+ - spec/lib/scorpion/rack_spec.rb
243
247
  - spec/lib/scorpion/rails/active_record/association_spec.rb
244
248
  - spec/lib/scorpion/rails/active_record/model_spec.rb
245
249
  - spec/lib/scorpion/rails/active_record/relation_spec.rb