rory 0.3.12 → 0.3.13

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.
@@ -56,6 +56,7 @@ module Rory
56
56
  route.matches_request?(@request)
57
57
  end
58
58
  if mapped_route
59
+ @request.params.delete('_method')
59
60
  @request.params.merge! mapped_route.path_params(@request)
60
61
  end
61
62
  mapped_route
data/lib/rory/route.rb CHANGED
@@ -54,7 +54,7 @@ module Rory
54
54
  private
55
55
 
56
56
  def method_from_request(request)
57
- override_method = request.params.delete('_method')
57
+ override_method = request.params['_method']
58
58
  method = if override_method && ['put', 'patch', 'delete'].include?(override_method.downcase)
59
59
  override_method
60
60
  else
data/lib/rory/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rory
2
- VERSION = '0.3.12'
2
+ VERSION = '0.3.13'
3
3
  end
@@ -1,6 +1,5 @@
1
1
  Fixture::Application.set_routes do
2
2
  match 'foo/:id/bar', :to => 'foo#bar', :methods => [:get, :post]
3
- match '/foo', :to => 'monkeys', :methods => [:delete]
4
3
  match 'this/:path/is/:very_awesome', :to => 'awesome#rad'
5
4
  scope :module => 'goose' do
6
5
  match 'lumpies/:lump', :to => 'lumpies#show', :methods => [:get]
@@ -9,5 +8,6 @@ Fixture::Application.set_routes do
9
8
  match 'rabbits/:chew', :to => 'rabbits#chew', :methods => [:get]
10
9
  end
11
10
  match '/', :to => 'root#vegetable', :methods => [:get]
11
+ match '/', :to => 'root#no_vegetable', :methods => [:delete]
12
12
  match 'for_reals/:parbles', :to => 'for_reals#srsly', :methods => [:get]
13
13
  end
@@ -69,11 +69,11 @@ describe Rory::Application do
69
69
  it "generates a collection of routing objects from route configuration" do
70
70
  expect(Fixture::Application.routes).to eq [
71
71
  Rory::Route.new('foo/:id/bar', :to => 'foo#bar', :methods => [:get, :post]),
72
- Rory::Route.new('foo', :to => 'monkeys', :methods => [:delete]),
73
72
  Rory::Route.new('this/:path/is/:very_awesome', :to => 'awesome#rad'),
74
73
  Rory::Route.new('lumpies/:lump', :to => 'lumpies#show', :methods => [:get], :module => 'goose'),
75
74
  Rory::Route.new('rabbits/:chew', :to => 'rabbits#chew', :methods => [:get], :module => 'goose/wombat'),
76
75
  Rory::Route.new('', :to => 'root#vegetable', :methods => [:get]),
76
+ Rory::Route.new('', :to => 'root#no_vegetable', :methods => [:delete]),
77
77
  Rory::Route.new('for_reals/:parbles', :to => 'for_reals#srsly', :methods => [:get])
78
78
  ]
79
79
  end
@@ -81,13 +81,19 @@ describe Rory::Dispatcher do
81
81
  end
82
82
 
83
83
  it "uses override method from params if exists" do
84
- @request.stub(:path_info => '/foo', :params => { '_method' => 'delete' }, :request_method => 'PUT')
85
- expect(@dispatcher.route).to eq Rory::Route.new('/foo', {
86
- :to => 'monkeys',
84
+ @request.stub(:path_info => '/', :params => { '_method' => 'delete' }, :request_method => 'PUT')
85
+ expect(@dispatcher.route).to eq Rory::Route.new('/', {
86
+ :to => 'root#no_vegetable',
87
87
  :methods => [:delete]
88
88
  })
89
89
  end
90
90
 
91
+ it "deletes override method from params" do
92
+ @request.stub(:path_info => '/', :params => { '_method' => 'delete', 'goats' => 'not_sheep' }, :request_method => 'PUT')
93
+ @dispatcher.route
94
+ expect(@request.params).to eq('goats' => 'not_sheep')
95
+ end
96
+
91
97
  it "works with empty path" do
92
98
  @request.stub(:path_info => '', :request_method => 'GET')
93
99
  expect(@dispatcher.route).to eq Rory::Route.new('/', {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-07 00:00:00.000000000 Z
12
+ date: 2014-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack