public
Description: Merb bundle for TextMate (uses Ruby, Ruby on Rails, Datamapper and Sequel bundles as necessary)
Clone URL: git://github.com/drnic/merb-tmbundle.git
Can navigate to/from unit+functional tests; no spec support yet
drnic (author)
Sun Mar 09 10:29:58 -0700 2008
commit  0336fd35125c466de622c80a5c1c4f84a671cbc3
tree    47de11bbe896bc204d71df1e1e5fd9d4d74b2851
parent  d3c0766ff6665a2cd4c4e13e468b4a7ffc4f704b
...
16
17
18
19
 
20
21
22
...
16
17
18
 
19
20
21
22
0
@@ -16,7 +16,7 @@
0
   <key>output</key>
0
   <string>showAsTooltip</string>
0
   <key>scope</key>
0
- <string>meta.ruby.datamapper.model, meta.ruby.activerecord.model, meta.ruby.sequel.model, text.html.ruby.merb, meta.merb.helper, meta.merb.controller</string>
0
+ <string>source.ruby.datamapper, source.ruby.activerecord, source.ruby.sequel, text.html.ruby.merb</string>
0
   <key>uuid</key>
0
   <string>53ABDC99-0DDD-45D2-B242-42CA8D368B33</string>
0
 </dict>
...
16
17
18
19
 
20
21
22
...
16
17
18
 
19
20
21
22
0
@@ -16,7 +16,7 @@
0
   <key>output</key>
0
   <string>showAsTooltip</string>
0
   <key>scope</key>
0
- <string>meta.ruby.datamapper.model, meta.ruby.activerecord.model, meta.ruby.sequel.model, text.html.ruby.merb, meta.merb.helper</string>
0
+ <string>source.ruby.datamapper, source.ruby.activerecord, source.ruby.sequel, text.html.ruby.merb</string>
0
   <key>uuid</key>
0
   <string>DD3C75D1-04AB-45FE-AACF-205E9E20F805</string>
0
 </dict>
...
16
17
18
19
 
20
21
22
...
16
17
18
 
19
20
21
22
0
@@ -16,7 +16,7 @@
0
   <key>output</key>
0
   <string>showAsTooltip</string>
0
   <key>scope</key>
0
- <string>meta.merb.controller</string>
0
+ <string>source.ruby.datamapper, source.ruby.activerecord, source.ruby.sequel, text.html.ruby.merb</string>
0
   <key>uuid</key>
0
   <string>F18A8064-D29F-4754-8C93-05769CC12F55</string>
0
 </dict>
...
16
17
18
19
 
20
21
22
...
16
17
18
 
19
20
21
22
0
@@ -16,7 +16,7 @@
0
   <key>output</key>
0
   <string>showAsTooltip</string>
0
   <key>scope</key>
0
- <string>meta.merb.controller</string>
0
+ <string>source.ruby.datamapper, source.ruby.activerecord, source.ruby.sequel, text.html.ruby.merb</string>
0
   <key>uuid</key>
0
   <string>B37D079B-8A6A-42AC-B6F8-CB6FF2C87CBD</string>
0
 </dict>
...
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
...
92
93
94
 
 
 
 
 
 
 
 
 
 
95
96
97
0
@@ -92,16 +92,6 @@ class Buffer
0
     find(options) { %r{def\s+(\w+)} }
0
   end
0
 
0
- # Search for the nearest "wants." declaration within a "respond_to" section.
0
- def find_respond_to_format
0
- m = find_method
0
- return nil if m.nil?
0
- from, wants = find(:direction => :backward, :from => m.first) { %r{\brespond_to\s.+\|\s*(\w+)\s*\|} }
0
- return nil if wants.nil?
0
- options = {:direction => lines[from] == current_line ? :forward : :backward, :from => from}
0
- find(options) { Regexp.new(wants + '\.(\w+)') }
0
- end
0
-
0
   def find_nearest_string_or_symbol(current_line = current_line)
0
     current_line.find_nearest_string_or_symbol(column_number)
