strelka 0.6.0 → 0.7.0

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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/ChangeLog +156 -9
  4. data/History.rdoc +15 -0
  5. data/IDEAS.rdoc +17 -1
  6. data/MILESTONES.rdoc +1 -1
  7. data/Manifest.txt +10 -2
  8. data/Plugins.rdoc +4 -4
  9. data/README.rdoc +3 -3
  10. data/Rakefile +5 -4
  11. data/bin/strelka +19 -10
  12. data/contrib/hoetemplate/data/project/apps/file_name_app +1 -0
  13. data/contrib/hoetemplate/lib/file_name.rb.erb +3 -2
  14. data/examples/apps/hello-world +1 -0
  15. data/examples/apps/ws-chat +69 -0
  16. data/examples/apps/ws-echo +61 -0
  17. data/examples/gen-config.rb +6 -5
  18. data/lib/strelka/app/auth.rb +2 -2
  19. data/lib/strelka/app/errors.rb +1 -1
  20. data/lib/strelka/app/filters.rb +3 -2
  21. data/lib/strelka/app/negotiation.rb +2 -2
  22. data/lib/strelka/app/parameters.rb +1 -2
  23. data/lib/strelka/app/restresources.rb +3 -2
  24. data/lib/strelka/app/routing.rb +1 -1
  25. data/lib/strelka/app/sessions.rb +2 -2
  26. data/lib/strelka/app/templating.rb +7 -3
  27. data/lib/strelka/app.rb +5 -145
  28. data/lib/strelka/behavior/plugin.rb +4 -4
  29. data/lib/strelka/discovery.rb +211 -0
  30. data/lib/strelka/httprequest.rb +1 -0
  31. data/lib/strelka/httpresponse/negotiation.rb +7 -1
  32. data/lib/strelka/mixins.rb +4 -1
  33. data/lib/strelka/paramvalidator.rb +1 -1
  34. data/lib/strelka/plugins.rb +8 -6
  35. data/lib/strelka/websocketserver/routing.rb +116 -0
  36. data/lib/strelka/websocketserver.rb +147 -0
  37. data/lib/strelka.rb +5 -4
  38. data/spec/{lib/constants.rb → constants.rb} +3 -2
  39. data/spec/{lib/helpers.rb → helpers.rb} +15 -14
  40. data/spec/strelka/app/auth_spec.rb +145 -142
  41. data/spec/strelka/app/errors_spec.rb +20 -26
  42. data/spec/strelka/app/filters_spec.rb +67 -54
  43. data/spec/strelka/app/negotiation_spec.rb +8 -14
  44. data/spec/strelka/app/parameters_spec.rb +23 -29
  45. data/spec/strelka/app/restresources_spec.rb +98 -100
  46. data/spec/strelka/app/routing_spec.rb +57 -57
  47. data/spec/strelka/app/sessions_spec.rb +11 -17
  48. data/spec/strelka/app/templating_spec.rb +36 -40
  49. data/spec/strelka/app_spec.rb +48 -147
  50. data/spec/strelka/authprovider/basic_spec.rb +5 -11
  51. data/spec/strelka/authprovider/hostaccess_spec.rb +9 -15
  52. data/spec/strelka/authprovider_spec.rb +3 -9
  53. data/spec/strelka/cookie_spec.rb +32 -38
  54. data/spec/strelka/cookieset_spec.rb +31 -37
  55. data/spec/strelka/discovery_spec.rb +144 -0
  56. data/spec/strelka/exceptions_spec.rb +2 -8
  57. data/spec/strelka/httprequest/acceptparams_spec.rb +74 -83
  58. data/spec/strelka/httprequest/auth_spec.rb +5 -15
  59. data/spec/strelka/httprequest/negotiation_spec.rb +93 -103
  60. data/spec/strelka/httprequest/session_spec.rb +12 -22
  61. data/spec/strelka/httprequest_spec.rb +1 -7
  62. data/spec/strelka/httpresponse/negotiation_spec.rb +84 -76
  63. data/spec/strelka/httpresponse/session_spec.rb +25 -35
  64. data/spec/strelka/httpresponse_spec.rb +20 -26
  65. data/spec/strelka/mixins_spec.rb +66 -61
  66. data/spec/strelka/multipartparser_spec.rb +31 -37
  67. data/spec/strelka/paramvalidator_spec.rb +389 -373
  68. data/spec/strelka/plugins_spec.rb +17 -23
  69. data/spec/strelka/router/default_spec.rb +32 -38
  70. data/spec/strelka/router/exclusive_spec.rb +28 -34
  71. data/spec/strelka/router_spec.rb +2 -8
  72. data/spec/strelka/session/db_spec.rb +17 -15
  73. data/spec/strelka/session/default_spec.rb +22 -28
  74. data/spec/strelka/session_spec.rb +3 -9
  75. data/spec/strelka/websocketserver/routing_spec.rb +119 -0
  76. data/spec/strelka/websocketserver_spec.rb +149 -0
  77. data/spec/strelka_spec.rb +11 -13
  78. data.tar.gz.sig +3 -3
  79. metadata +22 -14
  80. metadata.gz.sig +0 -0
