sinatra_more 0.3.16 → 0.3.18

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.16
1
+ 0.3.18
@@ -11,7 +11,7 @@ module SinatraMore
11
11
  # Used to define the url mapping to the supplied alias
12
12
  # NamedRoute.new(@app, :account).to('/account/path')
13
13
  def to(path)
14
- @app.named_paths[@names.unshift(@app.app_name)] = File.join(@app.uri_root, path)
14
+ @app.named_paths[@names.unshift(@app.app_name)] = path
15
15
  end
16
16
 
17
17
  # Used to define the url mappings for child aliases within a namespace
@@ -9,7 +9,7 @@ module SinatraMore
9
9
  values = route_name.extract_options!
10
10
  mapped_url = self.class.named_paths[route_name] || self.class.named_paths[route_name.dup.unshift(self.class.app_name)]
11
11
  raise SinatraMore::RouteNotFound.new("Route alias #{route_name.inspect} is not mapped to a url") unless mapped_url
12
- result_url = String.new(mapped_url)
12
+ result_url = String.new(File.join(self.class.uri_root, mapped_url))
13
13
  result_url.scan(%r{/?(:\S+?)(?:/|$)}).each do |placeholder|
14
14
  value_key = placeholder[0][1..-1].to_sym
15
15
  result_url.gsub!(Regexp.new(placeholder[0]), values[value_key].to_s)
data/sinatra_more.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra_more}
8
- s.version = "0.3.16"
8
+ s.version = "0.3.18"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Esquenazi"]
@@ -28,12 +28,14 @@ class TestRoutingPlugin < Test::Unit::TestCase
28
28
  demo = app.new
29
29
  demo.class.stubs(:uri_root).returns("/")
30
30
  demo.class.map(:demo).to('/demo')
31
+ assert_equal "/demo", demo.class.named_paths[[:routing_demo, :demo]]
31
32
  assert_equal "/demo", demo.url_for(:demo)
32
33
  end
33
34
  should "support changing uri root with mount" do
34
35
  demo = app.new
35
36
  demo.class.stubs(:uri_root).returns("/blog")
36
37
  demo.class.map(:demo).to('/demo')
38
+ assert_equal "/demo", demo.class.named_paths[[:routing_demo, :demo]]
37
39
  assert_equal "/blog/demo", demo.url_for(:demo)
38
40
  end
39
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra_more
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.16
4
+ version: 0.3.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Esquenazi