File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
* Enhancements
6
6
* Eliminate deprecation warnings in generated view specs in Rails 3.2
7
+ * Ensure namespaced helpers are included automatically (Evgeniy Dolzhenko)
7
8
8
9
### 2.8.0.rc2 / 2011-12-19
9
10
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module ViewExampleGroup
10
10
11
11
module ClassMethods
12
12
def _default_helper
13
- base = metadata [ :example_group ] [ :description ] . split ( '/' ) . first
13
+ base = metadata [ :example_group ] [ :description ] . split ( '/' ) [ 0 ..- 2 ] . join ( '/' )
14
14
( base . camelize + 'Helper' ) . constantize if base
15
15
rescue NameError
16
16
nil
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ module RSpec::Rails
14
14
15
15
describe 'automatic inclusion of helpers' do
16
16
module ::ThingsHelper ; end
17
+ module ::Namespaced ; module ThingsHelper ; end ; end
17
18
18
19
it 'includes the helper with the same name' do
19
20
group = RSpec ::Core ::ExampleGroup . describe 'things/show.html.erb'
@@ -23,6 +24,14 @@ module ::ThingsHelper; end
23
24
end
24
25
end
25
26
27
+ it 'includes the namespaced helper with the same name' do
28
+ group = RSpec ::Core ::ExampleGroup . describe 'namespaced/things/show.html.erb'
29
+ group . should_receive ( :helper ) . with ( Namespaced ::ThingsHelper )
30
+ group . class_eval do
31
+ include ViewExampleGroup
32
+ end
33
+ end
34
+
26
35
it 'operates normally when no helper with the same name exists' do
27
36
raise 'unexpected constant found' if Object . const_defined? ( 'ClocksHelper' )
28
37
lambda {
You can’t perform that action at this time.
0 commit comments