@@ -2,17 +2,11 @@
2
2
  # vim: set nosta noet ts=4 sw=4:
3
3
  # encoding: utf-8
4
4
 
5
- BEGIN {
6
- require 'pathname'
7
- basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
8
- $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
9
- }
5
+ require_relative '../../helpers'
10
6
 
11
7
  require 'rspec'
12
8
  require 'inversion'
13
9
 
14
- require 'spec/lib/helpers'
15
-
16
10
  require 'strelka'
17
11
  require 'strelka/plugins'
18
12
  require 'strelka/app/errors'
@@ -36,7 +30,7 @@ describe Strelka::App::Errors do
36
30
  end
37
31
 
38
32
 
39
- it_should_behave_like( "A Strelka::App Plugin" )
33
+ it_should_behave_like( "A Strelka Plugin" )
40
34
 
41
35
 
42
36
  describe "an including App" do
@@ -55,8 +49,8 @@ describe Strelka::App::Errors do
55
49
  'blap'
56
50
  end
57
51
  subclass = Class.new( @app )
58
- subclass.status_handlers.should == @app.status_handlers
59
- subclass.status_handlers.should_not equal( @app.status_handlers )
52
+ expect( subclass.status_handlers ).to eq( @app.status_handlers )
53
+ expect( subclass.status_handlers ).to_not equal( @app.status_handlers )
60
54
  end
61
55
 
62
56
  it "doesn't alter normal responses" do
@@ -72,9 +66,9 @@ describe Strelka::App::Errors do
72
66
  req = @request_factory.get( '/koolaid' )
73
67
  res = @app.new.handle( req )
74
68
 
75
- res.status.should == HTTP::OK
69
+ expect( res.status ).to eq( HTTP::OK )
76
70
  res.body.rewind
77
- res.body.read.should == "Oh yeah! Kool-Aid!\n"
71
+ expect( res.body.read ).to eq( "Oh yeah! Kool-Aid!\n" )
78
72
  end
79
73
 
80
74
  it "raises an error if a handler is declared with both a template and a block" do
@@ -107,7 +101,7 @@ describe Strelka::App::Errors do
107
101
  res = @app.new.handle( req )
108
102
 
109
103
  res.body.rewind
110
- res.body.read.should =~ /internal server error/i
104
+ expect( res.body.read ).to match( /internal server error/i )
111
105
  end
112
106
 
113
107
  it "calls a callback-style handler for any status when finished with BAD_REQUEST" do
@@ -125,9 +119,9 @@ describe Strelka::App::Errors do
125
119
  req = @request_factory.get( '/foom' )
126
120
  res = @app.new.handle( req )
127
121
 
128
- res.status.should == HTTP::BAD_REQUEST
122
+ expect( res.status ).to eq( HTTP::BAD_REQUEST )
129
123
  res.body.rewind
130
- res.body.read.should == '(400) Filthy banana'
124
+ expect( res.body.read ).to eq( '(400) Filthy banana' )
131
125
  end
