scorpion-ioc 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Gemfile +5 -6
- data/Gemfile.lock +215 -0
- data/bin/bundle +3 -0
- data/lib/scorpion-ioc.rb +1 -0
- data/lib/scorpion/attribute_set.rb +1 -1
- data/lib/scorpion/dependency.rb +1 -1
- data/lib/scorpion/dependency/captured_dependency.rb +1 -1
- data/lib/scorpion/object.rb +2 -2
- data/lib/scorpion/rails/active_record.rb +3 -3
- data/lib/scorpion/rails/controller.rb +4 -0
- data/lib/scorpion/rails/railtie.rb +3 -3
- data/lib/scorpion/stinger.rb +16 -16
- data/lib/scorpion/version.rb +1 -1
- data/spec/internal/app/assets/config/manifest.js +1 -0
- data/spec/internal/config/routes.rb +3 -1
- data/spec/internal/db/combustion_test.sqlite +0 -0
- data/spec/internal/log/test.log +1492 -0
- data/spec/lib/scorpion/rails/controller_spec.rb +11 -9
- data/spec/spec_helper.rb +3 -1
- metadata +22 -29
- data/.gitignore +0 -24
- data/.rspec +0 -2
- data/.rubocop.yml +0 -176
- data/.ruby-version +0 -1
- data/.sublimelinterrc +0 -14
- data/.yardopts +0 -7
- data/app/README +0 -1
- data/circle.yml +0 -16
- data/config.ru +0 -7
- data/config/environment.rb +0 -1
- data/lib/scorpion/locale/en.yml +0 -12
- data/scorpion.gemspec +0 -30
- data/spec/internal/log/.gitignore +0 -1
@@ -28,7 +28,8 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
28
28
|
def index
|
29
29
|
@guard1 = scorpion.fetch Test::Nest::Guard
|
30
30
|
@guard2 = scorpion.fetch Test::Nest::Guard
|
31
|
-
|
31
|
+
|
32
|
+
render json: "{}"
|
32
33
|
end
|
33
34
|
|
34
35
|
private
|
@@ -69,6 +70,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
69
70
|
|
70
71
|
it "stores the scorpion in `env`" do
|
71
72
|
expect( subject ).to receive( :assign_scorpion ).and_wrap_original do |method, *args|
|
73
|
+
allow( subject.request.env ).to receive( :[]= )
|
72
74
|
expect( subject.request.env ).to receive( :[]= )
|
73
75
|
.with( Scorpion::Rails::Controller::ENV_KEY, kind_of( Scorpion ) )
|
74
76
|
.at_least( :once )
|
@@ -81,7 +83,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
81
83
|
end
|
82
84
|
|
83
85
|
it "prepares a scorpion outside of a request when accessed" do
|
84
|
-
expect( subject.env[Scorpion::Rails::Controller::ENV_KEY] ).to be_nil
|
86
|
+
expect( subject.request.env[Scorpion::Rails::Controller::ENV_KEY] ).to be_nil
|
85
87
|
expect( subject.scorpion ).not_to be_nil
|
86
88
|
end
|
87
89
|
|
@@ -115,7 +117,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
115
117
|
allow( subject ).to receive( :index ) do
|
116
118
|
service = subject.scorpion.fetch Test::Nest::Service
|
117
119
|
expect( subject.scorpion.fetch(Test::Nest::Service) ).to be service
|
118
|
-
controller.render
|
120
|
+
controller.render json: "{}"
|
119
121
|
end
|
120
122
|
|
121
123
|
get :index
|
@@ -126,7 +128,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
126
128
|
|
127
129
|
allow( subject ).to receive( :index ) do
|
128
130
|
expect( subject.scorpion.fetch(Test::Nest::Service) ).not_to be service
|
129
|
-
controller.render
|
131
|
+
controller.render json: "{}"
|
130
132
|
end
|
131
133
|
|
132
134
|
get :index
|
@@ -135,7 +137,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
135
137
|
it "hunts for controller" do
|
136
138
|
allow( subject ).to receive( :index ) do
|
137
139
|
expect( subject.scorpion.fetch( AbstractController::Base ) ).to be subject
|
138
|
-
controller.render
|
140
|
+
controller.render json: "{}"
|
139
141
|
end
|
140
142
|
|
141
143
|
get :index
|
@@ -144,7 +146,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
144
146
|
it "hunts for response" do
|
145
147
|
allow( subject ).to receive( :index ) do
|
146
148
|
expect( subject.scorpion.fetch( ActionDispatch::Response ) ).to be subject.response
|
147
|
-
controller.render
|
149
|
+
controller.render json: "{}"
|
148
150
|
end
|
149
151
|
|
150
152
|
get :index
|
@@ -153,7 +155,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
153
155
|
it "hunts for request" do
|
154
156
|
allow( subject ).to receive( :index ) do
|
155
157
|
expect( subject.scorpion.fetch( ActionDispatch::Request ).object_id ).to be subject.request.object_id
|
156
|
-
controller.render
|
158
|
+
controller.render json: "{}"
|
157
159
|
end
|
158
160
|
|
159
161
|
get :index
|
@@ -162,7 +164,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
162
164
|
it "hunts for rack env" do
|
163
165
|
allow( subject ).to receive( :index ) do
|
164
166
|
expect( subject.scorpion.fetch( Scorpion::Rack::Env ) ).to be_present
|
165
|
-
controller.render
|
167
|
+
controller.render json: "{}"
|
166
168
|
end
|
167
169
|
|
168
170
|
get :index
|
@@ -171,7 +173,7 @@ describe Scorpion::Rails::Controller, type: :controller do
|
|
171
173
|
it "scopes relations" do
|
172
174
|
allow( subject ).to receive( :index ) do
|
173
175
|
expect( subject.scorpion( Todo ).all.scorpion ).to be subject.scorpion
|
174
|
-
controller.render
|
176
|
+
controller.render json: "{}"
|
175
177
|
end
|
176
178
|
|
177
179
|
get :index
|
data/spec/spec_helper.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Alexander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -39,35 +39,35 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: combustion
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
@@ -81,19 +81,19 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.00'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rspec-rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '3.00'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '3.00'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: sqlite3
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,16 +113,11 @@ description: Embrace convention over configuration while still benefitting from
|
|
113
113
|
email:
|
114
114
|
- me@phallguy.com
|
115
115
|
executables:
|
116
|
+
- bundle
|
116
117
|
- rspec
|
117
118
|
extensions: []
|
118
119
|
extra_rdoc_files: []
|
119
120
|
files:
|
120
|
-
- ".gitignore"
|
121
|
-
- ".rspec"
|
122
|
-
- ".rubocop.yml"
|
123
|
-
- ".ruby-version"
|
124
|
-
- ".sublimelinterrc"
|
125
|
-
- ".yardopts"
|
126
121
|
- CHANGELOG.md
|
127
122
|
- Gemfile
|
128
123
|
- Gemfile.lock
|
@@ -130,11 +125,8 @@ files:
|
|
130
125
|
- LICENSE
|
131
126
|
- README.md
|
132
127
|
- Rakefile
|
133
|
-
-
|
128
|
+
- bin/bundle
|
134
129
|
- bin/rspec
|
135
|
-
- circle.yml
|
136
|
-
- config.ru
|
137
|
-
- config/environment.rb
|
138
130
|
- lib/scorpion-ioc.rb
|
139
131
|
- lib/scorpion.rb
|
140
132
|
- lib/scorpion/attribute.rb
|
@@ -150,7 +142,6 @@ files:
|
|
150
142
|
- lib/scorpion/error.rb
|
151
143
|
- lib/scorpion/hunt.rb
|
152
144
|
- lib/scorpion/hunter.rb
|
153
|
-
- lib/scorpion/locale/en.yml
|
154
145
|
- lib/scorpion/method.rb
|
155
146
|
- lib/scorpion/nest.rb
|
156
147
|
- lib/scorpion/object.rb
|
@@ -172,13 +163,14 @@ files:
|
|
172
163
|
- lib/scorpion/rspec/helper.rb
|
173
164
|
- lib/scorpion/stinger.rb
|
174
165
|
- lib/scorpion/version.rb
|
175
|
-
-
|
166
|
+
- spec/internal/app/assets/config/manifest.js
|
176
167
|
- spec/internal/app/models/author.rb
|
177
168
|
- spec/internal/app/models/todo.rb
|
178
169
|
- spec/internal/config/database.yml
|
179
170
|
- spec/internal/config/routes.rb
|
171
|
+
- spec/internal/db/combustion_test.sqlite
|
180
172
|
- spec/internal/db/schema.rb
|
181
|
-
- spec/internal/log
|
173
|
+
- spec/internal/log/test.log
|
182
174
|
- spec/internal/public/favicon.ico
|
183
175
|
- spec/lib/scorpion/attribute_set_spec.rb
|
184
176
|
- spec/lib/scorpion/attribute_spec.rb
|
@@ -215,25 +207,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
207
|
requirements:
|
216
208
|
- - ">="
|
217
209
|
- !ruby/object:Gem::Version
|
218
|
-
version: 2.
|
210
|
+
version: 2.4.0
|
219
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
212
|
requirements:
|
221
213
|
- - ">="
|
222
214
|
- !ruby/object:Gem::Version
|
223
215
|
version: '0'
|
224
216
|
requirements: []
|
225
|
-
|
226
|
-
rubygems_version: 2.7.6
|
217
|
+
rubygems_version: 3.0.3
|
227
218
|
signing_key:
|
228
219
|
specification_version: 4
|
229
220
|
summary: Add IoC to rails with minimal fuss and ceremony
|
230
221
|
test_files:
|
222
|
+
- spec/internal/app/assets/config/manifest.js
|
231
223
|
- spec/internal/app/models/author.rb
|
232
224
|
- spec/internal/app/models/todo.rb
|
233
225
|
- spec/internal/config/database.yml
|
234
226
|
- spec/internal/config/routes.rb
|
227
|
+
- spec/internal/db/combustion_test.sqlite
|
235
228
|
- spec/internal/db/schema.rb
|
236
|
-
- spec/internal/log
|
229
|
+
- spec/internal/log/test.log
|
237
230
|
- spec/internal/public/favicon.ico
|
238
231
|
- spec/lib/scorpion/attribute_set_spec.rb
|
239
232
|
- spec/lib/scorpion/attribute_spec.rb
|
data/.gitignore
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
23
|
-
.env
|
24
|
-
*.sqlite
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,176 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.4
|
3
|
-
|
4
|
-
Exclude:
|
5
|
-
- "**/node_modules/**/*"
|
6
|
-
- "api/bin/*"
|
7
|
-
- "api/db/schema.rb"
|
8
|
-
- "api/vendor/**/*"
|
9
|
-
- ".*"
|
10
|
-
- "/**/.*"
|
11
|
-
|
12
|
-
|
13
|
-
Bundler/OrderedGems:
|
14
|
-
Enabled: false
|
15
|
-
|
16
|
-
Style/EmptyMethod:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/ParallelAssignment:
|
20
|
-
Enabled: false
|
21
|
-
|
22
|
-
Lint/AmbiguousBlockAssociation:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Lint/UselessAccessModifier:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
Lint/AmbiguousRegexpLiteral:
|
29
|
-
Enabled: false
|
30
|
-
|
31
|
-
Lint/AssignmentInCondition:
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
Lint/UnusedMethodArgument:
|
35
|
-
Enabled: false
|
36
|
-
|
37
|
-
Lint/AmbiguousOperator:
|
38
|
-
Enabled: false
|
39
|
-
|
40
|
-
Metrics/ClassLength:
|
41
|
-
Max: 500
|
42
|
-
|
43
|
-
Metrics/LineLength:
|
44
|
-
Max: 120
|
45
|
-
|
46
|
-
Metrics/MethodLength:
|
47
|
-
Max: 25
|
48
|
-
|
49
|
-
Metrics/AbcSize:
|
50
|
-
Max: 24
|
51
|
-
|
52
|
-
Metrics/CyclomaticComplexity:
|
53
|
-
Max: 10
|
54
|
-
|
55
|
-
Metrics/ModuleLength:
|
56
|
-
Max: 500
|
57
|
-
|
58
|
-
Metrics/ParameterLists:
|
59
|
-
CountKeywordArgs: false
|
60
|
-
|
61
|
-
Metrics/BlockLength:
|
62
|
-
Enabled: false
|
63
|
-
|
64
|
-
Style/Alias:
|
65
|
-
Enabled: false
|
66
|
-
|
67
|
-
Layout/CommentIndentation:
|
68
|
-
Enabled: false
|
69
|
-
|
70
|
-
Layout/EmptyLines:
|
71
|
-
Enabled: false
|
72
|
-
|
73
|
-
Layout/EmptyLinesAroundBlockBody:
|
74
|
-
Enabled: false
|
75
|
-
|
76
|
-
Layout/EmptyLinesAroundClassBody:
|
77
|
-
Enabled: false
|
78
|
-
|
79
|
-
Layout/EmptyLinesAroundModuleBody:
|
80
|
-
Enabled: false
|
81
|
-
|
82
|
-
Style/FrozenStringLiteralComment:
|
83
|
-
Enabled: false
|
84
|
-
|
85
|
-
Style/DoubleNegation:
|
86
|
-
Enabled: false
|
87
|
-
|
88
|
-
Style/Documentation:
|
89
|
-
Enabled: false
|
90
|
-
|
91
|
-
Style/GuardClause:
|
92
|
-
Enabled: false
|
93
|
-
|
94
|
-
Style/HashSyntax:
|
95
|
-
Enabled: false
|
96
|
-
|
97
|
-
Layout/IndentArray:
|
98
|
-
Enabled: false
|
99
|
-
|
100
|
-
Layout/IndentationConsistency:
|
101
|
-
Enabled: false
|
102
|
-
|
103
|
-
Layout/IndentationWidth:
|
104
|
-
Enabled: false
|
105
|
-
|
106
|
-
Style/Lambda:
|
107
|
-
Enabled: false
|
108
|
-
|
109
|
-
Style/FrozenStringLiteralComment:
|
110
|
-
Enabled: false
|
111
|
-
|
112
|
-
Style/MultilineBlockChain:
|
113
|
-
Enabled: false
|
114
|
-
|
115
|
-
Style/NumericPredicate:
|
116
|
-
Enabled: false
|
117
|
-
|
118
|
-
Style/NumericLiterals:
|
119
|
-
Enabled: false
|
120
|
-
|
121
|
-
Style/OptionHash:
|
122
|
-
Enabled: true
|
123
|
-
|
124
|
-
Style/RegexpLiteral:
|
125
|
-
Enabled: false
|
126
|
-
|
127
|
-
Style/SignalException:
|
128
|
-
Enabled: false
|
129
|
-
|
130
|
-
Layout/SpaceAroundBlockParameters:
|
131
|
-
Enabled: false
|
132
|
-
|
133
|
-
Style/PercentLiteralDelimiters:
|
134
|
-
Enabled: false
|
135
|
-
|
136
|
-
Layout/SpaceAroundOperators:
|
137
|
-
Enabled: false
|
138
|
-
|
139
|
-
Layout/SpaceInsideBrackets:
|
140
|
-
Enabled: false
|
141
|
-
|
142
|
-
Layout/SpaceInsideParens:
|
143
|
-
Enabled: false
|
144
|
-
|
145
|
-
Layout/SpaceInsideStringInterpolation:
|
146
|
-
EnforcedStyle: space
|
147
|
-
|
148
|
-
Layout/SpaceInsidePercentLiteralDelimiters:
|
149
|
-
Enabled: false
|
150
|
-
|
151
|
-
Style/SpecialGlobalVars:
|
152
|
-
Enabled: false
|
153
|
-
|
154
|
-
Style/SymbolArray:
|
155
|
-
Enabled: false
|
156
|
-
|
157
|
-
Style/StringLiterals:
|
158
|
-
EnforcedStyle: double_quotes
|
159
|
-
|
160
|
-
Layout/TrailingBlankLines:
|
161
|
-
Enabled: false
|
162
|
-
|
163
|
-
Style/TrailingCommaInLiteral:
|
164
|
-
Enabled: false
|
165
|
-
|
166
|
-
Style/WhileUntilModifier:
|
167
|
-
Enabled: false
|
168
|
-
|
169
|
-
Style/UnneededInterpolation:
|
170
|
-
Enabled: false
|
171
|
-
|
172
|
-
Style/CaseEquality:
|
173
|
-
Enabled: false
|
174
|
-
|
175
|
-
Style/WordArray:
|
176
|
-
Enabled: false
|