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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sinatra-controllers (0.2.0)
4
+ sinatra-controllers (0.2.1)
5
5
  sinatra (>= 1.0.0)
6
6
 
7
7
  GEM
@@ -1,4 +1,4 @@
1
- = Sinatra-controller
1
+ = Sinatra-controllers
2
2
 
3
3
  Sinatra routing done differently. Allows for clean organization across
4
4
  multiple sinatra routes files.
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Controllers
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -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
- - 0
9
- version: 0.2.0
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-07 00:00:00 -07:00
17
+ date: 2011-04-08 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency