sinatra-controllers 0.2.0 → 0.2.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.
- data/Gemfile.lock +1 -1
- data/README.rdoc +1 -1
- data/lib/sinatra-controllers.rb +1 -1
- data/lib/sinatra-controllers/version.rb +1 -1
- data/test/path_defined_test.rb +13 -0
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
data/lib/sinatra-controllers.rb
CHANGED
@@ -29,7 +29,7 @@ module Sinatra
|
|
29
29
|
aklass = klass # need this so it will stay in scope for closure
|
30
30
|
block = proc { aklass.new(params, request).send action }
|
31
31
|
if path[0] != '/'
|
32
|
-
path = '/' + File.join(opts[:scope], path)
|
32
|
+
path = '/' + File.join(opts[:scope] || '', path)
|
33
33
|
end
|
34
34
|
Sinatra::Application.send verb, path, &block
|
35
35
|
end
|
data/test/path_defined_test.rb
CHANGED
@@ -16,6 +16,12 @@ class Seinfeld < Sinatra::Controller
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
class Leader < Sinatra::Controller
|
20
|
+
def omit
|
21
|
+
'slash'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
19
25
|
Sinatra::Controllers.register(Show70, :scope => '/70s_show')
|
20
26
|
# make sure we don't need leading slash
|
21
27
|
Sinatra::Controllers.register(Seinfeld, :scope => 'seinfeld') do
|
@@ -29,6 +35,13 @@ describe "with defined scope" do
|
|
29
35
|
@app.set :environment, :test
|
30
36
|
@app
|
31
37
|
end
|
38
|
+
|
39
|
+
it "should not bail on empty scope without preceding slash" do
|
40
|
+
Sinatra::Controllers.register(Leader) do
|
41
|
+
get 'foo', :omit
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
32
45
|
it "should use correct scope" do
|
33
46
|
get '/70s_show/kelso'
|
34
47
|
last_response.status.must_equal 200
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Bretoi
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-04-
|
17
|
+
date: 2011-04-08 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|