132
126
 
133
127
 
@@ -143,7 +137,7 @@ describe Strelka::App::Errors do
143
137
  res = @app.new.handle( req )
144
138
 
145
139
  res.body.rewind
146
- res.body.read.should == 'NOPE!'
140
+ expect( res.body.read ).to eq( 'NOPE!' )
147
141
  end
148
142
 
149
143
 
@@ -159,7 +153,7 @@ describe Strelka::App::Errors do
159
153
  res = @app.new.handle( req )
160
154
 
161
155
  res.body.rewind
162
- res.body.read.should == 'Error: JAMBA'
156
+ expect( res.body.read ).to eq( 'Error: JAMBA' )
163
157
  end
164
158
 
165
159
  it "sets the error status info in the transaction notes when the response is handled by a status-handler" do
@@ -177,9 +171,9 @@ describe Strelka::App::Errors do
177
171
  req = @request_factory.get( '/foom' )
178
172
  res = @app.new.handle( req )
179
173
 
180
- res.notes[:status_info].should include( :status, :message, :headers )
181
- res.notes[:status_info][:status].should == HTTP::BAD_REQUEST
182
- res.notes[:status_info][:message].should == "Your sandwich is missing something."
174
+ expect( res.notes[:status_info] ).to include( :status, :message, :headers )
175
+ expect( res.notes[:status_info][:status] ).to eq( HTTP::BAD_REQUEST )
176
+ expect( res.notes[:status_info][:message] ).to eq( "Your sandwich is missing something." )
183
177
  end
184
178
 
185
179
  it "provides its own exception handler for the request phase" do
@@ -197,12 +191,12 @@ describe Strelka::App::Errors do
197
191
  req = @request_factory.get( '/foom' )
198
192
  res = @app.new.handle( req )
199
193
 
200
- res.notes[:status_info].should include( :status, :message, :headers, :exception )
201
- res.notes[:status_info][:status].should == HTTP::SERVER_ERROR
202
- res.notes[:status_info][:message].should == "An uncaught exception"
203
- res.notes[:status_info][:exception].should be_a( RuntimeError )
194
+ expect( res.notes[:status_info] ).to include( :status, :message, :headers, :exception )
195
+ expect( res.notes[:status_info][:status] ).to eq( HTTP::SERVER_ERROR )
196
+ expect( res.notes[:status_info][:message] ).to eq( "An uncaught exception" )
197
+ expect( res.notes[:status_info][:exception] ).to be_a( RuntimeError )
204
198
  res.body.rewind
205
- res.body.read.should == "RuntimeError"
199
+ expect( res.body.read ).to eq( "RuntimeError" )
206
200
  end
207
201
 
208
202
 
@@ -235,7 +229,7 @@ describe Strelka::App::Errors do
235
229
  res = @app.new.handle( req )
236
230
 
237
231
  res.body.rewind
238
- res.body.read.should =~ /error-handler template/i
232
+ expect( res.body.read ).to match( /error-handler template/i )
239
233
  end
240
234
  end
241
235
 
@@ -2,16 +2,10 @@
2
2
  # vim: set nosta noet ts=4 sw=4:
3
3
  # encoding: utf-8
4
4
 
5
- BEGIN {
6
- require 'pathname'
7
- basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
8
- $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
9
- }
5
+ require_relative '../../helpers'
10
6
 
11
7
  require 'rspec'
12
8
 
13
- require 'spec/lib/helpers'
14
-
15
9
  require 'strelka'
16
10
  require 'strelka/plugins'
17
11
  require 'strelka/app/filters'
@@ -35,10 +29,10 @@ describe Strelka::App::Filters do
35
29
  end
36
30
 
37
31
 
38
- it_should_behave_like( "A Strelka::App Plugin" )
32
+ it_should_behave_like( "A Strelka Plugin" )
39
33
 
40
34
 
41
- describe "an including App" do
35
+ context "an including App" do
42
36
 
43
37
  before( :each ) do
44
38
  @app = Class.new( Strelka::App ) do
