strelka 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ChangeLog +202 -2
- data/History.rdoc +6 -0
- data/Rakefile +1 -1
- data/lib/strelka/app/auth.rb +11 -1
- data/lib/strelka/httprequest.rb +1 -0
- data/lib/strelka/testing.rb +8 -2
- data/lib/strelka.rb +2 -2
- data/spec/strelka/app/auth_spec.rb +56 -5
- data/spec/strelka/app/restresources_spec.rb +32 -32
- data/spec/strelka/app/routing_spec.rb +4 -4
- data/spec/strelka/discovery_spec.rb +2 -3
- data/spec/strelka/httpresponse/negotiation_spec.rb +6 -7
- data/spec/strelka/httpresponse/session_spec.rb +2 -3
- data/spec/strelka/plugins_spec.rb +5 -6
- data/spec/strelka_spec.rb +1 -2
- data.tar.gz.sig +1 -1
- metadata +26 -26
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b14749495dff16df191c5371094312f513e7b6c
|
4
|
+
data.tar.gz: 5db0407a3325455375fa0fbce72257e23cf32a5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b36ed3558f2cac0228536ea0251e696038b8e2f9711355512704145196c42745c2261df604c5aa9d2cc1eb66c4670142c92f2eef9f9d704487556ef3857ed08
|
7
|
+
data.tar.gz: 129997e0bdad8b2962b083627902917d1e8c2948133910dbc2aa1e947733b9d0b18b8472c7ed6b5af79760b66254ff70606d8d6ee80e813ee50b75e0d4c77cd0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
@@ -1,13 +1,213 @@
|
|
1
|
+
2014-06-06 Mahlon E. Smith <mahlon@martini.nu>
|
2
|
+
|
3
|
+
* lib/strelka/app/auth.rb, spec/strelka/app/auth_spec.rb:
|
4
|
+
Auth plugin: Add the ability to modify permission sets from the
|
5
|
+
require_perms_for() block.
|
6
|
+
[69fbfc1e2de3] [tip]
|
7
|
+
|
8
|
+
2014-06-05 Michael Granger <ged@FaerieMUD.org>
|
9
|
+
|
10
|
+
* .rvm.gems, Gemfile, Rakefile, lib/strelka/httprequest.rb,
|
11
|
+
lib/strelka/testing.rb, spec/strelka/app/auth_spec.rb,
|
12
|
+
spec/strelka/app/restresources_spec.rb,
|
13
|
+
spec/strelka/app/routing_spec.rb, spec/strelka/discovery_spec.rb,
|
14
|
+
spec/strelka/httpresponse/negotiation_spec.rb,
|
15
|
+
spec/strelka/httpresponse/session_spec.rb,
|
16
|
+
spec/strelka/plugins_spec.rb, spec/strelka_spec.rb:
|
17
|
+
Updated for RSpec 3.0; bumped deps.
|
18
|
+
[04bd8611e28f] [github/master]
|
19
|
+
|
20
|
+
2014-02-05 Michael Granger <ged@FaerieMUD.org>
|
21
|
+
|
22
|
+
* .hgtags:
|
23
|
+
Added tag v0.8.0 for changeset 67f75293f04a
|
24
|
+
[d972384198ab]
|
25
|
+
|
26
|
+
* .hgsigs:
|
27
|
+
Added signature for changeset 6aec6fa45324
|
28
|
+
[67f75293f04a] [v0.8.0]
|
29
|
+
|
30
|
+
* History.rdoc:
|
31
|
+
Update the history
|
32
|
+
[6aec6fa45324]
|
33
|
+
|
34
|
+
2014-02-02 Michael Granger <ged@FaerieMUD.org>
|
35
|
+
|
36
|
+
* .rvm.gems, Rakefile:
|
37
|
+
Update dependencies.
|
38
|
+
[4ddae11c28b8]
|
39
|
+
|
40
|
+
2014-01-22 Mahlon E. Smith <mahlon@laika.com>
|
41
|
+
|
42
|
+
* lib/strelka/httprequest.rb:
|
43
|
+
Don't modify the original request URI object when calling
|
44
|
+
HttpRequest#base_uri.
|
45
|
+
[6e2d1e0e89d1]
|
46
|
+
|
47
|
+
2014-01-29 Michael Granger <ged@FaerieMUD.org>
|
48
|
+
|
49
|
+
* lib/strelka/app.rb:
|
50
|
+
Add a convenience method for fetching a default app instance to
|
51
|
+
Strelka::App
|
52
|
+
[0e6e0e0be5e7]
|
53
|
+
|
54
|
+
2014-01-13 Michael Granger <ged@FaerieMUD.org>
|
55
|
+
|
56
|
+
* spec/strelka/app/auth_spec.rb, spec/strelka/app/filters_spec.rb,
|
57
|
+
spec/strelka/app/parameters_spec.rb,
|
58
|
+
spec/strelka/app/restresources_spec.rb,
|
59
|
+
spec/strelka/app/routing_spec.rb,
|
60
|
+
spec/strelka/app/templating_spec.rb,
|
61
|
+
spec/strelka/authprovider/basic_spec.rb,
|
62
|
+
spec/strelka/authprovider/hostaccess_spec.rb,
|
63
|
+
spec/strelka/cookie_spec.rb, spec/strelka/cookieset_spec.rb,
|
64
|
+
spec/strelka/discovery_spec.rb,
|
65
|
+
spec/strelka/httprequest/acceptparams_spec.rb,
|
66
|
+
spec/strelka/httprequest/negotiation_spec.rb,
|
67
|
+
spec/strelka/httprequest/session_spec.rb,
|
68
|
+
spec/strelka/httprequest_spec.rb,
|
69
|
+
spec/strelka/httpresponse/session_spec.rb,
|
70
|
+
spec/strelka/multipartparser_spec.rb,
|
71
|
+
spec/strelka/paramvalidator_spec.rb, spec/strelka/plugins_spec.rb,
|
72
|
+
spec/strelka/session/default_spec.rb,
|
73
|
+
spec/strelka/websocketserver/routing_spec.rb:
|
74
|
+
Fix use of deprecated RSpec syntax.
|
75
|
+
[9f7f4f4dba0b]
|
76
|
+
|
77
|
+
* lib/strelka/authprovider.rb,
|
78
|
+
lib/strelka/httprequest/acceptparams.rb, lib/strelka/mixins.rb,
|
79
|
+
lib/strelka/plugins.rb, lib/strelka/router.rb,
|
80
|
+
lib/strelka/session.rb, spec/strelka/mixins_spec.rb:
|
81
|
+
Merge improvements to the AbstractClass mixin from elsewhere.
|
82
|
+
[96725c68d4ae]
|
83
|
+
|
84
|
+
2014-01-02 Michael Granger <ged@FaerieMUD.org>
|
85
|
+
|
86
|
+
* lib/strelka.rb:
|
87
|
+
Merged with bdb098771858
|
88
|
+
[140055f6ee81]
|
89
|
+
|
90
|
+
2013-12-02 Mahlon E. Smith <mahlon@martini.nu>
|
91
|
+
|
92
|
+
* .rvm.gems, lib/strelka.rb, lib/strelka/app/auth.rb,
|
93
|
+
spec/strelka/session/default_spec.rb:
|
94
|
+
Restore access to request parameters from the authentication plugin.
|
95
|
+
[bdb098771858]
|
96
|
+
|
97
|
+
2014-01-01 Michael Granger <ged@FaerieMUD.org>
|
98
|
+
|
99
|
+
* History.rdoc, lib/strelka.rb:
|
100
|
+
Bump minor version, update history
|
101
|
+
[2d8433106860]
|
102
|
+
|
103
|
+
* lib/strelka/app/restresources.rb, lib/strelka/httprequest.rb,
|
104
|
+
lib/strelka/httprequest/negotiation.rb,
|
105
|
+
lib/strelka/multipartparser.rb,
|
106
|
+
spec/strelka/app/restresources_spec.rb,
|
107
|
+
spec/strelka/httprequest/negotiation_spec.rb,
|
108
|
+
spec/strelka/httprequest_spec.rb:
|
109
|
+
Fix PUT/POST routes in restresources to be more REST-y; i.e., POST
|
110
|
+
for non-idempotent methods, PUT for idempotent ones.
|
111
|
+
[c91b759e2dfa]
|
112
|
+
|
113
|
+
* .rvmrc:
|
114
|
+
Updated rvmrc; don't autoload the gemset
|
115
|
+
[26dd19cb5b45]
|
116
|
+
|
117
|
+
* .tm_properties:
|
118
|
+
Fix project settings
|
119
|
+
[eae55bb5318e]
|
120
|
+
|
121
|
+
2013-12-30 Michael Granger <ged@FaerieMUD.org>
|
122
|
+
|
123
|
+
* lib/strelka/cookie.rb, spec/strelka/cookie_spec.rb:
|
124
|
+
Make Strelka::Cookie raise on malformed cookies
|
125
|
+
[bb16cdc0c251]
|
126
|
+
|
127
|
+
2013-11-20 Michael Granger <ged@FaerieMUD.org>
|
128
|
+
|
129
|
+
* lib/strelka/app/sessions.rb, lib/strelka/session.rb,
|
130
|
+
lib/strelka/session/db.rb:
|
131
|
+
Fix some API docs for sessions
|
132
|
+
[924139279054]
|
133
|
+
|
134
|
+
* lib/strelka/app.rb:
|
135
|
+
Remove config keys that moved to Discovery
|
136
|
+
[c4b52cde2f47]
|
137
|
+
|
138
|
+
2013-11-08 Michael Granger <ged@FaerieMUD.org>
|
139
|
+
|
140
|
+
* .hgtags:
|
141
|
+
Added tag v0.7.0 for changeset fb8d0093e8f6
|
142
|
+
[71ad508ff67c]
|
143
|
+
|
144
|
+
* .hgsigs:
|
145
|
+
Added signature for changeset 2caa91898658
|
146
|
+
[fb8d0093e8f6] [v0.7.0]
|
147
|
+
|
148
|
+
* .rvm.gems, History.rdoc, Rakefile, lib/strelka.rb:
|
149
|
+
Bump minor version, update dependencies, update history.
|
150
|
+
[2caa91898658]
|
151
|
+
|
152
|
+
* spec/strelka/discovery_spec.rb:
|
153
|
+
Fix discovery specs
|
154
|
+
[a3898e620a63]
|
155
|
+
|
156
|
+
2013-10-21 Michael Granger <ged@FaerieMUD.org>
|
157
|
+
|
158
|
+
* lib/strelka/app/filters.rb, lib/strelka/app/templating.rb,
|
159
|
+
spec/strelka/app/filters_spec.rb:
|
160
|
+
Make response filters always receive a response
|
161
|
+
|
162
|
+
...even if the handler returns a Symbol, e.g., for the templating
|
163
|
+
plugin.
|
164
|
+
[e8958f7795d9]
|
165
|
+
|
166
|
+
2013-10-18 Michael Granger <ged@FaerieMUD.org>
|
167
|
+
|
168
|
+
* lib/strelka/app/templating.rb:
|
169
|
+
Add a note about needed documentation to :templating
|
170
|
+
[bc94898e6bdd]
|
171
|
+
|
172
|
+
* Plugins.rdoc, lib/strelka/app/auth.rb, lib/strelka/app/errors.rb,
|
173
|
+
lib/strelka/app/filters.rb, lib/strelka/app/negotiation.rb,
|
174
|
+
lib/strelka/app/parameters.rb, lib/strelka/app/routing.rb,
|
175
|
+
lib/strelka/app/sessions.rb, lib/strelka/app/templating.rb,
|
176
|
+
lib/strelka/plugins.rb, lib/strelka/websocketserver/routing.rb,
|
177
|
+
spec/strelka/plugins_spec.rb:
|
178
|
+
Change filter plugin order; change run_before/run_after to
|
179
|
+
run_outside/run_inside.
|
180
|
+
|
181
|
+
- Backward-compatibility maintained with an alias.
|
182
|
+
[0027480d474e]
|
183
|
+
|
184
|
+
2013-10-17 Michael Granger <ged@FaerieMUD.org>
|
185
|
+
|
186
|
+
* lib/strelka/paramvalidator.rb, spec/strelka/paramvalidator_spec.rb:
|
187
|
+
Consider empty string as no value for parameter validation. (fixes
|
188
|
+
#8)
|
189
|
+
[662737a841c4]
|
190
|
+
|
191
|
+
2013-10-15 Michael Granger <ged@FaerieMUD.org>
|
192
|
+
|
193
|
+
* README.rdoc:
|
194
|
+
Update the project URL and copyright date in the README
|
195
|
+
[8ab80d544db2]
|
196
|
+
|
197
|
+
* .hoerc, Manifest.txt:
|
198
|
+
Remove runtime data from examples dir from the manifest
|
199
|
+
[0c9efdac0829]
|
200
|
+
|
1
201
|
2013-10-15 Michael Granger <ged@faeriemud.org>
|
2
202
|
|
3
203
|
* Close branch rdolgushin/ideasrdoc-russian-woof-fix-1381879886956
|
4
|
-
[dedc90b70209]
|
204
|
+
[dedc90b70209] <rdolgushin/ideasrdoc-russian-woof-fix-1381879886956>
|
5
205
|
|
6
206
|
* Merged in rdolgushin/strelka/rdolgushin/ideasrdoc-russian-woof-
|
7
207
|
fix-1381879886956 (pull request #2)
|
8
208
|
|
9
209
|
IDEAS.rdoc: Russian 'woof' fix
|
10
|
-
[ac7fea5af58f]
|
210
|
+
[ac7fea5af58f]
|
11
211
|
|
12
212
|
2013-10-15 Roman Dolgushin <rd@roman-dolgushin.ru>
|
13
213
|
|
data/History.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== v0.9.0 [2014-06-06] Mahlon E. Smith <mahlon@martini.nu>
|
2
|
+
|
3
|
+
- Auth plugin: Add the ability to modify permission sets from the
|
4
|
+
require_perms_for() block.
|
5
|
+
|
6
|
+
|
1
7
|
== v0.8.0 [2014-02-05] Michael Granger <ged@FaerieMUD.org>
|
2
8
|
|
3
9
|
Make malformed headers and data consistently error with 400 status rather than
|
data/Rakefile
CHANGED
@@ -37,7 +37,7 @@ hoespec = Hoe.spec 'strelka' do
|
|
37
37
|
|
38
38
|
self.dependency 'hoe-deveiate', '~> 0.3', :developer
|
39
39
|
self.dependency 'hoe-bundler', '~> 1.2', :developer
|
40
|
-
self.dependency 'rspec', '~>
|
40
|
+
self.dependency 'rspec', '~> 3.0', :developer
|
41
41
|
self.dependency 'simplecov', '~> 0.7', :developer
|
42
42
|
self.dependency 'rdoc-generator-fivefish', '~> 0.2', :developer
|
43
43
|
|
data/lib/strelka/app/auth.rb
CHANGED
@@ -621,8 +621,18 @@ module Strelka::App::Auth
|
|
621
621
|
|
622
622
|
self.log.debug " positive perm criteria: %p" % [ self.class.positive_perms_criteria ]
|
623
623
|
self.class.positive_perms_criteria.each do |pattern, block, newperms|
|
624
|
-
|
624
|
+
criteria = self.request_matches_criteria( request, pattern, &block )
|
625
|
+
next unless criteria
|
626
|
+
|
625
627
|
newperms = Array( newperms )
|
628
|
+
|
629
|
+
if criteria.is_a?( Symbol )
|
630
|
+
newperms << criteria
|
631
|
+
|
632
|
+
elsif criteria.respond_to?( :first ) && criteria.first.is_a?( Symbol )
|
633
|
+
newperms += criteria
|
634
|
+
end
|
635
|
+
|
626
636
|
newperms << self.default_permission if newperms.empty?
|
627
637
|
|
628
638
|
raise TypeError, "Permissions must be Symbols; got: %p" % [newperms] unless
|
data/lib/strelka/httprequest.rb
CHANGED
@@ -216,6 +216,7 @@ class Strelka::HTTPRequest < Mongrel2::HTTPRequest
|
|
216
216
|
code = perm ? HTTP::MOVED_PERMANENTLY : HTTP::MOVED_TEMPORARILY
|
217
217
|
finish_with( code, "redirect from #{self.uri.path} to #{uri}", :location => uri )
|
218
218
|
end
|
219
|
+
alias_method :redirect_to, :redirect
|
219
220
|
|
220
221
|
|
221
222
|
#########
|
data/lib/strelka/testing.rb
CHANGED
@@ -61,6 +61,12 @@ module Strelka::Testing
|
|
61
61
|
attr_reader :expected_status, :expected_message, :expected_headers
|
62
62
|
|
63
63
|
|
64
|
+
### Matcher API -- return true to enable the use of block expectations.
|
65
|
+
def supports_block_expectations?
|
66
|
+
return true
|
67
|
+
end
|
68
|
+
|
69
|
+
|
64
70
|
### Also expect a header with the given +name+ and +value+ from the response.
|
65
71
|
def and_header( name, value=nil )
|
66
72
|
if name.is_a?( Hash )
|
@@ -160,13 +166,13 @@ module Strelka::Testing
|
|
160
166
|
|
161
167
|
|
162
168
|
### Return a message suitable for describing when the matcher fails when it should succeed.
|
163
|
-
def
|
169
|
+
def failure_message
|
164
170
|
return "expected response to finish_with %s" % [ @failure ]
|
165
171
|
end
|
166
172
|
|
167
173
|
|
168
174
|
### Return a message suitable for describing when the matcher succeeds when it should fail.
|
169
|
-
def
|
175
|
+
def failure_message_when_negated
|
170
176
|
return "expected response not to finish_with %s" % [ @failure ]
|
171
177
|
end
|
172
178
|
|
data/lib/strelka.rb
CHANGED
@@ -24,10 +24,10 @@ module Strelka
|
|
24
24
|
log_as :strelka
|
25
25
|
|
26
26
|
# Library version constant
|
27
|
-
VERSION = '0.
|
27
|
+
VERSION = '0.9.0'
|
28
28
|
|
29
29
|
# Version-control revision constant
|
30
|
-
REVISION = %q$Revision:
|
30
|
+
REVISION = %q$Revision: 406a68302dc6 $
|
31
31
|
|
32
32
|
require 'strelka/constants'
|
33
33
|
require 'strelka/exceptions'
|
@@ -47,7 +47,7 @@ describe Strelka::App::Auth do
|
|
47
47
|
end
|
48
48
|
app.install_plugins
|
49
49
|
|
50
|
-
expect( @request_factory.get(
|
50
|
+
expect( @request_factory.get('/api/v1/verify') ).to respond_to( :authenticated? )
|
51
51
|
end
|
52
52
|
|
53
53
|
|
@@ -58,7 +58,7 @@ describe Strelka::App::Auth do
|
|
58
58
|
plugins :auth
|
59
59
|
|
60
60
|
# Stand in for a real AuthProvider
|
61
|
-
@auth_provider = RSpec::Mocks::
|
61
|
+
@auth_provider = RSpec::Mocks::Double
|
62
62
|
|
63
63
|
def initialize( appid='auth-test', sspec=TEST_SEND_SPEC, rspec=TEST_RECV_SPEC )
|
64
64
|
super
|
@@ -98,7 +98,8 @@ describe Strelka::App::Auth do
|
|
98
98
|
expect( @app ).to_not have_auth_criteria()
|
99
99
|
end
|
100
100
|
|
101
|
-
it "sets the authenticated_user attribute of the request to the credentials
|
101
|
+
it "sets the authenticated_user attribute of the request to the credentials " +
|
102
|
+
"of the authenticating user" do
|
102
103
|
app = @app.new
|
103
104
|
req = @request_factory.get( '/api/v1' )
|
104
105
|
|
@@ -417,6 +418,55 @@ describe Strelka::App::Auth do
|
|
417
418
|
expect( app.required_perms_for(req) ).to eq( [ :auth_test ] )
|
418
419
|
end
|
419
420
|
|
421
|
+
it "allows specific required permissions to be returned by the block" do
|
422
|
+
@app.require_perms_for( %r{.*} ) do |req|
|
423
|
+
:write_access if req.verb != :GET
|
424
|
+
end
|
425
|
+
app = @app.new
|
426
|
+
|
427
|
+
req = @request_factory.get( '/api/v1/accounts' )
|
428
|
+
expect( app.required_perms_for(req) ).to eq( [] )
|
429
|
+
req = @request_factory.put( '/api/v1/accounts' )
|
430
|
+
expect( app.required_perms_for(req) ).to eq( [ :write_access ] )
|
431
|
+
end
|
432
|
+
|
433
|
+
it "adds specific required permissions returned by the block to argument permissions" do
|
434
|
+
@app.require_perms_for( %r{.*}, :basic_access ) do |req|
|
435
|
+
:write_access if req.verb != :GET
|
436
|
+
end
|
437
|
+
app = @app.new
|
438
|
+
|
439
|
+
req = @request_factory.get( '/api/v1/accounts' )
|
440
|
+
expect( app.required_perms_for(req) ).to eq( [] )
|
441
|
+
req = @request_factory.put( '/api/v1/accounts' )
|
442
|
+
expect( app.required_perms_for(req) ).to include( :basic_access, :write_access )
|
443
|
+
end
|
444
|
+
|
445
|
+
it "allows specific, multiple required permissions to be returned by the block" do
|
446
|
+
@app.require_perms_for( %r{.*} ) do |req|
|
447
|
+
[ :write_access, :is_handsome ] if req.verb != :GET
|
448
|
+
end
|
449
|
+
app = @app.new
|
450
|
+
|
451
|
+
req = @request_factory.get( '/api/v1/accounts' )
|
452
|
+
expect( app.required_perms_for(req) ).to eq( [] )
|
453
|
+
req = @request_factory.put( '/api/v1/accounts' )
|
454
|
+
expect( app.required_perms_for(req) ).to include( :is_handsome, :write_access )
|
455
|
+
end
|
456
|
+
|
457
|
+
it "adds specific, multiple required permissions returned by the block to argument permissions" do
|
458
|
+
@app.require_perms_for( %r{.*}, :basic_access ) do |req|
|
459
|
+
[ :write_access, :is_handsome ] if req.verb != :GET
|
460
|
+
end
|
461
|
+
app = @app.new
|
462
|
+
|
463
|
+
req = @request_factory.get( '/api/v1/accounts' )
|
464
|
+
expect( app.required_perms_for(req) ).to eq( [] )
|
465
|
+
req = @request_factory.put( '/api/v1/accounts' )
|
466
|
+
expect( app.required_perms_for(req) ).to include( :basic_access, :write_access, :is_handsome )
|
467
|
+
end
|
468
|
+
|
469
|
+
|
420
470
|
it "allows negative perms criteria to be declared with a string" do
|
421
471
|
@app.no_perms_for( '/string' )
|
422
472
|
app = @app.new
|
@@ -561,7 +611,7 @@ describe Strelka::App::Auth do
|
|
561
611
|
app.handle( req )
|
562
612
|
end
|
563
613
|
|
564
|
-
it "authenticates and authorizes a request that only matches the auth criteria"do
|
614
|
+
it "authenticates and authorizes a request that only matches the auth criteria" do
|
565
615
|
req = @request_factory.get( '/api/v1/onlyauth' )
|
566
616
|
|
567
617
|
app = @app.new
|
@@ -716,7 +766,8 @@ describe Strelka::App::Auth do
|
|
716
766
|
|
717
767
|
app = @app.new
|
718
768
|
allow( app.auth_provider ).to receive( :authenticate ).and_return( :credentials )
|
719
|
-
expect( app.auth_provider ).to receive( :authorize ).
|
769
|
+
expect( app.auth_provider ).to receive( :authorize ).
|
770
|
+
with( :credentials, req, [:admin, :upload] )
|
720
771
|
|
721
772
|
app.handle( req )
|
722
773
|
end
|
@@ -76,27 +76,27 @@ describe Strelka::App::RestResources do
|
|
76
76
|
it "keeps track of what resources are mounted where" do
|
77
77
|
expect( @app.resource_verbs.size ).to eq( 1 )
|
78
78
|
expect( @app.resource_verbs ).to include( 'servers' )
|
79
|
-
@app.resource_verbs[ 'servers' ].
|
80
|
-
|
79
|
+
expect(@app.resource_verbs[ 'servers' ]).
|
80
|
+
to include( :OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE )
|
81
81
|
end
|
82
82
|
|
83
83
|
# Reader regular routes
|
84
|
-
it {
|
85
|
-
it {
|
86
|
-
it {
|
84
|
+
it { is_expected.to have_route(:OPTIONS, 'servers') }
|
85
|
+
it { is_expected.to have_route(:GET, 'servers') }
|
86
|
+
it { is_expected.to have_route(:GET, 'servers/:id') }
|
87
87
|
|
88
88
|
# Writer regular routes
|
89
|
-
it {
|
90
|
-
it {
|
91
|
-
it {
|
92
|
-
it {
|
93
|
-
it {
|
94
|
-
it {
|
89
|
+
it { is_expected.to have_route(:POST, 'servers') }
|
90
|
+
it { is_expected.to have_route(:POST, 'servers/:id') }
|
91
|
+
it { is_expected.to have_route(:PUT, 'servers') }
|
92
|
+
it { is_expected.to have_route(:PUT, 'servers/:id') }
|
93
|
+
it { is_expected.to have_route(:DELETE, 'servers') }
|
94
|
+
it { is_expected.to have_route(:DELETE, 'servers/:id') }
|
95
95
|
|
96
96
|
# Reader composite routes
|
97
|
-
it {
|
98
|
-
it {
|
99
|
-
it {
|
97
|
+
it { is_expected.to have_route(:GET, 'servers/by_uuid/:uuid') }
|
98
|
+
it { is_expected.to have_route(:GET, 'servers/:id/hosts') }
|
99
|
+
it { is_expected.to have_route(:GET, 'servers/:id/filters') }
|
100
100
|
|
101
101
|
end
|
102
102
|
|
@@ -114,29 +114,29 @@ describe Strelka::App::RestResources do
|
|
114
114
|
it "keeps track of what resources are mounted where" do
|
115
115
|
expect( @app.resource_verbs.size ).to eq( 1 )
|
116
116
|
expect( @app.resource_verbs ).to include( 'servers' )
|
117
|
-
@app.resource_verbs[ 'servers' ].
|
118
|
-
|
119
|
-
@app.resource_verbs[ 'servers' ].
|
120
|
-
|
117
|
+
expect(@app.resource_verbs[ 'servers' ]).
|
118
|
+
to include( :OPTIONS, :GET, :HEAD )
|
119
|
+
expect(@app.resource_verbs[ 'servers' ]).
|
120
|
+
not_to include( :POST, :PUT, :DELETE )
|
121
121
|
end
|
122
122
|
|
123
123
|
# Reader regular routes
|
124
|
-
it {
|
125
|
-
it {
|
126
|
-
it {
|
124
|
+
it { is_expected.to have_route(:OPTIONS, 'servers') }
|
125
|
+
it { is_expected.to have_route(:GET, 'servers') }
|
126
|
+
it { is_expected.to have_route(:GET, 'servers/:id') }
|
127
127
|
|
128
128
|
# Writer regular routes
|
129
|
-
it {
|
130
|
-
it {
|
131
|
-
it {
|
132
|
-
it {
|
133
|
-
it {
|
134
|
-
it {
|
129
|
+
it { is_expected.not_to have_route(:POST, 'servers') }
|
130
|
+
it { is_expected.not_to have_route(:POST, 'servers/:id') }
|
131
|
+
it { is_expected.not_to have_route(:PUT, 'servers') }
|
132
|
+
it { is_expected.not_to have_route(:PUT, 'servers/:id') }
|
133
|
+
it { is_expected.not_to have_route(:DELETE, 'servers') }
|
134
|
+
it { is_expected.not_to have_route(:DELETE, 'servers/:id') }
|
135
135
|
|
136
136
|
# Reader composite routes
|
137
|
-
it {
|
138
|
-
it {
|
139
|
-
it {
|
137
|
+
it { is_expected.to have_route(:GET, 'servers/by_uuid/:uuid') }
|
138
|
+
it { is_expected.to have_route(:GET, 'servers/:id/hosts') }
|
139
|
+
it { is_expected.to have_route(:GET, 'servers/:id/filters') }
|
140
140
|
|
141
141
|
end
|
142
142
|
|
@@ -517,8 +517,8 @@ describe Strelka::App::RestResources do
|
|
517
517
|
it "has its metadata inherited by subclasses" do
|
518
518
|
expect( subject.resource_verbs.size ).to eq( 1 )
|
519
519
|
expect( subject.resource_verbs ).to include( 'servers' )
|
520
|
-
subject.resource_verbs[ 'servers' ].
|
521
|
-
|
520
|
+
expect(subject.resource_verbs[ 'servers' ]).
|
521
|
+
to include( :OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE )
|
522
522
|
end
|
523
523
|
|
524
524
|
end # supports inheritance
|
@@ -216,10 +216,10 @@ describe Strelka::App::Routing do
|
|
216
216
|
|
217
217
|
expect( subclass.routes.size ).to eq( 3 )
|
218
218
|
|
219
|
-
subclass.routes.
|
220
|
-
|
221
|
-
subclass.routes.
|
222
|
-
|
219
|
+
expect(subclass.routes).
|
220
|
+
to include([ :GET, ['info'], {action: @app.instance_method(:GET_info), options: {}} ])
|
221
|
+
expect(subclass.routes).
|
222
|
+
to include([ :GET, ['about'], {action: @app.instance_method(:GET_about), options: {}} ])
|
223
223
|
expect( subclass.routes ).to include(
|
224
224
|
[ :GET, ['origami'], {action: subclass.instance_method(:GET_origami), options: {}} ]
|
225
225
|
)
|
@@ -49,7 +49,7 @@ describe Strelka::Discovery do
|
|
49
49
|
app_path = Pathname( app_file ).expand_path
|
50
50
|
app_class = nil
|
51
51
|
|
52
|
-
expect( Kernel ).to receive( :load ).with( app_path.to_s )
|
52
|
+
expect( Kernel ).to receive( :load ).with( app_path.to_s ) do
|
53
53
|
app_class = Class.new( discoverable_class )
|
54
54
|
end
|
55
55
|
expect( described_class.load(app_file) ).to eq( [ app_class ] )
|
@@ -108,8 +108,7 @@ describe Strelka::Discovery do
|
|
108
108
|
|
109
109
|
expect( described_class ).to receive( :gem ).with( 'blood-orgy' )
|
110
110
|
expect( Kernel ).to receive( :load ).
|
111
|
-
with( "#{gemspec.full_gem_path}/data/blood-orgy/apps/kurzweil" )
|
112
|
-
and_return do
|
111
|
+
with( "#{gemspec.full_gem_path}/data/blood-orgy/apps/kurzweil" ) do
|
113
112
|
Class.new( discoverable_class )
|
114
113
|
true
|
115
114
|
end
|
@@ -140,15 +140,14 @@ describe Strelka::HTTPResponse::Negotiation do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
it "transcodes File entity bodies if the charset is not acceptable" do
|
143
|
-
pending "implementation of IO transcoding"
|
144
|
-
|
143
|
+
pending "implementation of IO transcoding"
|
144
|
+
@req.headers.accept_charset = 'koi8-r, koi8-u;q=0.9, utf-8;q=0.8'
|
145
145
|
|
146
|
-
|
147
|
-
|
146
|
+
@res.body = File.open( __FILE__, 'r:iso-8859-5' )
|
147
|
+
@res.content_type = 'text/plain'
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
end
|
149
|
+
expect( @res.negotiated_body.read.encoding ).to eq( Encoding::KOI8_R )
|
150
|
+
expect( @res.header_data ).to match( /accept-charset(?!-)/i )
|
152
151
|
end
|
153
152
|
|
154
153
|
end
|
@@ -46,9 +46,8 @@ describe Strelka::HTTPResponse::Session, "-extended response" do
|
|
46
46
|
|
47
47
|
it "sets its request's session when its session is set" do
|
48
48
|
@res.session = Strelka::Session.create( :default )
|
49
|
-
pending "not sure if it should do this or not"
|
50
|
-
|
51
|
-
end
|
49
|
+
pending "not sure if it should do this or not"
|
50
|
+
expect( @req.session ).to be( @res.session )
|
52
51
|
end
|
53
52
|
|
54
53
|
context "for a request with no session ID" do
|
@@ -91,8 +91,8 @@ describe "Strelka plugin system" do
|
|
91
91
|
|
92
92
|
|
93
93
|
it "sorts before it in the plugin registry" do
|
94
|
-
Strelka::Pluggable.loaded_plugins.tsort.
|
95
|
-
|
94
|
+
expect(Strelka::Pluggable.loaded_plugins.tsort).
|
95
|
+
to order( @plugin.plugin_name ).after( @before_mod.plugin_name )
|
96
96
|
end
|
97
97
|
|
98
98
|
end
|
@@ -110,8 +110,8 @@ describe "Strelka plugin system" do
|
|
110
110
|
|
111
111
|
|
112
112
|
it "sorts after it in the plugin registry" do
|
113
|
-
Strelka::Pluggable.loaded_plugins.tsort.
|
114
|
-
|
113
|
+
expect(Strelka::Pluggable.loaded_plugins.tsort).
|
114
|
+
to order( @plugin.plugin_name ).before( @after_mod.plugin_name )
|
115
115
|
end
|
116
116
|
|
117
117
|
end
|
@@ -123,8 +123,7 @@ describe "Strelka plugin system" do
|
|
123
123
|
|
124
124
|
it "requires plugins from a directory based on the name of the loader" do
|
125
125
|
expect( Strelka::Pluggable ).to receive( :require ).
|
126
|
-
with( 'strelka/pluggable/scheduler' )
|
127
|
-
and_return do
|
126
|
+
with( 'strelka/pluggable/scheduler' ) do
|
128
127
|
Module.new do
|
129
128
|
def self::name; "Strelka::Pluggable::Scheduler"; end
|
130
129
|
extend Strelka::Plugin
|
data/spec/strelka_spec.rb
CHANGED
@@ -35,8 +35,7 @@ describe Strelka do
|
|
35
35
|
and_return([ Pathname('data/mox/apps/moxthefox') ])
|
36
36
|
|
37
37
|
expect( Kernel ).to receive( :load ).
|
38
|
-
with( File.expand_path 'data/mox/apps/moxthefox' ).
|
39
|
-
and_return { mox_app = Class.new(Strelka::App) }
|
38
|
+
with( File.expand_path 'data/mox/apps/moxthefox' ) { mox_app = Class.new(Strelka::App) }
|
40
39
|
|
41
40
|
expect( described_class::App('moxthefox') ).to be( mox_app )
|
42
41
|
end
|
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
@
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strelka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mahlon E. Smith
|
@@ -13,7 +13,7 @@ cert_chain:
|
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
14
|
MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
|
15
15
|
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
16
|
-
|
16
|
+
HhcNMTQwMzE5MDQzNTI2WhcNMTUwMzE5MDQzNTI2WjA+MQwwCgYDVQQDDANnZWQx
|
17
17
|
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
18
18
|
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDb92mkyYwuGBg1oRxt2tkH
|
19
19
|
+Uo3LAsaL/APBfSLzy8o3+B3AUHKCjMUaVeBoZdWtMHB75X3VQlvXfZMyBxj59Vo
|
@@ -24,14 +24,14 @@ cert_chain:
|
|
24
24
|
AgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBSZ0hCV
|
25
25
|
qoHr122fGKelqffzEQBhszAcBgNVHREEFTATgRFnZWRARmFlcmllTVVELm9yZzAc
|
26
26
|
BgNVHRIEFTATgRFnZWRARmFlcmllTVVELm9yZzANBgkqhkiG9w0BAQUFAAOCAQEA
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
TuL1Bzl6TBs1YEzEubFHb9XAPgehWzzUudjDKzTRd+uyZmxnomBqTCQjT5ucNRph
|
28
|
+
3jZ6bhLNooLQxTjIuHodeGcEMHZdt4Yi7SyPmw5Nry12z6wrDp+5aGps3HsE5WsQ
|
29
|
+
Zq2EuyEOc96g31uoIvjNdieKs+1kE+K+dJDjtw+wTH2i63P7r6N/NfPPXpxsFquo
|
30
|
+
wcYRRrHdR7GhdJeT+V8Q8Bi5bglCUGdx+8scMgkkePc98k9osQHypbACmzO+Bqkv
|
31
|
+
c7ZKPJcWBv0sm81+FCZXNACn2f9jfF8OQinxVs0O052KbGuEQaaiGIYeuuwQE2q6
|
32
|
+
ggcrPfcYeTwWlfZPu2LrBg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-
|
34
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: configurability
|
@@ -193,56 +193,56 @@ dependencies:
|
|
193
193
|
requirements:
|
194
194
|
- - ~>
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
-
version: 1.4
|
196
|
+
version: '1.4'
|
197
197
|
type: :development
|
198
198
|
prerelease: false
|
199
199
|
version_requirements: !ruby/object:Gem::Requirement
|
200
200
|
requirements:
|
201
201
|
- - ~>
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version: 1.4
|
203
|
+
version: '1.4'
|
204
204
|
- !ruby/object:Gem::Dependency
|
205
|
-
name: hoe-
|
205
|
+
name: hoe-deveiate
|
206
206
|
requirement: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
208
|
- - ~>
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version: 0.
|
210
|
+
version: '0.6'
|
211
211
|
type: :development
|
212
212
|
prerelease: false
|
213
213
|
version_requirements: !ruby/object:Gem::Requirement
|
214
214
|
requirements:
|
215
215
|
- - ~>
|
216
216
|
- !ruby/object:Gem::Version
|
217
|
-
version: 0.
|
217
|
+
version: '0.6'
|
218
218
|
- !ruby/object:Gem::Dependency
|
219
|
-
name:
|
219
|
+
name: hoe-highline
|
220
220
|
requirement: !ruby/object:Gem::Requirement
|
221
221
|
requirements:
|
222
222
|
- - ~>
|
223
223
|
- !ruby/object:Gem::Version
|
224
|
-
version: '
|
224
|
+
version: '0.2'
|
225
225
|
type: :development
|
226
226
|
prerelease: false
|
227
227
|
version_requirements: !ruby/object:Gem::Requirement
|
228
228
|
requirements:
|
229
229
|
- - ~>
|
230
230
|
- !ruby/object:Gem::Version
|
231
|
-
version: '
|
231
|
+
version: '0.2'
|
232
232
|
- !ruby/object:Gem::Dependency
|
233
|
-
name:
|
233
|
+
name: rdoc
|
234
234
|
requirement: !ruby/object:Gem::Requirement
|
235
235
|
requirements:
|
236
236
|
- - ~>
|
237
237
|
- !ruby/object:Gem::Version
|
238
|
-
version: '0
|
238
|
+
version: '4.0'
|
239
239
|
type: :development
|
240
240
|
prerelease: false
|
241
241
|
version_requirements: !ruby/object:Gem::Requirement
|
242
242
|
requirements:
|
243
243
|
- - ~>
|
244
244
|
- !ruby/object:Gem::Version
|
245
|
-
version: '0
|
245
|
+
version: '4.0'
|
246
246
|
- !ruby/object:Gem::Dependency
|
247
247
|
name: hoe-bundler
|
248
248
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,14 +263,14 @@ dependencies:
|
|
263
263
|
requirements:
|
264
264
|
- - ~>
|
265
265
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
266
|
+
version: '3.0'
|
267
267
|
type: :development
|
268
268
|
prerelease: false
|
269
269
|
version_requirements: !ruby/object:Gem::Requirement
|
270
270
|
requirements:
|
271
271
|
- - ~>
|
272
272
|
- !ruby/object:Gem::Version
|
273
|
-
version:
|
273
|
+
version: '3.0'
|
274
274
|
- !ruby/object:Gem::Dependency
|
275
275
|
name: simplecov
|
276
276
|
requirement: !ruby/object:Gem::Requirement
|
@@ -305,14 +305,14 @@ dependencies:
|
|
305
305
|
requirements:
|
306
306
|
- - ~>
|
307
307
|
- !ruby/object:Gem::Version
|
308
|
-
version: '3.
|
308
|
+
version: '3.12'
|
309
309
|
type: :development
|
310
310
|
prerelease: false
|
311
311
|
version_requirements: !ruby/object:Gem::Requirement
|
312
312
|
requirements:
|
313
313
|
- - ~>
|
314
314
|
- !ruby/object:Gem::Version
|
315
|
-
version: '3.
|
315
|
+
version: '3.12'
|
316
316
|
description: |-
|
317
317
|
Strelka is a framework for creating and deploying
|
318
318
|
Mongrel2[http://mongrel2.org/] web applications in Ruby.
|
@@ -496,8 +496,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
496
496
|
- !ruby/object:Gem::Version
|
497
497
|
version: '0'
|
498
498
|
requirements: []
|
499
|
-
rubyforge_project:
|
500
|
-
rubygems_version: 2.2.
|
499
|
+
rubyforge_project:
|
500
|
+
rubygems_version: 2.2.2
|
501
501
|
signing_key:
|
502
502
|
specification_version: 4
|
503
503
|
summary: Strelka is a framework for creating and deploying Mongrel2[http://mongrel2.org/]
|
metadata.gz.sig
CHANGED
Binary file
|