strelka 0.9.0 → 0.9.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
- checksums.yaml.gz.sig +1 -2
- data.tar.gz.sig +2 -1
- data/ChangeLog +143 -24
- data/History.rdoc +7 -0
- data/Rakefile +40 -27
- data/lib/strelka.rb +3 -2
- data/lib/strelka/app.rb +1 -0
- data/lib/strelka/app/auth.rb +2 -2
- data/lib/strelka/httprequest.rb +16 -14
- data/spec/helpers.rb +0 -1
- data/spec/strelka/app/auth_spec.rb +13 -6
- data/spec/strelka/app/errors_spec.rb +0 -5
- data/spec/strelka/app/filters_spec.rb +0 -5
- data/spec/strelka/app/negotiation_spec.rb +0 -5
- data/spec/strelka/app/parameters_spec.rb +0 -5
- data/spec/strelka/app/restresources_spec.rb +0 -5
- data/spec/strelka/app/routing_spec.rb +0 -5
- data/spec/strelka/app/sessions_spec.rb +0 -5
- data/spec/strelka/app/templating_spec.rb +0 -2
- data/spec/strelka/app_spec.rb +0 -2
- data/spec/strelka/authprovider/basic_spec.rb +0 -5
- data/spec/strelka/authprovider/hostaccess_spec.rb +0 -5
- data/spec/strelka/authprovider_spec.rb +0 -5
- data/spec/strelka/cookie_spec.rb +0 -8
- data/spec/strelka/discovery_spec.rb +0 -5
- data/spec/strelka/exceptions_spec.rb +0 -5
- data/spec/strelka/httprequest/acceptparams_spec.rb +0 -8
- data/spec/strelka/httprequest/auth_spec.rb +0 -5
- data/spec/strelka/httprequest/negotiation_spec.rb +0 -5
- data/spec/strelka/httprequest/session_spec.rb +0 -5
- data/spec/strelka/httprequest_spec.rb +0 -4
- data/spec/strelka/httpresponse/negotiation_spec.rb +0 -5
- data/spec/strelka/httpresponse/session_spec.rb +0 -5
- data/spec/strelka/httpresponse_spec.rb +0 -5
- data/spec/strelka/mixins_spec.rb +0 -7
- data/spec/strelka/multipartparser_spec.rb +0 -2
- data/spec/strelka/paramvalidator_spec.rb +1 -13
- data/spec/strelka/plugins_spec.rb +0 -2
- data/spec/strelka/router/default_spec.rb +0 -5
- data/spec/strelka/router/exclusive_spec.rb +0 -5
- data/spec/strelka/router_spec.rb +0 -5
- data/spec/strelka/session/db_spec.rb +0 -5
- data/spec/strelka/session/default_spec.rb +0 -5
- data/spec/strelka/session_spec.rb +0 -5
- data/spec/strelka/websocketserver/routing_spec.rb +0 -5
- data/spec/strelka/websocketserver_spec.rb +0 -2
- data/spec/strelka_spec.rb +0 -9
- metadata +78 -90
- metadata.gz.sig +0 -0
data/spec/helpers.rb
CHANGED
@@ -20,14 +20,9 @@ require 'strelka/behavior/plugin'
|
|
20
20
|
describe Strelka::App::Auth do
|
21
21
|
|
22
22
|
before( :all ) do
|
23
|
-
setup_logging( :fatal )
|
24
23
|
@request_factory = Mongrel2::RequestFactory.new( route: '/api/v1' )
|
25
24
|
end
|
26
25
|
|
27
|
-
after( :all ) do
|
28
|
-
reset_logging()
|
29
|
-
end
|
30
|
-
|
31
26
|
|
32
27
|
it_should_behave_like( "A Strelka Plugin" )
|
33
28
|
|
@@ -430,6 +425,19 @@ describe Strelka::App::Auth do
|
|
430
425
|
expect( app.required_perms_for(req) ).to eq( [ :write_access ] )
|
431
426
|
end
|
432
427
|
|
428
|
+
it "ensures required permissions are not retained between requests" do
|
429
|
+
@app.require_perms_for( %r{.*} ){|req| :basic_access }
|
430
|
+
app = @app.new
|
431
|
+
|
432
|
+
req = @request_factory.get( '/api/v1/accounts' )
|
433
|
+
|
434
|
+
expect {
|
435
|
+
app.required_perms_for( req )
|
436
|
+
}.to_not change {
|
437
|
+
@app.positive_perms_criteria.first[ 2 ]
|
438
|
+
}
|
439
|
+
end
|
440
|
+
|
433
441
|
it "adds specific required permissions returned by the block to argument permissions" do
|
434
442
|
@app.require_perms_for( %r{.*}, :basic_access ) do |req|
|
435
443
|
:write_access if req.verb != :GET
|
@@ -466,7 +474,6 @@ describe Strelka::App::Auth do
|
|
466
474
|
expect( app.required_perms_for(req) ).to include( :basic_access, :write_access, :is_handsome )
|
467
475
|
end
|
468
476
|
|
469
|
-
|
470
477
|
it "allows negative perms criteria to be declared with a string" do
|
471
478
|
@app.no_perms_for( '/string' )
|
472
479
|
app = @app.new
|
@@ -21,14 +21,9 @@ require 'strelka/behavior/plugin'
|
|
21
21
|
describe Strelka::App::Errors do
|
22
22
|
|
23
23
|
before( :all ) do
|
24
|
-
setup_logging( :fatal )
|
25
24
|
@request_factory = Mongrel2::RequestFactory.new( route: '' )
|
26
25
|
end
|
27
26
|
|
28
|
-
after( :all ) do
|
29
|
-
reset_logging()
|
30
|
-
end
|
31
|
-
|
32
27
|
|
33
28
|
it_should_behave_like( "A Strelka Plugin" )
|
34
29
|
|
@@ -20,14 +20,9 @@ require 'strelka/behavior/plugin'
|
|
20
20
|
describe Strelka::App::Filters do
|
21
21
|
|
22
22
|
before( :all ) do
|
23
|
-
setup_logging( :fatal )
|
24
23
|
@request_factory = Mongrel2::RequestFactory.new( route: '' )
|
25
24
|
end
|
26
25
|
|
27
|
-
after( :all ) do
|
28
|
-
reset_logging()
|
29
|
-
end
|
30
|
-
|
31
26
|
|
32
27
|
it_should_behave_like( "A Strelka Plugin" )
|
33
28
|
|
@@ -20,14 +20,9 @@ describe Strelka::App::Negotiation do
|
|
20
20
|
|
21
21
|
|
22
22
|
before( :all ) do
|
23
|
-
setup_logging( :fatal )
|
24
23
|
@request_factory = Mongrel2::RequestFactory.new( route: '/service/user' )
|
25
24
|
end
|
26
25
|
|
27
|
-
after( :all ) do
|
28
|
-
reset_logging()
|
29
|
-
end
|
30
|
-
|
31
26
|
|
32
27
|
it_should_behave_like( "A Strelka Plugin" )
|
33
28
|
|
@@ -19,14 +19,9 @@ require 'strelka/behavior/plugin'
|
|
19
19
|
describe Strelka::App::Parameters do
|
20
20
|
|
21
21
|
before( :all ) do
|
22
|
-
setup_logging( :fatal )
|
23
22
|
@request_factory = Mongrel2::RequestFactory.new( route: '/user' )
|
24
23
|
end
|
25
24
|
|
26
|
-
after( :all ) do
|
27
|
-
reset_logging()
|
28
|
-
end
|
29
|
-
|
30
25
|
|
31
26
|
it_should_behave_like( "A Strelka Plugin" )
|
32
27
|
|
@@ -22,7 +22,6 @@ describe Strelka::App::RestResources do
|
|
22
22
|
include Mongrel2::Config::DSL
|
23
23
|
|
24
24
|
before( :all ) do
|
25
|
-
setup_logging()
|
26
25
|
setup_config_db()
|
27
26
|
|
28
27
|
@request_factory = Mongrel2::RequestFactory.new( route: '/api/v1' )
|
@@ -37,10 +36,6 @@ describe Strelka::App::RestResources do
|
|
37
36
|
Mongrel2::Config::Server.dataset_module( name_selection )
|
38
37
|
end
|
39
38
|
|
40
|
-
after( :all ) do
|
41
|
-
reset_logging()
|
42
|
-
end
|
43
|
-
|
44
39
|
|
45
40
|
it_should_behave_like( "A Strelka Plugin" )
|
46
41
|
|
@@ -20,14 +20,9 @@ require 'strelka/behavior/plugin'
|
|
20
20
|
describe Strelka::App::Routing do
|
21
21
|
|
22
22
|
before( :all ) do
|
23
|
-
setup_logging( :fatal )
|
24
23
|
@request_factory = Mongrel2::RequestFactory.new( route: '' )
|
25
24
|
end
|
26
25
|
|
27
|
-
after( :all ) do
|
28
|
-
reset_logging()
|
29
|
-
end
|
30
|
-
|
31
26
|
|
32
27
|
it_should_behave_like( "A Strelka Plugin" )
|
33
28
|
|
@@ -18,14 +18,9 @@ require 'strelka/behavior/plugin'
|
|
18
18
|
describe Strelka::App::Sessions do
|
19
19
|
|
20
20
|
before( :all ) do
|
21
|
-
setup_logging( :fatal )
|
22
21
|
@request_factory = Mongrel2::RequestFactory.new( route: '' )
|
23
22
|
end
|
24
23
|
|
25
|
-
after( :all ) do
|
26
|
-
reset_logging()
|
27
|
-
end
|
28
|
-
|
29
24
|
|
30
25
|
it_should_behave_like( "A Strelka Plugin" )
|
31
26
|
|
@@ -21,14 +21,12 @@ require 'strelka/behavior/plugin'
|
|
21
21
|
describe Strelka::App::Templating do
|
22
22
|
|
23
23
|
before( :all ) do
|
24
|
-
setup_logging()
|
25
24
|
@request_factory = Mongrel2::RequestFactory.new( route: '/user' )
|
26
25
|
@original_template_paths = Inversion::Template.template_paths.dup
|
27
26
|
end
|
28
27
|
|
29
28
|
after( :all ) do
|
30
29
|
Inversion::Template.template_paths.replace( @original_template_paths )
|
31
|
-
reset_logging()
|
32
30
|
end
|
33
31
|
|
34
32
|
|
data/spec/strelka/app_spec.rb
CHANGED
@@ -19,7 +19,6 @@ require 'strelka/app'
|
|
19
19
|
describe Strelka::App do
|
20
20
|
|
21
21
|
before( :all ) do
|
22
|
-
setup_logging( :fatal )
|
23
22
|
@initial_registry = Strelka::App.loaded_plugins.dup
|
24
23
|
@request_factory = Mongrel2::RequestFactory.new( route: '/mail' )
|
25
24
|
Mongrel2::Config.db = Mongrel2::Config.in_memory_db
|
@@ -52,7 +51,6 @@ describe Strelka::App do
|
|
52
51
|
|
53
52
|
after( :all ) do
|
54
53
|
Strelka::App.loaded_plugins = @initial_registry
|
55
|
-
reset_logging()
|
56
54
|
end
|
57
55
|
|
58
56
|
|
@@ -18,7 +18,6 @@ describe Strelka::AuthProvider::Basic do
|
|
18
18
|
|
19
19
|
before( :all ) do
|
20
20
|
@request_factory = Mongrel2::RequestFactory.new( route: '/admin' )
|
21
|
-
setup_logging( :fatal )
|
22
21
|
end
|
23
22
|
|
24
23
|
before( :each ) do
|
@@ -38,10 +37,6 @@ describe Strelka::AuthProvider::Basic do
|
|
38
37
|
described_class.realm = nil
|
39
38
|
end
|
40
39
|
|
41
|
-
after( :all ) do
|
42
|
-
reset_logging()
|
43
|
-
end
|
44
|
-
|
45
40
|
|
46
41
|
#
|
47
42
|
# Helpers
|
@@ -18,7 +18,6 @@ describe Strelka::AuthProvider::HostAccess do
|
|
18
18
|
|
19
19
|
before( :all ) do
|
20
20
|
@request_factory = Mongrel2::RequestFactory.new( route: '/admin' )
|
21
|
-
setup_logging( :fatal )
|
22
21
|
end
|
23
22
|
|
24
23
|
before( :each ) do
|
@@ -26,10 +25,6 @@ describe Strelka::AuthProvider::HostAccess do
|
|
26
25
|
@provider = Strelka::AuthProvider.create( :hostaccess, @app )
|
27
26
|
end
|
28
27
|
|
29
|
-
after( :all ) do
|
30
|
-
reset_logging()
|
31
|
-
end
|
32
|
-
|
33
28
|
|
34
29
|
it "knows what its allowed netblocks are" do
|
35
30
|
expect( @provider.allowed_netblocks ).to be_an( Array )
|
data/spec/strelka/cookie_spec.rb
CHANGED
@@ -15,14 +15,6 @@ require 'strelka/cookie'
|
|
15
15
|
|
16
16
|
describe Strelka::Cookie do
|
17
17
|
|
18
|
-
before( :all ) do
|
19
|
-
setup_logging( :fatal )
|
20
|
-
end
|
21
|
-
|
22
|
-
after( :all ) do
|
23
|
-
reset_logging()
|
24
|
-
end
|
25
|
-
|
26
18
|
it "parses a 'nil' Cookie header field as an empty Hash" do
|
27
19
|
expect( Strelka::Cookie.parse( nil ) ).to eq( {} )
|
28
20
|
end
|
@@ -19,7 +19,6 @@ require 'strelka/discovery'
|
|
19
19
|
describe Strelka::Discovery do
|
20
20
|
|
21
21
|
before( :all ) do
|
22
|
-
setup_logging()
|
23
22
|
Mongrel2::Config.db = Mongrel2::Config.in_memory_db
|
24
23
|
Mongrel2::Config.init_database
|
25
24
|
|
@@ -31,10 +30,6 @@ describe Strelka::Discovery do
|
|
31
30
|
|
32
31
|
end
|
33
32
|
|
34
|
-
after( :all ) do
|
35
|
-
reset_logging()
|
36
|
-
end
|
37
|
-
|
38
33
|
|
39
34
|
let( :discoverable_class ) { Class.new {extend Strelka::Discovery} }
|
40
35
|
|
@@ -19,14 +19,9 @@ require 'strelka/exceptions'
|
|
19
19
|
describe Strelka, "exception classes" do
|
20
20
|
|
21
21
|
before( :all ) do
|
22
|
-
setup_logging( :fatal )
|
23
22
|
@request_factory = Mongrel2::RequestFactory.new( route: '/exceptions' )
|
24
23
|
end
|
25
24
|
|
26
|
-
after( :all ) do
|
27
|
-
reset_logging()
|
28
|
-
end
|
29
|
-
|
30
25
|
|
31
26
|
describe Strelka::RequestError do
|
32
27
|
|
@@ -16,14 +16,6 @@ require 'strelka/httprequest/acceptparams'
|
|
16
16
|
|
17
17
|
describe Strelka::HTTPRequest, "accept params" do
|
18
18
|
|
19
|
-
before( :all ) do
|
20
|
-
setup_logging( :fatal )
|
21
|
-
end
|
22
|
-
|
23
|
-
after( :all ) do
|
24
|
-
reset_logging()
|
25
|
-
end
|
26
|
-
|
27
19
|
|
28
20
|
describe Strelka::HTTPRequest::MediaType do
|
29
21
|
|
@@ -16,14 +16,9 @@ require 'strelka/httprequest/auth'
|
|
16
16
|
describe Strelka::HTTPRequest::Auth do
|
17
17
|
|
18
18
|
before( :all ) do
|
19
|
-
setup_logging( :fatal )
|
20
19
|
@request_factory = Mongrel2::RequestFactory.new( route: '/service/user' )
|
21
20
|
end
|
22
21
|
|
23
|
-
after( :all ) do
|
24
|
-
reset_logging()
|
25
|
-
end
|
26
|
-
|
27
22
|
before( :each ) do
|
28
23
|
@req = @request_factory.get( '/service/user/estark' )
|
29
24
|
@req.extend( described_class )
|
@@ -18,14 +18,9 @@ require 'strelka/httpresponse/negotiation'
|
|
18
18
|
describe Strelka::HTTPRequest::Negotiation do
|
19
19
|
|
20
20
|
before( :all ) do
|
21
|
-
setup_logging( :fatal )
|
22
21
|
@request_factory = Mongrel2::RequestFactory.new( route: '/service/user' )
|
23
22
|
end
|
24
23
|
|
25
|
-
after( :all ) do
|
26
|
-
reset_logging()
|
27
|
-
end
|
28
|
-
|
29
24
|
|
30
25
|
before( :each ) do
|
31
26
|
@req = @request_factory.get( '/service/user/estark' )
|
@@ -18,7 +18,6 @@ require 'strelka/session/default'
|
|
18
18
|
describe Strelka::HTTPRequest::Session, "-extended request" do
|
19
19
|
|
20
20
|
before( :all ) do
|
21
|
-
setup_logging( :fatal )
|
22
21
|
@request_factory = Mongrel2::RequestFactory.new( route: '/service/user' )
|
23
22
|
Strelka::App::Sessions.configure( session_class: 'default' )
|
24
23
|
end
|
@@ -32,10 +31,6 @@ describe Strelka::HTTPRequest::Session, "-extended request" do
|
|
32
31
|
Strelka::Session::Default.sessions.clear
|
33
32
|
end
|
34
33
|
|
35
|
-
after( :all ) do
|
36
|
-
reset_logging()
|
37
|
-
end
|
38
|
-
|
39
34
|
|
40
35
|
it "has a session_namespace attribute" do
|
41
36
|
expect( @req ).to respond_to( :session_namespace )
|
@@ -17,13 +17,9 @@ require 'strelka/cookie'
|
|
17
17
|
describe Strelka::HTTPRequest do
|
18
18
|
|
19
19
|
before( :all ) do
|
20
|
-
setup_logging()
|
21
20
|
@request_factory = Mongrel2::RequestFactory.new( route: '/directory' )
|
22
21
|
end
|
23
22
|
|
24
|
-
after( :all ) do
|
25
|
-
reset_logging()
|
26
|
-
end
|
27
23
|
|
28
24
|
context "instance" do
|
29
25
|
|
@@ -17,14 +17,9 @@ require 'strelka/httpresponse/negotiation'
|
|
17
17
|
describe Strelka::HTTPResponse::Negotiation do
|
18
18
|
|
19
19
|
before( :all ) do
|
20
|
-
setup_logging( :fatal )
|
21
20
|
@request_factory = Mongrel2::RequestFactory.new( route: '/service/user' )
|
22
21
|
end
|
23
22
|
|
24
|
-
after( :all ) do
|
25
|
-
reset_logging()
|
26
|
-
end
|
27
|
-
|
28
23
|
|
29
24
|
before( :each ) do
|
30
25
|
@app = Class.new( Strelka::App ) { plugins :negotiation }
|
@@ -19,7 +19,6 @@ require 'strelka/session/default'
|
|
19
19
|
describe Strelka::HTTPResponse::Session, "-extended response" do
|
20
20
|
|
21
21
|
before( :all ) do
|
22
|
-
setup_logging( :fatal )
|
23
22
|
@request_factory = Mongrel2::RequestFactory.new( route: '/service/user' )
|
24
23
|
Strelka::App::Sessions.configure( session_class: 'default' )
|
25
24
|
end
|
@@ -35,10 +34,6 @@ describe Strelka::HTTPResponse::Session, "-extended response" do
|
|
35
34
|
Strelka::Session::Default.sessions.clear
|
36
35
|
end
|
37
36
|
|
38
|
-
after( :all ) do
|
39
|
-
reset_logging()
|
40
|
-
end
|
41
|
-
|
42
37
|
|
43
38
|
it "has a session_namespace attribute" do
|
44
39
|
expect( @res ).to respond_to( :session_namespace )
|
@@ -14,7 +14,6 @@ require 'strelka/httpresponse'
|
|
14
14
|
describe Strelka::HTTPResponse do
|
15
15
|
|
16
16
|
before( :all ) do
|
17
|
-
setup_logging( :fatal )
|
18
17
|
@request_factory = Mongrel2::RequestFactory.new( route: '/glossary' )
|
19
18
|
end
|
20
19
|
|
@@ -23,10 +22,6 @@ describe Strelka::HTTPResponse do
|
|
23
22
|
@res = @req.response
|
24
23
|
end
|
25
24
|
|
26
|
-
after( :all ) do
|
27
|
-
reset_logging()
|
28
|
-
end
|
29
|
-
|
30
25
|
|
31
26
|
it "adds a charset to the response's content-type header if it's text/* and one is explicitly set" do
|
32
27
|
@res.content_type = 'text/html'
|
data/spec/strelka/mixins_spec.rb
CHANGED
@@ -61,13 +61,6 @@ describe Strelka, "mixins" do
|
|
61
61
|
|
62
62
|
describe Strelka::Delegation do
|
63
63
|
|
64
|
-
before( :all ) do
|
65
|
-
setup_logging( :fatal )
|
66
|
-
end
|
67
|
-
after( :all ) do
|
68
|
-
reset_logging()
|
69
|
-
end
|
70
|
-
|
71
64
|
describe "method delegation" do
|
72
65
|
before( :all ) do
|
73
66
|
@testclass = Class.new do
|