@@ -55,41 +49,39 @@ describe Strelka::App::Filters do
55
49
  end
56
50
  subclass = Class.new( @app )
57
51
 
58
- subclass.filters.should == @app.filters
59
- subclass.filters.should_not equal( @app.filters )
60
- subclass.filters[:request].should_not equal( @app.filters[:request] )
61
- subclass.filters[:response].should_not equal( @app.filters[:response] )
62
- subclass.filters[:both].should_not equal( @app.filters[:both] )
52
+ expect( subclass.filters ).to eq( @app.filters )
53
+ expect( subclass.filters ).to_not equal( @app.filters )
54
+ expect( subclass.filters[:request] ).to_not equal( @app.filters[:request] )
55
+ expect( subclass.filters[:response] ).to_not equal( @app.filters[:response] )
56
+ expect( subclass.filters[:both] ).to_not equal( @app.filters[:both] )
63
57
  end
64
58
 
65
59
  it "has a Hash of filters" do
66
- @app.filters.should be_a( Hash )
60
+ expect( @app.filters ).to be_a( Hash )
67
61
  end
68
62
 
69
63
 
70
- describe "that doesn't declare any filters" do
64
+ context "that doesn't declare any filters" do
71
65
 
72
66
  it "doesn't have any request filters" do
73
- @app.request_filters.should be_empty()
67
+ expect( @app.request_filters ).to be_empty()
74
68
  end
75
69
 
76
70
  it "doesn't have any response filters" do
77
- @app.response_filters.should be_empty()
71
+ expect( @app.response_filters ).to be_empty()
78
72
  end
79
73
 
80
74
  end
81
75
 
82
76
 
83
- describe "that declares a filter without a phase" do
77
+ context "that declares a filter without a phase" do
84
78
 
85
79
  before( :each ) do
86
- @app.class_eval do
87
- filter do |reqres|
88
- if reqres.is_a?( Strelka::HTTPRequest )
89
- reqres.notes[:saw][:request] = true
90
- else
91
- reqres.notes[:saw][:response] = true
92
- end
80
+ @app.filter do |reqres|
81
+ if reqres.is_a?( Strelka::HTTPRequest )
82
+ reqres.notes[:saw][:request] = true
83
+ else
84
+ reqres.notes[:saw][:response] = true
93
85
  end
94
86
  end
95
87
  end
@@ -102,11 +94,11 @@ describe Strelka::App::Filters do
102
94
 
103
95
 
104
96
  it "has a single request filter" do
105
- @app.request_filters.should have(1).member
97
+ expect( @app.request_filters ).to have(1).member
106
98
  end
107
99
 
108
100
  it "has a single response filter" do
109
- @app.response_filters.should have(1).member
101
+ expect( @app.response_filters ).to have(1).member
110
102
  end
111
103
 
112
104
  it "passes both the request and the response through it" do
@@ -114,22 +106,20 @@ describe Strelka::App::Filters do
114
106
 
115
107
  res = @app.new.handle( req )
116
108
 
117
- req.notes[:saw][:request].should be_true()
118
- res.notes[:saw][:response].should be_true()
109
+ expect( req.notes[:saw][:request] ).to be_true()
110
+ expect( res.notes[:saw][:response] ).to be_true()
119
111
  end
120
112
 
121
113
  end
122
114
 
123
- describe "that declares a request filter" do
115
+ context "that declares a request filter" do
124
116
 
125
117
  before( :each ) do
126
- @app.class_eval do
127
- filter( :request ) do |reqres|
128
- if reqres.is_a?( Strelka::HTTPRequest )
129
- reqres.notes[:saw][:request] = true
130
- else
131
- reqres.notes[:saw][:response] = true
132
- end
118
+ @app.filter( :request ) do |reqres|
119
+ if reqres.is_a?( Strelka::HTTPRequest )
120
+ reqres.notes[:saw][:request] = true
121
+ else
122
+ reqres.notes[:saw][:response] = true
133
123
  end
134
124
  end
135
125
  end
@@ -142,11 +132,11 @@ describe Strelka::App::Filters do
142
132
 
