sinatra 0.3.3 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sinatra might be problematic. Click here for more details.

Files changed (82) hide show
  1. data/AUTHORS +40 -0
  2. data/CHANGES +189 -0
  3. data/README.rdoc +146 -117
  4. data/Rakefile +33 -10
  5. data/{test → compat}/app_test.rb +11 -10
  6. data/{test → compat}/application_test.rb +10 -5
  7. data/compat/builder_test.rb +101 -0
  8. data/{test → compat}/custom_error_test.rb +0 -0
  9. data/compat/erb_test.rb +136 -0
  10. data/{test → compat}/events_test.rb +16 -3
  11. data/compat/filter_test.rb +30 -0
  12. data/compat/haml_test.rb +233 -0
  13. data/compat/helper.rb +30 -0
  14. data/compat/mapped_error_test.rb +72 -0
  15. data/{test → compat}/pipeline_test.rb +9 -4
  16. data/{test → compat}/public/foo.xml +0 -0
  17. data/compat/sass_test.rb +57 -0
  18. data/{test → compat}/sessions_test.rb +0 -0
  19. data/{test → compat}/streaming_test.rb +4 -1
  20. data/{test → compat}/sym_params_test.rb +0 -0
  21. data/{test → compat}/template_test.rb +0 -0
  22. data/{test → compat}/use_in_file_templates_test.rb +0 -0
  23. data/{test → compat}/views/foo.builder +0 -0
  24. data/{test → compat}/views/foo.erb +0 -0
  25. data/{test → compat}/views/foo.haml +0 -0
  26. data/{test → compat}/views/foo.sass +0 -0
  27. data/{test → compat}/views/foo_layout.erb +0 -0
  28. data/{test → compat}/views/foo_layout.haml +0 -0
  29. data/{test → compat}/views/layout_test/foo.builder +0 -0
  30. data/{test → compat}/views/layout_test/foo.erb +0 -0
  31. data/{test → compat}/views/layout_test/foo.haml +0 -0
  32. data/{test → compat}/views/layout_test/foo.sass +0 -0
  33. data/{test → compat}/views/layout_test/layout.builder +0 -0
  34. data/{test → compat}/views/layout_test/layout.erb +0 -0
  35. data/{test → compat}/views/layout_test/layout.haml +0 -0
  36. data/{test → compat}/views/layout_test/layout.sass +0 -0
  37. data/{test → compat}/views/no_layout/no_layout.builder +0 -0
  38. data/{test → compat}/views/no_layout/no_layout.haml +0 -0
  39. data/lib/sinatra.rb +6 -1484
  40. data/lib/sinatra/base.rb +838 -0
  41. data/lib/sinatra/compat.rb +239 -0
  42. data/{images → lib/sinatra/images}/404.png +0 -0
  43. data/{images → lib/sinatra/images}/500.png +0 -0
  44. data/lib/sinatra/main.rb +48 -0
  45. data/lib/sinatra/test.rb +114 -0
  46. data/lib/sinatra/test/bacon.rb +17 -0
  47. data/lib/sinatra/test/rspec.rb +7 -8
  48. data/lib/sinatra/test/spec.rb +3 -4
  49. data/lib/sinatra/test/unit.rb +3 -5
  50. data/sinatra.gemspec +68 -35
  51. data/test/base_test.rb +68 -0
  52. data/test/builder_test.rb +50 -87
  53. data/test/data/reload_app_file.rb +3 -0
  54. data/test/erb_test.rb +38 -124
  55. data/test/filter_test.rb +27 -22
  56. data/test/haml_test.rb +51 -216
  57. data/test/helper.rb +22 -6
  58. data/test/helpers_test.rb +361 -0
  59. data/test/mapped_error_test.rb +137 -49
  60. data/test/middleware_test.rb +58 -0
  61. data/test/options_test.rb +97 -0
  62. data/test/reload_test.rb +61 -0
  63. data/test/request_test.rb +18 -0
  64. data/test/result_test.rb +88 -0
  65. data/test/routing_test.rb +391 -0
  66. data/test/sass_test.rb +27 -48
  67. data/test/sinatra_test.rb +13 -0
  68. data/test/static_test.rb +57 -0
  69. data/test/templates_test.rb +88 -0
  70. data/test/views/hello.builder +1 -0
  71. data/test/views/hello.erb +1 -0
  72. data/test/views/hello.haml +1 -0
  73. data/test/views/hello.sass +2 -0
  74. data/test/views/hello.test +1 -0
  75. data/test/views/layout2.builder +3 -0
  76. data/test/views/layout2.erb +2 -0
  77. data/test/views/layout2.haml +2 -0
  78. data/test/views/layout2.test +1 -0
  79. metadata +80 -48
  80. data/ChangeLog +0 -96
  81. data/lib/sinatra/test/methods.rb +0 -76
  82. data/test/event_context_test.rb +0 -15
@@ -1,76 +0,0 @@
1
- module Sinatra
2
-
3
- module Test
4
-
5
- module Methods
6
- include Rack::Utils
7
-
8
- ENV_KEY_NAMES = {
9
- :accept => "HTTP_ACCEPT",
10
- :agent => "HTTP_USER_AGENT",
11
- :host => "HTTP_HOST",
12
- :session => "HTTP_COOKIE",
13
- :cookies => "HTTP_COOKIE",
14
- :content_type => "CONTENT_TYPE"
15
- }
16
-
17
- def session(data, key = 'rack.session')
18
- data = data.from_params if data.respond_to?(:from_params)
19
- "#{escape(key)}=#{[Marshal.dump(data)].pack("m*")}"
20
- end
21
-
22
- def normalize_rack_environment(env)
23
- env.inject({}) do |hash,(k,v)|
24
- hash[ENV_KEY_NAMES[k] || k] = v
25
- hash
26
- end
27
- end
28
-
29
- def hash_to_param_string(hash)
30
- hash.map { |pair| pair.map{|v|escape(v)}.join('=') }.join('&')
31
- end
32
-
33
- %w(get head post put delete).each do |verb|
34
- http_method = verb.upcase
35
- define_method("#{verb}_it") do |path, *args|
36
- @request = Rack::MockRequest.new(Sinatra.build_application)
37
- opts, input =
38
- case args.size
39
- when 2 # input, env
40
- input, env = args
41
- [env, input]
42
- when 1 # params
43
- if (data = args.first).kind_of?(Hash)
44
- env = (data.delete(:env) || {})
45
- [env, hash_to_param_string(data)]
46
- else
47
- [{}, data]
48
- end
49
- when 0
50
- [{}, '']
51
- else
52
- raise ArgumentError, "zero, one, or two arguments expected"
53
- end
54
- opts = normalize_rack_environment(opts)
55
- opts[:input] ||= input
56
- @response = @request.request(http_method, path, opts)
57
- end
58
- end
59
-
60
- def follow!
61
- get_it(@response.location)
62
- end
63
-
64
- def method_missing(name, *args)
65
- if @response.respond_to?(name)
66
- @response.send(name, *args)
67
- else
68
- super
69
- end
70
- end
71
-
72
- end
73
-
74
- end
75
-
76
- end
@@ -1,15 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
3
- context "EventContext" do
4
-
5
- specify "DSLified setters" do
6
-
7
- cx = Sinatra::EventContext.new(stub_everything, Rack::Response.new, {})
8
- lambda {
9
- cx.status 404
10
- }.should.not.raise(ArgumentError)
11
-
12
- end
13
-
14
- end
15
-