actionpack 3.2.9.rc1 → 3.2.9.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

@@ -1,5 +1,20 @@
1
1
  ## Rails 3.2.9 (unreleased) ##
2
2
 
3
+ * Revert the `assert_template` fix to not pass with ever string that matches the template name.
4
+ This added a regression since people were relying on this buggy behavior.
5
+ This will introduce back #3849 but this stable release will be backward compatible.
6
+ Fixes #8068.
7
+
8
+ *Rafael Mendonça França*
9
+
10
+ * Revert the rename of internal variable on ActionController::TemplateAssertions to prevent
11
+ naming collisions. This added a regression related with shoulda-matchers, since it is
12
+ expecting the [instance variable @layouts](https://github.com/thoughtbot/shoulda-matchers/blob/9e1188eea68c47d9a56ce6280e45027da6187ab1/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb#L74).
13
+ This will introduce back #7459 but this stable release will be backward compatible.
14
+ Fixes #8068.
15
+
16
+ *Rafael Mendonça França*
17
+
3
18
  * Accept :remote as symbolic option for `link_to` helper. *Riley Lynch*
4
19
 
5
20
  * Warn when the `:locals` option is passed to `assert_template` outside of a view test case
@@ -14,13 +14,13 @@ module ActionController
14
14
  end
15
15
 
16
16
  def setup_subscriptions
17
- @_partials = Hash.new(0)
18
- @_templates = Hash.new(0)
19
- @_layouts = Hash.new(0)
17
+ @partials = Hash.new(0)
18
+ @templates = Hash.new(0)
19
+ @layouts = Hash.new(0)
20
20
 
21
21
  ActiveSupport::Notifications.subscribe("render_template.action_view") do |name, start, finish, id, payload|
22
22
  path = payload[:layout]
23
- @_layouts[path] += 1
23
+ @layouts[path] += 1
24
24
  end
25
25
 
26
26
  ActiveSupport::Notifications.subscribe("!render_template.action_view") do |name, start, finish, id, payload|
@@ -28,11 +28,11 @@ module ActionController
28
28
  next unless path
29
29
  partial = path =~ /^.*\/_[^\/]*$/
30
30
  if partial
31
- @_partials[path] += 1
32
- @_partials[path.split("/").last] += 1
33
- @_templates[path] += 1
31
+ @partials[path] += 1
32
+ @partials[path.split("/").last] += 1
33
+ @templates[path] += 1
34
34
  else
35
- @_templates[path] += 1
35
+ @templates[path] += 1
36
36
  end
37
37
  end
38
38
  end
@@ -43,9 +43,9 @@ module ActionController
43
43
  end
44
44
 
45
45
  def process(*args)
46
- @_partials = Hash.new(0)
47
- @_templates = Hash.new(0)
48
- @_layouts = Hash.new(0)
46
+ @partials = Hash.new(0)
47
+ @templates = Hash.new(0)
48
+ @layouts = Hash.new(0)
49
49
  super
50
50
  end
51
51
 
@@ -72,39 +72,32 @@ module ActionController
72
72
  validate_request!
73
73
 
74
74
  case options
75
- when NilClass, Regexp, String, Symbol
75
+ when NilClass, String, Symbol
76
76
  options = options.to_s if Symbol === options
77
- rendered = @_templates
77
+ rendered = @templates
78
78
  msg = build_message(message,
79
79
  "expecting <?> but rendering with <?>",
80
80
  options, rendered.keys.join(', '))
81
- matches_template =
82
- case options
83
- when String
84
- rendered.any? do |t, num|
85
- options_splited = options.split(File::SEPARATOR)
86
- t_splited = t.split(File::SEPARATOR)
87
- t_splited.last(options_splited.size) == options_splited
88
- end
89
- when Regexp
81
+ assert_block(msg) do
82
+ if options
90
83
  rendered.any? { |t,num| t.match(options) }
91
- when NilClass
92
- rendered.blank?
84
+ else
85
+ @templates.blank?
93
86
  end
94
- assert matches_template, msg
87
+ end
95
88
  when Hash
96
89
  if expected_layout = options[:layout]
97
90
  msg = build_message(message,
98
91
  "expecting layout <?> but action rendered <?>",
99
- expected_layout, @_layouts.keys)
92
+ expected_layout, @layouts.keys)
100
93
 
101
94
  case expected_layout
102
95
  when String
103
- assert(@_layouts.keys.include?(expected_layout), msg)
96
+ assert(@layouts.keys.include?(expected_layout), msg)
104
97
  when Regexp
105
- assert(@_layouts.keys.any? {|l| l =~ expected_layout }, msg)
98
+ assert(@layouts.keys.any? {|l| l =~ expected_layout }, msg)
106
99
  when nil
107
- assert(@_layouts.empty?, msg)
100
+ assert(@layouts.empty?, msg)
108
101
  end
109
102
  end
110
103
 
@@ -119,7 +112,7 @@ module ActionController
119
112
  warn "the :locals option to #assert_template is only supported in a ActionView::TestCase"
120
113
  end
121
114
  elsif expected_count = options[:count]
122
- actual_count = @_partials[expected_partial]
115
+ actual_count = @partials[expected_partial]
123
116
  msg = build_message(message,
124
117
  "expecting ? to be rendered ? time(s) but rendered ? time(s)",
125
118
  expected_partial, expected_count, actual_count)
@@ -127,11 +120,11 @@ module ActionController
127
120
  else
128
121
  msg = build_message(message,
129
122
  "expecting partial <?> but action rendered <?>",
130
- options[:partial], @_partials.keys)
131
- assert(@_partials.include?(expected_partial), msg)
123
+ options[:partial], @partials.keys)
124
+ assert(@partials.include?(expected_partial), msg)
132
125
  end
133
126
  else
134
- assert @_partials.empty?,
127
+ assert @partials.empty?,
135
128
  "Expected no partials to be rendered"
136
129
  end
137
130
  end
@@ -3,7 +3,7 @@ module ActionPack
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
5
  TINY = 9
6
- PRE = "rc1"
6
+ PRE = "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
@@ -193,16 +193,16 @@ module ActionView
193
193
  @_result
194
194
  @_routes
195
195
  @controller
196
- @_layouts
196
+ @layouts
197
197
  @locals
198
198
  @method_name
199
199
  @output_buffer
200
- @_partials
200
+ @partials
201
201
  @passed
202
202
  @rendered
203
203
  @request
204
204
  @routes
205
- @_templates
205
+ @templates
206
206
  @options
207
207
  @test_passed
208
208
  @view
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.9.rc1
4
+ version: 3.2.9.rc2
5
5
  prerelease: 6
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: 2012-10-29 00:00:00.000000000 Z
12
+ date: 2012-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.9.rc1
21
+ version: 3.2.9.rc2
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.9.rc1
29
+ version: 3.2.9.rc2
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activemodel
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - '='
36
36
  - !ruby/object:Gem::Version
37
- version: 3.2.9.rc1
37
+ version: 3.2.9.rc2
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - '='
44
44
  - !ruby/object:Gem::Version
45
- version: 3.2.9.rc1
45
+ version: 3.2.9.rc2
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rack-cache
48
48
  requirement: !ruby/object:Gem::Requirement