0
   end
...
7
8
9
10
11
12
13
 
 
 
 
 
 
 
 
 
14
15
16
...
88
89
90
 
 
91
92
93
...
103
104
105
 
 
106
107
108
109
110
111
112
113
114
115
116
117
118
119
...
130
131
132
 
 
 
 
133
134
135
...
176
177
178
 
 
179
180
181
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
 
242
243
244
...
7
8
9
 
 
 
 
10
11
12
13
14
15
16
17
18
19
20
21
...
93
94
95
96
97
98
99
100
...
110
111
112
113
114
115
116
117
118
119
120
 
 
 
 
 
121
122
123
...
134
135
136
137
138
139
140
141
142
143
...
184
185
186
187
188
189
190
191
...
234
235
236
 
237
 
 
 
 
 
 
 
238
239
240
241
242
 
243
244
245
246
0
@@ -7,10 +7,15 @@ require 'fileutils'
0
 
0
 module AssociationMessages
0
   @@associations = {
0
- :controller => [:helper, :model],
0
- :helper => [:controller, :model],
0
- :view => [:controller, :helper, :model],
0
- :model => [:controller, :helper]
0
+ :controller => [:functional_test, :helper, :model, :javascript, :stylesheet, :fixture],
0
+ :helper => [:controller, :model, :unit_test, :functional_test, :javascript, :stylesheet, :fixture],
0
+ :view => [:controller, :javascript, :stylesheet, :helper, :model],
0
+ :model => [:unit_test, :functional_test, :controller, :helper, :fixture],
0
+ :fixture => [:unit_test, :functional_test, :controller, :helper, :model],
0
+ :functional_test => [:controller, :helper, :model, :unit_test, :fixture],
0
+ :unit_test => [:model, :controller, :helper, :functional_test, :fixture],
0
+ :javascript => [:helper, :controller],
0
+ :stylesheet => [:helper, :controller]
0
   }
0
 
0
   # Make associations hash publicly available to each object
0
@@ -88,6 +93,8 @@ class MerbPath
0
     when :controller then name
0
     when :helper then name.sub!(/_helper$/, '')
0
     when :view then name = dirname.split('/').pop
0
+ when :unit_test then name.sub!(/_test$/, '')
0
+ when :functional_test then name.sub!(/_test$/, '')
0
     else
0
       if !File.file?(File.join(merb_root, stubs[:controller], '/', name + '.rb'))
0
         name = Inflector.pluralize(name)
0
@@ -103,17 +110,14 @@ class MerbPath
0
         buffer.find_method(:direction => :backward).last rescue nil
0
       when :view
0
         basename
0
+ when :functional_test
0
+ buffer.find_method(:direction => :backward).last.sub('^test_', '')
0
       else nil
0
       end
0
 
0
     return parse_file_name(name)[:file_name] rescue nil # Remove extension
0
   end
0
   
0
- def respond_to_format
0
- return nil unless file_type == :controller
0
- buffer.find_respond_to_format
0
- end
0
-
0
   def merb_root
0
     TextMate.project_directory
0
   end
0
@@ -130,6 +134,10 @@ class MerbPath
0
       when %r{/helpers/(.+_helper\.rb)$} then :helper