143
133
 
144
134
  it "has a single request filter" do
145
- @app.request_filters.should have(1).member
135
+ expect( @app.request_filters ).to have(1).member
146
136
  end
147
137
 
148
138
  it "has no response filters" do
149
- @app.response_filters.should be_empty()
139
+ expect( @app.response_filters ).to be_empty()
150
140
  end
151
141
 
152
142
  it "passes just the request through it" do
@@ -154,22 +144,20 @@ describe Strelka::App::Filters do
154
144
 
155
145
  res = @app.new.handle( req )
156
146
 
157
- req.notes[:saw][:request].should be_true()
158
- res.notes[:saw][:response].should be_nil()
147
+ expect( req.notes[:saw][:request] ).to be_true()
148
+ expect( res.notes[:saw][:response] ).to be_nil()
159
149
  end
160
150
 
161
151
  end
162
152
 
163
- describe "that declares a response filter" do
153
+ context "that declares a response filter" do
164
154
 
165
155
  before( :each ) do
166
- @app.class_eval do
167
- filter( :response ) do |reqres|
168
- if reqres.is_a?( Strelka::HTTPRequest )
169
- reqres.notes[:saw][:request] = true
170
- else
171
- reqres.notes[:saw][:response] = true
172
- end
156
+ @app.filter( :response ) do |reqres|
157
+ if reqres.is_a?( Strelka::HTTPRequest )
158
+ reqres.notes[:saw][:request] = true
159
+ else
160
+ reqres.notes[:saw][:response] = true
173
161
  end
174
162
  end
175
163
  end
@@ -182,11 +170,11 @@ describe Strelka::App::Filters do
182
170
 
183
171
 
184
172
  it "has no request filters" do
185
- @app.request_filters.should be_empty()
173
+ expect( @app.request_filters ).to be_empty()
186
174
  end
187
175
 
188
176
  it "has no response filters" do
189
- @app.response_filters.should have(1).member
177
+ expect( @app.response_filters ).to have(1).member
190
178
  end
191
179
 
192
180
  it "passes just the response through it" do
@@ -194,10 +182,35 @@ describe Strelka::App::Filters do
194
182
 
195
183
  res = @app.new.handle( req )
196
184
 
197
- req.notes[:saw][:request].should be_nil()
198
- res.notes[:saw][:response].should be_true()
185
+ expect( req.notes[:saw][:request] ).to be_nil()
186
+ expect( res.notes[:saw][:response] ).to be_true()
187
+ end
188
+
189
+ end
190
+
191
+
192
+ context "that returns something other than an HTTPResponse from its handler" do
193
+
194
+ before( :each ) do
195
+ @app.class_eval do
196
+ plugin :templating
197
+ templates :main => 'spec/data/main.tmpl'
198
+ def handle_request( req )
199
+ super { :main }
200
+ end
201
+ end
199
202
  end
200
203
 
204
+ it "still gives the response filter an HTTPResponse" do
205
+ @app.filter( :response ) do |res|
206
+ expect( res ).to be_a( Strelka::HTTPResponse )
207
+ end
208
+
209
+ req = @request_factory.get( '/account/118811' )
210
+ res = @app.new.handle( req )
211
+
212
+ expect( res.status_line ).to match( /200 ok/i )
213
+ end
201
214
  end
202
215
 
203
216
  end
@@ -2,16 +2,10 @@
2
2
  # vim: set nosta noet ts=4 sw=4:
3
3
  # encoding: utf-8
4
4
 
5
- BEGIN {
6
- require 'pathname'
7
- basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
8
- $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
9
- }
5
+ require_relative '../../helpers'
10
6
 
11
7
  require 'rspec'
12
8
 
13
- require 'spec/lib/helpers'
14
-
15
9
  require 'strelka'
16
10
  require 'strelka/plugins'
17
11
  require 'strelka/app/negotiation'
@@ -35,7 +29,7 @@ describe Strelka::App::Negotiation do
35
29
  end
36
30
 
37
31
 
