inherited_resources 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -136,17 +136,14 @@ module ActionController #:nodoc:
136
136
  def negotiate_mime
137
137
  @mime_type_priority.each do |priority|
138
138
  if priority == Mime::ALL
139
- return @order.first
139
+ return @order.find { |m| m != Mime::ALL } || Mime::SET.first
140
+ elsif @order.include?(Mime::ALL)
141
+ return @mime_type_priority.find { |m| m != Mime::ALL } || Mime::SET.first
140
142
  elsif @order.include?(priority)
141
143
  return priority
142
144
  end
143
145
  end
144
146
 
145
- if @order.include?(Mime::ALL)
146
- return Mime::SET.first if @mime_type_priority.first == Mime::ALL
147
- return @mime_type_priority.first
148
- end
149
-
150
147
  nil
151
148
  end
152
149
  end
@@ -1,3 +1,3 @@
1
1
  module InheritedResources
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.freeze
3
3
  end
@@ -55,6 +55,15 @@ end
55
55
  class SuperProjectsController < ProjectsController
56
56
  end
57
57
 
58
+ class NonInheritedResourcesController < ActionController::Base
59
+ def index
60
+ respond_to do |format|
61
+ format.xml { render :text => 'Render XML' }
62
+ format.any { render :text => 'Render HTML' }
63
+ end
64
+ end
65
+ end
66
+
58
67
  class RespondToFunctionalTest < ActionController::TestCase
59
68
  tests ProjectsController
60
69
 
@@ -153,3 +162,13 @@ class RespondToFunctionalTest < ActionController::TestCase
153
162
  assert_equal 'Render HTML', @response.body.strip
154
163
  end
155
164
  end
165
+
166
+ class RespondToFunctionalStandardControllerTest < ActionController::TestCase
167
+ tests NonInheritedResourcesController
168
+
169
+ def test_respond_with_no_specific_format
170
+ @request.accept = 'application/xml,application/xhtml+xml,text/html'
171
+ get :index
172
+ assert_equal 'Render HTML', @response.body.strip
173
+ end
174
+ end
data/test/test_helper.rb CHANGED
@@ -17,6 +17,8 @@ require 'mocha'
17
17
  ENV["RAILS_ENV"] = "test"
18
18
  RAILS_ROOT = "anywhere"
19
19
 
20
+ gem 'responders', '~> 0.4.0'
21
+
20
22
  gem 'activesupport', '= 2.3.5'
21
23
  require 'active_support'
22
24
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inherited_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 5
9
+ version: 1.0.5
5
10
  platform: ruby
6
11
  authors:
7
12
  - "Jos\xC3\xA9 Valim"
@@ -9,29 +14,37 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-20 00:00:00 +01:00
17
+ date: 2010-03-16 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: responders
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ~>
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 4
30
+ - 3
23
31
  version: 0.4.3
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: has_scope
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ~>
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 4
44
+ - 2
33
45
  version: 0.4.2
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  description: Inherited Resources speeds up development by making your controllers inherit all restful actions so you just have to focus on what is important.
36
49
  email: jose.valim@gmail.com
37
50
  executables: []
@@ -75,18 +88,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
88
  requirements:
76
89
  - - ">="
77
90
  - !ruby/object:Gem::Version
91
+ segments:
92
+ - 0
78
93
  version: "0"
79
- version:
80
94
  required_rubygems_version: !ruby/object:Gem::Requirement
81
95
  requirements:
82
96
  - - ">="
83
97
  - !ruby/object:Gem::Version
98
+ segments:
99
+ - 0
84
100
  version: "0"
85
- version:
86
101
  requirements: []
87
102
 
88
103
  rubyforge_project: inherited_resources
89
- rubygems_version: 1.3.5
104
+ rubygems_version: 1.3.6
90
105
  signing_key:
91
106
  specification_version: 3
92
107
  summary: Inherited Resources speeds up development by making your controllers inherit all restful actions so you just have to focus on what is important.