0
       when %r{/views/(.+\.(#{VIEW_EXTENSIONS * '|'}))$} then :view
0
       when %r{/models/(.+\.(rb))$} then :model
0
+ when %r{/test/functional/(.+\.(rb))$} then :functional_test
0
+ when %r{/test/unit/(.+\.(rb))$} then :unit_test
0
+ when %r{/public/javascripts/(.+\.(js))$} then :javascript
0
+ when %r{/public/stylesheets/(?:sass/)?(.+\.(css|sass))$} then :stylesheet
0
       else nil
0
       end
0
     # Store the tail (modules + file) after the regexp
0
@@ -176,6 +184,8 @@ class MerbPath
0
       end
0
     when :helper then controller_name + '_helper'
0
     when :model then Inflector.singularize(controller_name)
0
+ when :functional_test then controller_name + '_test'
0
+ when :unit_test then Inflector.singularize(controller_name) + '_test'
0
     else controller_name
0
     end
0
   end
0
@@ -224,21 +234,13 @@ class MerbPath
0
 
0
   def merb_path_for_view
0
     return nil if action_name.nil?
0
- line, view_format = respond_to_format
0
 
0
- if view_format
0
- VIEW_EXTENSIONS.each do |ext|
0
- filename_with_extension = "#{action_name}.#{view_format}.#{ext}"
0
- existing_view = File.join(merb_root, stubs[:view], modules, controller_name, filename_with_extension)
0
- return MerbPath.new(existing_view) if File.exist?(existing_view)
0
- end
0
- end
0
     VIEW_EXTENSIONS.each do |ext|
0
       filename_with_extension = "#{action_name}.#{ext}"
0
       existing_view = File.join(merb_root, stubs[:view], modules, controller_name, filename_with_extension)
0
       return MerbPath.new(existing_view) if File.exist?(existing_view)
0
     end
0
- default_view = File.join(merb_root, stubs[:view], modules, controller_name, action_name + default_extension_for(:view, view_format))
0
+ default_view = File.join(merb_root, stubs[:view], modules, controller_name, action_name + default_extension_for(:view))
0
     return MerbPath.new(default_view)
0
   end
0
   
...
17
18
19
20
 
21
22
23
24
25
 
26
27
28
29
30
 
31
32
33
34
35
36
37
 
38
39
40
 
41
42
 
43
44
 
45
46
47
...
52
53
54
55
 
56
57
58
...
60
61
62
63
 
64
65
66
...
68
69
70
71
72
73
 
 
 
74
75
76
77
78
 
79
80
81
82
83
 
84
85
86
87
88
89
 
90
91
92
...
97
98
99
100
 
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
160
161
162
163
 
 
164
165
 
166
167
 
168
169
170
171
 
 
 
172
173
 
174
175
176
...
181
182
183
184
 
185
186
187
188
189
 
190
191
192
 
193
194
195
196
197
 
198
199
200
201
 
202
203
204
205
 
206
207
208
209
 
210
211
212
213
 
214
215
216
217
 
218
219
220
221
 
222
223
224
225
 
226
227
228
...
17
18
19
 
20
21
22
23
24
 
25
26
27
28
29
 
30
31
32
33
34
35
36
 
37
38
39
 
40
41
 
42
43
 
44
45
46
47
...
52
53
54
 
55
56
57
58
...
60
61
62
 
63
64
65
66
...
68
69
70
 
 
 
71
72
73
74
75
76
77
 
78
79
80
81
82
 
83
84
85
86
87
88
 
89
90
91
92
...
97
98
99
 
100
101
102
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
 
 
 
160
161
162
 
163
164
 
165
166
 
 
 
167
168
169
170
 
171
172
173
174
...
179
180
181
 
182
183
184
185
186
 
187
188
189
 
190
191
192
193
194
 
195
196
197
198
 
199
200
201
202
 
203
204
205
206
 
207
208
209
210
 
211
212
213
214
 
215
216
217
218
 
219
220
221
222
 
223
224
225
226
0
@@ -17,31 +17,31 @@ class TestMerbPath < Test::Unit::TestCase
0
   def test_merb_root
0
     assert_equal File.expand_path(File.dirname(__FILE__) + '/app_fixtures'), MerbPath.new.merb_root
0
   end
0
-
0
+
0
   def test_extension
0
     assert_equal "rb", @rp_controller.extension
0
     assert_equal "erb", @rp_view.extension
0
   end
0
-
0
+
0
   def test_file_type
0
     assert_equal :controller, @rp_controller.file_type
0
     assert_equal :view, @rp_view.file_type
0
   end
0
-
0
+
0
   def test_modules
0
     assert_equal [], @rp_controller.modules
0
     assert_equal ['admin'], @rp_controller_with_module.modules
0
     assert_equal [], @rp_view.modules
0
     assert_equal ['admin'], @rp_view_with_module.modules
0
   end
0
-
0
+
0
   def test_controller_name
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/models/person.rb')
0
- assert_equal "people", rp.controller_name
0
+ assert_equal "people", rp.controller_name
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/models/user.rb')
0
- assert_equal "users", rp.controller_name
0
+ assert_equal "users", rp.controller_name
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/models/users.rb')
0
- assert_equal "users", rp.controller_name
0
+ assert_equal "users", rp.controller_name
0
   end
0
 
0
   def test_file_parts
0
@@ -52,7 +52,7 @@ class TestMerbPath < Test::Unit::TestCase
0
     assert_equal('new', basename)
0
     assert_equal('html', content_type)
0
     assert_equal('erb', extension)
0
-
0
+
0
     current_file = MerbPath.new(FIXTURE_PATH + '/app/views/user/new.rhtml')
0
     pathname, basename, content_type, extension = current_file.parse_file_parts
0
     assert_equal(FIXTURE_PATH + '/app/views/user', pathname)
0
@@ -60,7 +60,7 @@ class TestMerbPath < Test::Unit::TestCase
0
     assert_equal(nil, content_type)
0
     assert_equal('rhtml', extension)
0
   end
0
-
0
+
0
   def test_new_merb_path_has_parts
0
     current_file = MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb')
0
     assert_equal(FIXTURE_PATH + '/app/views/users/new.html.erb', current_file.filepath)
0
@@ -68,25 +68,25 @@ class TestMerbPath < Test::Unit::TestCase
0
     assert_equal('new', current_file.file_name)
0
     assert_equal('html', current_file.content_type)
0
     assert_equal('erb', current_file.extension)
0
- end
0
-
0
-
0
+ end
0
+
0
+
0
   def test_controller_name_and_action_name_for_controller
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
     assert_equal "users", rp.controller_name
0
     assert_equal nil, rp.action_name
0
-
0
+
0
     TextMate.line_number = '3'
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
     assert_equal "users", rp.controller_name
0
     assert_equal "new", rp.action_name
0
-
0
+
0
     TextMate.line_number = '7'
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
     assert_equal "users", rp.controller_name
0
     assert_equal "create", rp.action_name
0
   end
0
-
0
+
0
   def test_controller_name_and_action_name_for_view
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb')
0
     assert_equal "users", rp.controller_name
0
@@ -97,80 +97,78 @@ class TestMerbPath < Test::Unit::TestCase
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/views/people/new.html.erb')
0
     assert_equal "people", rp.controller_name
0
   end
0
-
0
+
0
   def test_controller_name_suggestion_when_controller_absent
0
     rp = MerbPath.new(FIXTURE_PATH + '/app/views/people/new.html.erb')
0
     assert_equal "people", rp.controller_name
0
- end
0
- #
0
- # def test_merb_path_for
0
- # partners = [
0
- # # Basic tests
0
- # [FIXTURE_PATH + '/app/controllers/users.rb', :helper, FIXTURE_PATH + '/app/helpers/user_helper.rb'],
0
- # [FIXTURE_PATH + '/app/controllers/users.rb', :javascript, FIXTURE_PATH + '/public/javascripts/user.js'],
0
- # [FIXTURE_PATH + '/app/controllers/users.rb', :functional_test, FIXTURE_PATH + '/test/functional/user_controller_test.rb'],
0
- # [FIXTURE_PATH + '/app/helpers/user_helper.rb', :controller, FIXTURE_PATH + '/app/controllers/users_controller.rb'],
0
- # [FIXTURE_PATH + '/app/models/user.rb', :controller, FIXTURE_PATH + '/app/controllers/users_controller.rb'],
0
- # [FIXTURE_PATH + '/app/models/post.rb', :controller, FIXTURE_PATH + '/app/controllers/posts_controller.rb'],
0
- # [FIXTURE_PATH + '/test/fixtures/users.yml', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
- # [FIXTURE_PATH + '/spec/fixtures/users.yml', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
- # [FIXTURE_PATH + '/app/controllers/users.rb', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
- # [FIXTURE_PATH + '/test/fixtures/users.yml', :unit_test, FIXTURE_PATH + '/test/unit/user_test.rb'],
0
- # [FIXTURE_PATH + '/app/models/user.rb', :fixture, FIXTURE_PATH + '/test/fixtures/users.yml'],
0
- # # With modules
0
- # [FIXTURE_PATH + '/app/controllers/admin/base_controller.rb', :helper, FIXTURE_PATH + '/app/helpers/admin/base_helper.rb'],
0
- # [FIXTURE_PATH + '/app/controllers/admin/inside/outside_controller.rb', :javascript, FIXTURE_PATH + '/public/javascripts/admin/inside/outside.js'],
0
- # [FIXTURE_PATH + '/app/controllers/admin/base_controller.rb', :functional_test, FIXTURE_PATH + '/test/functional/admin/base_controller_test.rb'],
0
- # [FIXTURE_PATH + '/app/helpers/admin/base_helper.rb', :controller, FIXTURE_PATH + '/app/controllers/admin/base_controller.rb'],
0
- # ]
0
- # # TODO Add [posts.yml, :model, post.rb]
0
- # for pair in partners
0
- # assert_equal MerbPath.new(pair[2]), MerbPath.new(pair[0]).merb_path_for(pair[1])
0
- # end
0
- #
0
- # # Test controller to view
0
- # ENV['RAILS_VIEW_EXT'] = nil
0
- # TextMate.line_number = '6'
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/user/create.html.erb'), current_file.merb_path_for(:view)
0
- #
0
- # # 2.0 plural controllers
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users_controller.rb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/create.html.erb'), current_file.merb_path_for(:view)
0
- #
0
- # TextMate.line_number = '3'
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/user/new.rhtml'), current_file.merb_path_for(:view)
0
- #
0
- # # 2.0 plural controllers
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users_controller.rb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb'), current_file.merb_path_for(:view)
0
- #
0
- # # Test view to controller
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/views/user/new.html.erb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/controllers/users_controller.rb'), current_file.merb_path_for(:controller)
0
- #
0
- # # 2.0 plural controllers
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/controllers/users_controller.rb'), current_file.merb_path_for(:controller)
0
- #
0
- # end
0
- #
0
+ end
0
+
0
+ def test_merb_path_for
0
+ partners = [
0
+ # Basic tests
0
+ [FIXTURE_PATH + '/app/controllers/users.rb', :helper, FIXTURE_PATH + '/app/helpers/users_helper.rb'],
0
+ [FIXTURE_PATH + '/app/controllers/users.rb', :javascript, FIXTURE_PATH + '/public/javascripts/users.js'],
0
+ [FIXTURE_PATH + '/app/controllers/users.rb', :functional_test, FIXTURE_PATH + '/test/functional/users_test.rb'],
0
+ [FIXTURE_PATH + '/app/helpers/users_helper.rb', :controller, FIXTURE_PATH + '/app/controllers/users.rb'],
0
+ [FIXTURE_PATH + '/app/models/user.rb', :controller, FIXTURE_PATH + '/app/controllers/users.rb'],
0
+ [FIXTURE_PATH + '/app/models/post.rb', :controller, FIXTURE_PATH + '/app/controllers/posts.rb'],
0
+ # [FIXTURE_PATH + '/test/fixtures/users.yml', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
+ # [FIXTURE_PATH + '/spec/fixtures/users.yml', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
+ [FIXTURE_PATH + '/app/controllers/users.rb', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
+ # [FIXTURE_PATH + '/test/fixtures/users.yml', :unit_test, FIXTURE_PATH + '/test/unit/user_test.rb'],
0
+ # [FIXTURE_PATH + '/app/models/user.rb', :fixture, FIXTURE_PATH + '/test/fixtures/users.yml'],
0
+ # With modules
0
+ [FIXTURE_PATH + '/app/controllers/admin/bases.rb', :helper, FIXTURE_PATH + '/app/helpers/admin/bases_helper.rb'],
0
+ [FIXTURE_PATH + '/app/controllers/admin/inside/outside.rb', :javascript, FIXTURE_PATH + '/public/javascripts/admin/inside/outside.js'],
0
+ [FIXTURE_PATH + '/app/controllers/admin/bases.rb', :functional_test, FIXTURE_PATH + '/test/functional/admin/bases_test.rb'],
0
+ [FIXTURE_PATH + '/app/helpers/admin/base_helper.rb', :controller, FIXTURE_PATH + '/app/controllers/admin/bases.rb'],
0
+ ]
0
+ for pair in partners
0
+ assert_equal MerbPath.new(pair[2]), MerbPath.new(pair[0]).merb_path_for(pair[1]), pair.inspect
0
+ end
0
+
0
+ # Test controller to view
0
+ ENV['RAILS_VIEW_EXT'] = nil
0
+ TextMate.line_number = '8'
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/create.html.erb'), current_file.merb_path_for(:view)
0
+
0
+ # 2.0 plural controllers
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/create.html.erb'), current_file.merb_path_for(:view)
0
+
0
+ TextMate.line_number = '3'
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb'), current_file.merb_path_for(:view)
0
+
0
+ # 2.0 plural controllers
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb'), current_file.merb_path_for(:view)
0
+
0
+ # Test view to controller
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/views/user/new.html.erb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb'), current_file.merb_path_for(:controller)
0
+
0
+ # 2.0 plural controllers
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb'), current_file.merb_path_for(:controller)
0
+
0
+ end
0
+
0
   def test_best_match
0
     assert_equal(nil, MerbPath.new(FIXTURE_PATH + '/config/init.rb').best_match)
0
- # assert_equal(:functional_test, MerbPath.new(FIXTURE_PATH + '/app/controllers/posts_controller.rb').best_match)
0
- assert_equal(:helper, MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb').best_match)
0
-
0
+ assert_equal(:functional_test, MerbPath.new(FIXTURE_PATH + '/app/controllers/posts.rb').best_match)
0
+
0
     TextMate.line_number = '3' # new action
0
- assert_equal(:view, MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb').best_match)
0
+ assert_equal(:view, MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb').best_match)
0
     TextMate.line_number = '0'
0
-
0
+
0
     assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb').best_match)
0
- assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/admin/base/action.html.erb').best_match)
0
- assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/notifier/forgot_password.html.erb').best_match)
0
- assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/books/new.haml').best_match)
0
+ assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/admin/base/action.html.erb').best_match)
0
+ assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/notifier/forgot_password.html.erb').best_match)
0
+ assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/books/new.haml').best_match)
0
   end
0
- #
0
+ #
0
   # def test_wants_haml
0
   # begin
0
   # assert_equal false, @rp_view.wants_haml
0
@@ -181,48 +179,48 @@ class TestMerbPath < Test::Unit::TestCase
0
   # TextMate.project_directory = File.expand_path(File.dirname(__FILE__) + '/app_fixtures')
0
   # end
0
   # end
0
- #
0
+ #
0
   # def test_haml
0
   # begin
0
   # haml_fixture_path = File.expand_path(File.dirname(__FILE__) + '/fixtures')
0
   # TextMate.project_directory = haml_fixture_path
0
- #
0
+ #
0
   # assert_equal [], MerbPath.new(haml_fixture_path + '/public/stylesheets/sass/posts.sass').modules
0
   # assert_equal ["admin"], MerbPath.new(haml_fixture_path + '/public/stylesheets/sass/admin/posts.sass').modules
0
- #
0
+ #
0
   # # Going from controller to view
0
   # current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
   # TextMate.line_number = '2'
0
   # assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/new.html.haml'), current_file.merb_path_for(:view)
0
- #
0
+ #
0
   # current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
   # TextMate.line_number = '12'
0
   # assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/index.html.haml'), current_file.merb_path_for(:view)
0
- #
0
+ #
0
   # current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
   # TextMate.line_number = '13'
0
   # assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/index.xml.builder'), current_file.merb_path_for(:view)
0
- #
0
+ #
0
   # current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
   # TextMate.line_number = '14'
0
   # assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/index.js.rjs'), current_file.merb_path_for(:view)
0
- #
0
+ #
0
   # current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
   # TextMate.line_number = '15'
0
   # assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/index.wacky.haml'), current_file.merb_path_for(:view)
0
- #
0
+ #
0
   # # Going from view to controller
0
   # current_file = MerbPath.new(haml_fixture_path + '/app/views/posts/index.html.haml')
0
   # assert_equal MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb'), current_file.merb_path_for(:controller)
0
- #
0
+ #
0
   # # Going from view to stylesheet
0
   # current_file = MerbPath.new(haml_fixture_path + '/app/views/posts/index.html.haml')
0
   # assert_equal MerbPath.new(haml_fixture_path + '/public/stylesheets/sass/posts.sass'), current_file.merb_path_for(:stylesheet)
0
- #
0
+ #
0
   # # Going from stylesheet to helper
0
   # current_file = MerbPath.new(haml_fixture_path + '/public/stylesheets/sass/posts.sass')
0
   # assert_equal MerbPath.new(haml_fixture_path + '/app/helpers/posts_helper.rb'), current_file.merb_path_for(:helper)
0
- #
0
+ #
0
   # ensure
0
   # TextMate.project_directory = File.expand_path(File.dirname(__FILE__) + '/app_fixtures')
0
   # end
...
57
58
59
 
 
60
61
62
...
96
97
98
 
 
99
100
101
...
137
138
139
 
 
140
141
142
...
57
58
59
60
61
62
63
64
...
98
99
100
101
102
103
104
105
...
141
142
143
144
145
146
147
148
0
@@ -57,6 +57,8 @@
0
           <string>DD3C75D1-04AB-45FE-AACF-205E9E20F805</string>
0
           <string>EB1C1497-6B33-42D8-B4A2-88F71C311E12</string>
0
           <string>F18A8064-D29F-4754-8C93-05769CC12F55</string>
0
+ <string>BFB47074-0AF6-4D83-8086-F8BDDCF7121D</string>
0
+ <string>5AE2872F-85B8-4933-B05F-A2FE78E9CEED</string>
0
         </array>
0
         <key>name</key>
0
         <string>Go To</string>
0
@@ -96,6 +98,8 @@
0
       <dict>
0
         <key>items</key>
0
         <array>
0
+ <string>8EB02A1A-B7CC-4BAF-A79F-F8B1E40663AC</string>
0
+ <string>------------------------------------</string>
0
           <string>7C19B450-0784-4CDA-A6CE-63D9EBB3B817</string>
0
           <string>8E5830CE-860E-4195-B908-D83BB9DEBEE4</string>
0
           <string>01C35FB5-E15E-41CB-BBA5-2E78BE0B4868</string>
0
@@ -137,6 +141,8 @@
0
     <string>DD3C75D1-04AB-45FE-AACF-205E9E20F805</string>
0
     <string>EB1C1497-6B33-42D8-B4A2-88F71C311E12</string>
0
     <string>F18A8064-D29F-4754-8C93-05769CC12F55</string>
0
+ <string>BFB47074-0AF6-4D83-8086-F8BDDCF7121D</string>
0
+ <string>5AE2872F-85B8-4933-B05F-A2FE78E9CEED</string>
0
     <string>3CC649D9-F74B-4DE0-BCF4-B88954069DC3</string>
0
     <string>8EB02A1A-B7CC-4BAF-A79F-F8B1E40663AC</string>
0
     <string>C93E4E5F-9507-458F-9716-ED90DA32613E</string>

Comments

    No one has commented yet.