38
- it_should_behave_like( "A Strelka::App Plugin" )
32
+ it_should_behave_like( "A Strelka Plugin" )
39
33
 
40
34
 
41
35
  describe "an including App" do
@@ -70,22 +64,22 @@ describe Strelka::App::Negotiation do
70
64
  it "gets requests that have been extended with content-negotiation" do
71
65
  req = @request_factory.get( '/service/user/estark' )
72
66
  @app.new.handle( req )
73
- req.singleton_class.included_modules.
74
- should include( Strelka::HTTPRequest::Negotiation )
67
+ expect( req.singleton_class.included_modules ).
68
+ to include( Strelka::HTTPRequest::Negotiation )
75
69
  end
76
70
 
77
71
  it "gets responses that have been extended with content-negotiation" do
78
72
  req = @request_factory.get( '/service/user/estark' )
79
73
  res = @app.new.handle( req )
80
- res.singleton_class.included_modules.
81
- should include( Strelka::HTTPResponse::Negotiation )
74
+ expect( res.singleton_class.included_modules ).
75
+ to include( Strelka::HTTPResponse::Negotiation )
82
76
  end
83
77
 
84
78
  it "adds custom content-type transforms to outgoing responses" do
85
79
  req = @request_factory.get( '/service/user/astark', :accept => 'text/x-tnetstring' )
86
80
  res = @app.new.handle( req )
87
- res.content_type.should == 'text/x-tnetstring'
88
- res.body.read.should == '28:2:an,19:5:array,8:of stuff,}]'
81
+ expect( res.content_type ).to eq( 'text/x-tnetstring' )
82
+ expect( res.body.read ).to eq( '28:2:an,19:5:array,8:of stuff,}]' )
89
83
  end
90
84
 
91
85
  end
@@ -2,16 +2,10 @@
2
2
  # vim: set nosta noet ts=4 sw=4:
3
3
  # encoding: utf-8
4
4
 
5
- BEGIN {
6
- require 'pathname'
7
- basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
8
- $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
9
- }
5
+ require_relative '../../helpers'
10
6
 
11
7
  require 'rspec'
12
8
 
13
- require 'spec/lib/helpers'
14
-
15
9
  require 'strelka'
16
10
  require 'strelka/plugins'
17
11
  require 'strelka/app/parameters'
@@ -34,7 +28,7 @@ describe Strelka::App::Parameters do
34
28
  end
35
29
 
36
30
 
37
- it_should_behave_like( "A Strelka::App Plugin" )
31
+ it_should_behave_like( "A Strelka Plugin" )
38
32
 
39
33
 
40
34
  describe "an including App" do
@@ -56,12 +50,12 @@ describe Strelka::App::Parameters do
56
50
  @app.param :string
57
51
  subclass = Class.new( @app )
58
52
 
59
- subclass.paramvalidator.param_names.should == @app.paramvalidator.param_names
60
- subclass.paramvalidator.should_not equal( @app.paramvalidator )
53
+ expect( subclass.paramvalidator.param_names ).to eq( @app.paramvalidator.param_names )
54
+ expect( subclass.paramvalidator ).to_not equal( @app.paramvalidator )
61
55
  end
62
56
 
63
57
  it "has a ParamValidator" do
64
- @app.paramvalidator.should be_a( Strelka::ParamValidator )
58
+ expect( @app.paramvalidator ).to be_a( Strelka::ParamValidator )
65
59
  end
66
60
 
67
61
  it "can declare a parameter with a regular-expression constraint" do
@@ -69,7 +63,7 @@ describe Strelka::App::Parameters do
69
63
  param :username, /\w+/i
70
64
  end
71
65
 
72
- @app.paramvalidator.param_names.should == [ 'username' ]
66
+ expect( @app.paramvalidator.param_names ).to eq( [ 'username' ] )
73
67
  end
74
68
 
75
69
  it "can declare a parameter with a builtin constraint" do
@@ -77,7 +71,7 @@ describe Strelka::App::Parameters do
77
71
  param :comment_body, :printable
78
72
  end
79
73
 
