renee 0.4.0.pre1 → 0.4.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +11 -8
- data/README.md +50 -1
- data/Rakefile +14 -104
- data/config.ru +5 -0
- data/examples/blog/config.ru +1 -0
- data/lib/renee.rb +3 -2
- data/lib/renee/render.rb +1 -1
- data/lib/renee/url_generation.rb +66 -45
- data/lib/renee/version.rb +1 -1
- data/plan.txt +1 -5
- data/renee.gemspec +3 -3
- data/site/public/css/app.css +47 -26
- data/site/views/extending.md +66 -0
- data/site/views/index.md +14 -4
- data/site/views/routing.md +0 -38
- data/site/views/variable-types.md +2 -2
- data/test/{renee/blog_test.rb → blog_test.rb} +0 -0
- data/test/{renee-render/render_test.rb → render_test.rb} +0 -0
- data/test/renee-url-generation/test_helper.rb +1 -1
- data/test/{renee-session/session_test.rb → session_test.rb} +2 -2
- data/test/renee/test_helper.rb b/data/test/test_helper → copy.rb +0 -0
- data/test/test_helper.rb +8 -1
- data/test/{renee-url-generation/url_generation_test.rb → url_generation_test.rb} +2 -2
- metadata +47 -77
- data/Gemfile-renee +0 -8
- data/Gemfile-renee-core +0 -8
- data/Gemfile-renee-render +0 -9
- data/Gemfile-renee-session +0 -9
- data/Gemfile-renee-url-generation +0 -8
- data/README-renee-core.md +0 -242
- data/README-renee-render.md +0 -38
- data/README-renee-session.md +0 -3
- data/README-renee-url-generation.md +0 -3
- data/lib/renee/core.rb +0 -98
- data/lib/renee/core/chaining.rb +0 -66
- data/lib/renee/core/env_accessors.rb +0 -72
- data/lib/renee/core/exceptions.rb +0 -15
- data/lib/renee/core/matcher.rb +0 -61
- data/lib/renee/core/plugins.rb +0 -31
- data/lib/renee/core/rack_interaction.rb +0 -50
- data/lib/renee/core/request_context.rb +0 -56
- data/lib/renee/core/responding.rb +0 -112
- data/lib/renee/core/response.rb +0 -78
- data/lib/renee/core/routing.rb +0 -319
- data/lib/renee/core/transform.rb +0 -18
- data/renee-core.gemspec +0 -26
- data/renee-render.gemspec +0 -30
- data/renee-session.gemspec +0 -28
- data/renee-url-generation.gemspec +0 -24
- data/test.watchr +0 -61
- data/test/renee-core/chaining_test.rb +0 -33
- data/test/renee-core/env_accessors_test.rb +0 -43
- data/test/renee-core/include_test.rb +0 -14
- data/test/renee-core/request_context_test.rb +0 -70
- data/test/renee-core/responding_test.rb +0 -128
- data/test/renee-core/routing_test.rb +0 -443
- data/test/renee-core/test_helper.rb +0 -4
- data/test/renee-core/variable_type_test.rb +0 -57
@@ -1,57 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', __FILE__)
|
2
|
-
|
3
|
-
describe Renee::Core::Matcher do
|
4
|
-
it "should transform variables" do
|
5
|
-
mock_app {
|
6
|
-
var :symbol do |i|
|
7
|
-
halt i.inspect
|
8
|
-
end
|
9
|
-
}.setup {
|
10
|
-
register_variable_type(:symbol, /[a-z_]+/).on_transform{|v| v.to_sym}
|
11
|
-
}
|
12
|
-
get '/test'
|
13
|
-
assert_equal ":test", response.body
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should halt on errors if told to" do
|
17
|
-
mock_app {
|
18
|
-
var :symbol do |i|
|
19
|
-
halt i.inspect
|
20
|
-
end
|
21
|
-
}.setup {
|
22
|
-
register_variable_type(:symbol, /[a-z_]+/).on_transform{|v| v.to_sym}.raise_on_error!
|
23
|
-
}
|
24
|
-
get '/123'
|
25
|
-
assert_equal 400, response.status
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should allow custom error handling behaviour on values that don't match" do
|
29
|
-
mock_app {
|
30
|
-
var :symbol do |i|
|
31
|
-
halt i.inspect
|
32
|
-
end
|
33
|
-
}.setup {
|
34
|
-
register_variable_type(:symbol, /[a-z_]+/).on_transform{|v| v.to_sym}.on_error{|v| halt 500 }
|
35
|
-
}
|
36
|
-
get '/123'
|
37
|
-
assert_equal 500, response.status
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should allow composite variable types" do
|
41
|
-
mock_app {
|
42
|
-
path("plus10").var(:int_or_hex) do |i|
|
43
|
-
halt "plus10: #{i + 10}"
|
44
|
-
end
|
45
|
-
}.setup {
|
46
|
-
register_variable_type(:int, /[0-9]+/).on_transform{|v| Integer(v)}
|
47
|
-
register_variable_type(:hex, /0x[0-9a-f]+/).on_transform{|v| v.to_i(16)}
|
48
|
-
register_variable_type(:int_or_hex, [:hex, :int])
|
49
|
-
}
|
50
|
-
get '/plus10/123'
|
51
|
-
assert_equal 'plus10: 133', response.body
|
52
|
-
get '/plus10/0x7b'
|
53
|
-
assert_equal 'plus10: 133', response.body
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
|