|
119 | 119 |
|
120 | 120 | end |
121 | 121 |
|
122 | | - describe 'rails 3.0', :lib => :rails30 do |
123 | | - |
124 | | - before(:all) { copy_gemfile("rails30") } |
125 | | - |
126 | | - def base_path; "file://#{STUB_DIR}/rails30" end |
127 | | - |
128 | | - it_should_behave_like 'a rails app' |
129 | | - |
130 | | - context "initialized" do |
131 | | - |
132 | | - before :all do |
133 | | - initialize_rails nil, base_path |
134 | | - end |
135 | | - |
136 | | - it "loaded rack ~> 1.2" do |
137 | | - @runtime = @rack_factory.getApplication.getRuntime |
138 | | - should_eval_as_not_nil "defined?(Rack.release)" |
139 | | - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.2' |
140 | | - end |
141 | | - |
142 | | - it "disables rack's chunked support (by default)" do |
143 | | - @runtime = @rack_factory.getApplication.getRuntime |
144 | | - expect_to_have_monkey_patched_chunked |
145 | | - end |
146 | | - |
147 | | - end |
148 | | - |
149 | | - context "initialized (custom)" do |
150 | | - |
151 | | - before :all do |
152 | | - initialize_rails 'custom', base_path |
153 | | - end |
154 | | - |
155 | | - it "booted a custom env with a custom logger" do |
156 | | - @runtime = @rack_factory.getApplication.getRuntime |
157 | | - should_eval_as_not_nil "defined?(Rails)" |
158 | | - should_eval_as_eql_to "Rails.env", 'custom' |
159 | | - should_eval_as_not_nil "Rails.logger" |
160 | | - should_eval_as_eql_to "Rails.logger.class.name", 'CustomLogger' |
161 | | - end |
162 | | - |
163 | | - end |
164 | | - |
165 | | - end |
166 | | - |
167 | | - describe 'rails 3.1', :lib => :rails31 do |
168 | | - |
169 | | - before(:all) { copy_gemfile("rails31") } |
170 | | - |
171 | | - def base_path; "file://#{STUB_DIR}/rails31" end |
172 | | - |
173 | | - it_should_behave_like 'a rails app' |
174 | | - |
175 | | - context "initialized" do |
176 | | - |
177 | | - before :all do |
178 | | - initialize_rails 'production', base_path |
179 | | - end |
180 | | - after(:all) { restore_rails } |
181 | | - |
182 | | - it "loaded META-INF/init.rb" do |
183 | | - @runtime = @rack_factory.getApplication.getRuntime |
184 | | - should_eval_as_not_nil "defined?(WARBLER_CONFIG)" |
185 | | - end |
186 | | - |
187 | | - it "loaded rack ~> 1.3" do |
188 | | - @runtime = @rack_factory.getApplication.getRuntime |
189 | | - should_eval_as_not_nil "defined?(Rack.release)" |
190 | | - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.3' |
191 | | - end |
192 | | - |
193 | | - it "booted with a servlet logger" do |
194 | | - @runtime = @rack_factory.getApplication.getRuntime |
195 | | - should_eval_as_not_nil "defined?(Rails)" |
196 | | - should_eval_as_not_nil "Rails.logger" |
197 | | - should_eval_as_not_nil "Rails.logger.instance_variable_get(:'@logdev')" # Logger::LogDevice |
198 | | - should_eval_as_eql_to "Rails.logger.instance_variable_get(:'@logdev').dev.class.name", 'JRuby::Rack::ServletLog' |
199 | | - |
200 | | - should_eval_as_eql_to "Rails.logger.level", Logger::DEBUG |
201 | | - end |
202 | | - |
203 | | - it "disables rack's chunked support (by default)" do |
204 | | - @runtime = @rack_factory.getApplication.getRuntime |
205 | | - expect_to_have_monkey_patched_chunked |
206 | | - end |
207 | | - |
208 | | - end |
209 | | - |
210 | | - end |
211 | | - |
212 | | - describe 'rails 3.2', :lib => :rails32 do |
213 | | - |
214 | | - before(:all) { copy_gemfile("rails32") } |
215 | | - |
216 | | - def base_path; "file://#{STUB_DIR}/rails32" end |
217 | | - |
218 | | - it_should_behave_like 'a rails app' |
219 | | - |
220 | | - context "initialized" do |
221 | | - |
222 | | - before(:all) { initialize_rails 'production', base_path } |
223 | | - after(:all) { restore_rails } |
224 | | - |
225 | | - it "loaded rack ~> 1.4" do |
226 | | - @runtime = @rack_factory.getApplication.getRuntime |
227 | | - should_eval_as_not_nil "defined?(Rack.release)" |
228 | | - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.4' |
229 | | - end |
230 | | - |
231 | | - it "booted with a servlet logger" do |
232 | | - @runtime = @rack_factory.getApplication.getRuntime |
233 | | - should_eval_as_not_nil "defined?(Rails)" |
234 | | - should_eval_as_not_nil "Rails.logger" |
235 | | - should_eval_as_eql_to "Rails.logger.class.name", 'ActiveSupport::TaggedLogging' |
236 | | - should_eval_as_not_nil "Rails.logger.instance_variable_get(:'@logger')" |
237 | | - should_eval_as_eql_to "logger = Rails.logger.instance_variable_get(:'@logger'); " + |
238 | | - "logger.instance_variable_get(:'@logdev').dev.class.name", 'JRuby::Rack::ServletLog' |
239 | | - |
240 | | - should_eval_as_eql_to "Rails.logger.level", Logger::INFO |
241 | | - end |
242 | | - |
243 | | - it "sets up public_path (as for a war)" do |
244 | | - @runtime = @rack_factory.getApplication.getRuntime |
245 | | - should_eval_as_eql_to "Rails.public_path", "#{STUB_DIR}/rails32" |
246 | | - # make sure it was set early on (before initializers run) : |
247 | | - should_eval_as_not_nil "defined? Rails32::Application::PUBLIC_PATH" |
248 | | - should_eval_as_eql_to "Rails32::Application::PUBLIC_PATH", "#{STUB_DIR}/rails32" |
249 | | - # check if image_tag resolves path to images correctly : |
250 | | - should_eval_as_eql_to %q{ |
251 | | - config = ActionController::Base.config; |
252 | | - asset_paths = ActionView::Helpers::AssetTagHelper::AssetPaths.new(config); |
253 | | - image_path = asset_paths.compute_public_path('image.jpg', 'images'); |
254 | | - image_path[0, 18] |
255 | | - }, '/images/image.jpg?' |
256 | | - end |
257 | | - |
258 | | - it "disables rack's chunked support (by default)" do |
259 | | - @runtime = @rack_factory.getApplication.getRuntime |
260 | | - expect_to_have_monkey_patched_chunked |
261 | | - end |
262 | | - |
263 | | - end |
264 | | - |
265 | | - end |
266 | | - |
267 | | - describe 'rails 4.0', :lib => :rails40 do |
268 | | - |
269 | | - before(:all) { copy_gemfile("rails40") } |
270 | | - |
271 | | - def base_path; "file://#{STUB_DIR}/rails40" end |
272 | | - |
273 | | - it_should_behave_like 'a rails app' |
274 | | - |
275 | | - context "initialized" do |
276 | | - |
277 | | - before(:all) { initialize_rails 'production', base_path } |
278 | | - after(:all) { restore_rails } |
279 | | - |
280 | | - it "loaded rack ~> 1.5" do |
281 | | - @runtime = @rack_factory.getApplication.getRuntime |
282 | | - should_eval_as_not_nil "defined?(Rack.release)" |
283 | | - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.5' |
284 | | - end |
285 | | - |
286 | | - it "booted with a servlet logger" do |
287 | | - @runtime = @rack_factory.getApplication.getRuntime |
288 | | - should_eval_as_not_nil "defined?(Rails)" |
289 | | - should_eval_as_not_nil "Rails.logger" |
290 | | - # NOTE: TaggedLogging is a module that extends the instance now : |
291 | | - should_eval_as_eql_to "Rails.logger.is_a? ActiveSupport::TaggedLogging", true |
292 | | - should_eval_as_eql_to "Rails.logger.instance_variable_get(:'@logdev').dev.class.name", |
293 | | - 'JRuby::Rack::ServletLog' |
294 | | - should_eval_as_eql_to "Rails.logger.level", Logger::INFO |
295 | | - end |
296 | | - |
297 | | - it "sets up public_path (as for a war)" do |
298 | | - @runtime = @rack_factory.getApplication.getRuntime |
299 | | - should_eval_as_eql_to "Rails.public_path.to_s", "#{STUB_DIR}/rails40" # Pathname |
300 | | - # due config.assets.digest = true and since we're asset pre-compiled : |
301 | | - #should_eval_as_eql_to %q{ |
302 | | - # ActionController::Base.helpers.image_path('image.jpg')[0, 14]; |
303 | | - #}, '/assets/image-' |
304 | | - end |
305 | | - |
306 | | - end |
307 | | - |
308 | | - end |
309 | | - |
310 | | - describe 'rails 4.1', :lib => :rails41 do |
311 | | - |
312 | | - before(:all) do name = :rails41 # copy_gemfile : |
313 | | - FileUtils.cp File.join(GEMFILES_DIR, "#{name}.gemfile"), File.join(STUB_DIR, "#{name}/Gemfile") |
314 | | - FileUtils.cp File.join(GEMFILES_DIR, "#{name}.gemfile.lock"), File.join(STUB_DIR, "#{name}/Gemfile.lock") |
315 | | - Dir.chdir File.join(STUB_DIR, name.to_s) |
316 | | - end |
317 | | - |
318 | | - def prepare_servlet_context(servlet_context) |
319 | | - servlet_context.addInitParameter('rails.root', "#{STUB_DIR}/rails41") |
320 | | - servlet_context.addInitParameter('jruby.rack.layout_class', 'FileSystemLayout') |
321 | | - end |
322 | | - |
323 | | - def base_path; "file://#{STUB_DIR}/rails41" end |
324 | | - # let(:base_path) { "file://#{STUB_DIR}/rails41" } |
325 | | - |
326 | | - it_should_behave_like 'a rails app' |
327 | | - |
328 | | - context "initialized" do |
329 | | - |
330 | | - before(:all) { initialize_rails 'production', base_path } |
331 | | - after(:all) { restore_rails } |
332 | | - |
333 | | - it "loaded rack ~> 1.5" do |
334 | | - @runtime = @rack_factory.getApplication.getRuntime |
335 | | - should_eval_as_not_nil "defined?(Rack.release)" |
336 | | - should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.5' |
337 | | - end |
338 | | - |
339 | | - it "booted with a servlet logger" do |
340 | | - @runtime = @rack_factory.getApplication.getRuntime |
341 | | - should_eval_as_not_nil "defined?(Rails)" |
342 | | - should_eval_as_not_nil "Rails.logger" |
343 | | - # NOTE: TaggedLogging is a module that extends the instance now : |
344 | | - should_eval_as_eql_to "Rails.logger.is_a? ActiveSupport::TaggedLogging", true |
345 | | - should_eval_as_eql_to "Rails.logger.instance_variable_get(:'@logdev').dev.class.name", |
346 | | - 'JRuby::Rack::ServletLog' |
347 | | - should_eval_as_eql_to "Rails.logger.level", Logger::INFO |
348 | | - end |
349 | | - |
350 | | - it "sets up public_path (as for a war)" do |
351 | | - @runtime = @rack_factory.getApplication.getRuntime |
352 | | - should_eval_as_eql_to "Rails.public_path.to_s", "#{STUB_DIR}/rails41/public" |
353 | | - end |
354 | | - |
355 | | - end |
356 | | - |
357 | | - end |
358 | | - |
359 | 122 | def expect_to_have_monkey_patched_chunked |
360 | 123 | @runtime.evalScriptlet "require 'rack/chunked'" |
361 | 124 | script = %{ |
|
0 commit comments