80
- @app.paramvalidator.param_names.should == [ 'comment_body' ]
74
+ expect( @app.paramvalidator.param_names ).to eq( [ 'comment_body' ] )
81
75
  end
82
76
 
83
77
  it "can declare a parameter with a Proc constraint" do
@@ -87,7 +81,7 @@ describe Strelka::App::Parameters do
87
81
  end
88
82
  end
89
83
 
90
- @app.paramvalidator.param_names.should == [ 'start_time' ]
84
+ expect( @app.paramvalidator.param_names ).to eq( [ 'start_time' ] )
91
85
  end
92
86
 
93
87
 
@@ -98,7 +92,7 @@ describe Strelka::App::Parameters do
98
92
  end
99
93
  end
100
94
 
101
- @app.paramvalidator.param_names.should == [ 'created_at' ]
95
+ expect( @app.paramvalidator.param_names ).to eq( [ 'created_at' ] )
102
96
  end
103
97
 
104
98
 
@@ -108,7 +102,7 @@ describe Strelka::App::Parameters do
108
102
  end
109
103
  subapp = Class.new( @app )
110
104
 
111
- subapp.paramvalidator.param_names.should == [ 'username' ]
105
+ expect( subapp.paramvalidator.param_names ).to eq( [ 'username' ] )
112
106
  end
113
107
 
114
108
  describe "instance" do
@@ -124,20 +118,20 @@ describe Strelka::App::Parameters do
124
118
  req = @request_factory.get( '/user/search' )
125
119
  @app.new.handle( req )
126
120
 
127
- req.params.should be_a( Strelka::ParamValidator )
128
- req.params.should have_errors()
129
- req.params.error_messages.should == ["Missing value for 'Username'"]
121
+ expect( req.params ).to be_a( Strelka::ParamValidator )
122
+ expect( req.params ).to have_errors()
123
+ expect( req.params.error_messages ).to eq( ["Missing value for 'Username'"] )
130
124
  end
131
125
 
132
126
  it "validates parameters from the request" do
133
127
  req = @request_factory.get( '/user/search?username=anheptoh'.taint )
134
128
  @app.new.handle( req )
135
129
 
136
- req.params.should be_a( Strelka::ParamValidator )
137
- req.params.should be_okay()
138
- req.params.should_not have_errors()
139
- req.params[:username].should == 'anheptoh'
140
- req.params[:username].should be_tainted()
130
+ expect( req.params ).to be_a( Strelka::ParamValidator )
131
+ expect( req.params ).to be_okay()
132
+ expect( req.params ).to_not have_errors()
133
+ expect( req.params[:username] ).to eq( 'anheptoh' )
134
+ expect( req.params[:username] ).to be_tainted()
141
135
  end
142
136
 
143
137
  it "untaints all parameters if global untainting is enabled" do
@@ -145,12 +139,12 @@ describe Strelka::App::Parameters do
145
139
  untaint_all_constraints true
146
140
  end
147
141
 
148
- @app.untaint_all_constraints.should be_true()
142
+ expect( @app.untaint_all_constraints ).to be_true()
149
143
  req = @request_factory.get( '/user/search?username=shereshnaheth'.taint )
150
144
  @app.new.handle( req )
151
145
 
152
- req.params[:username].should == 'shereshnaheth'
153
- req.params[:username].should_not be_tainted()
146
+ expect( req.params[:username] ).to eq( 'shereshnaheth' )
147
+ expect( req.params[:username] ).to_not be_tainted()
154
148
  end
155
149
 
156
150
  it "untaints parameters flagged for untainting" do
@@ -161,8 +155,8 @@ describe Strelka::App::Parameters do
161
155
  req = @request_factory.get( '/user/search?message=I+love+the+circus.'.taint )
162
156
  @app.new.handle( req )
163
157
 
164
- req.params[:message].should_not be_tainted()
165
- req.params[:message].should == 'I love the circus.'
158
+ expect( req.params[:message] ).to_not be_tainted()
159
+ expect( req.params[:message] ).to eq( 'I love the circus.' )
166
160
  end
167
161
 
168
162
  end