scorpion-ioc 0.6.0 → 0.6.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 +4 -4
- data/.ruby-version +1 -1
- data/bin/rspec +17 -0
- data/lib/scorpion/rspec/helper.rb +15 -0
- data/lib/scorpion/version.rb +1 -1
- data/spec/lib/scorpion/rails/controller_spec.rb +15 -9
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e1ee73f894ab57634fbe1f1eb2a162b469cb569
|
4
|
+
data.tar.gz: e4f8915f1d95b9ad6f0e6545207c10c3de3d0a8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b6a6c1f1aabee3940ffff6a326445a4a30bcd3c0ebf6582411fd2b644ae131b34756de4036c5f63b8e20884f2d130a94f4743b49fb60d938075d8e679fe022d
|
7
|
+
data.tar.gz: 4dd7b17c65d5706f475ad69894bf1fdd63fa549a329a9ffe0d1e6e872b56c8b3883717d319f63d0cff36b835bf952559e56d93af415ade1d49f1db6805f6c889
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.1
|
data/bin/rspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rspec' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rspec-core", "rspec")
|
@@ -11,6 +11,21 @@ module Scorpion
|
|
11
11
|
base.infest_nest ActiveJob::Base if defined? ActiveJob::Base
|
12
12
|
base.infest_nest ActionMailer::Base if defined? ActionMailer::Base
|
13
13
|
|
14
|
+
base.before( :each ) do
|
15
|
+
allow( Scorpion ).to receive( :instance ) do
|
16
|
+
# Always override the 'global' scorpion with the scorpion from the
|
17
|
+
# spec. Any existing nests will not be affected, only code the
|
18
|
+
# naively reaches into global scorpion context.
|
19
|
+
@@global_scorpion_warned ||=
|
20
|
+
begin
|
21
|
+
puts( "Using global scorpion is not recommended. Objects should be created with scorpion.fetch or scorpion.new" )
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
scorpion
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
14
29
|
super
|
15
30
|
end
|
16
31
|
|
data/lib/scorpion/version.rb
CHANGED
@@ -57,19 +57,25 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it "retrieves scorpion from `env`" do
|
60
|
-
expect( subject
|
61
|
-
.
|
62
|
-
|
63
|
-
|
60
|
+
expect( subject ).to receive( :scorpion ).at_least( :once ).and_wrap_original do |method, *args|
|
61
|
+
scorpion = method.call( *args )
|
62
|
+
expect( scorpion ).to be subject.request.env[ Scorpion::Rails::Controller::ENV_KEY ]
|
63
|
+
|
64
|
+
scorpion
|
65
|
+
end
|
64
66
|
|
65
67
|
get :index
|
66
68
|
end
|
67
69
|
|
68
70
|
it "stores the scorpion in `env`" do
|
69
|
-
expect( subject
|
70
|
-
|
71
|
-
|
72
|
-
|
71
|
+
expect( subject ).to receive( :assign_scorpion ).and_wrap_original do |method, *args|
|
72
|
+
expect( subject.request.env ).to receive( :[]= )
|
73
|
+
.with( Scorpion::Rails::Controller::ENV_KEY, kind_of( Scorpion ) )
|
74
|
+
.at_least( :once )
|
75
|
+
.and_call_original
|
76
|
+
|
77
|
+
method.call( *args )
|
78
|
+
end
|
73
79
|
|
74
80
|
get :index
|
75
81
|
end
|
@@ -171,4 +177,4 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
171
177
|
get :index
|
172
178
|
end
|
173
179
|
end
|
174
|
-
end
|
180
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scorpion-ioc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Alexander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -112,7 +112,8 @@ description: Embrace convention over configuration while still benefitting from
|
|
112
112
|
injection design principles.
|
113
113
|
email:
|
114
114
|
- me@phallguy.com
|
115
|
-
executables:
|
115
|
+
executables:
|
116
|
+
- rspec
|
116
117
|
extensions: []
|
117
118
|
extra_rdoc_files: []
|
118
119
|
files:
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- LICENSE
|
129
130
|
- README.md
|
130
131
|
- Rakefile
|
132
|
+
- bin/rspec
|
131
133
|
- circle.yml
|
132
134
|
- config.ru
|
133
135
|
- lib/scorpion-ioc.rb
|