public
Description: Ruby on Rails TextMate bundle [Learn it with PeepCode - http://peepcode.com/products/textmate-for-rails-2]
Homepage: http://groups.google.com/group/rubyonrails-textmate
Clone URL: git://github.com/drnic/ruby-on-rails-tmbundle.git
Click here to lend your support to: ruby-on-rails-tmbundle and make a donation at www.pledgie.com !
Default content when creating new functional or unit tests
lawrencepit (author)
Sun Mar 02 16:52:19 -0800 2008
commit  d8a789b634d37cd319da490151a6088a7176b2f2
tree    25d7ad95dd3cdcb1e088879865c246f0dc5b4e61
parent  c1eb2995526e27d153c1a6f200fc23caecfe97cb
...
25
26
27
28
 
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
46
47
...
25
26
27
 
28
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
0
@@ -25,23 +25,31 @@ elsif rails_path = current_file.rails_path_for(choice.to_sym)
0
   end
0
 
0
   if !rails_path.exists?
0
- if !TextMate.message_ok_cancel("Create missing #{rails_path.basename}?")
0
+ if choice.to_sym != :view && !TextMate.message_ok_cancel("Create missing #{rails_path.basename}?")
0
       TextMate.exit_discard
0
- end
0
- rails_path.touch
0
- if choice.to_sym == :controller
0
- generated_code = <<-RUBY
0
-class #{rails_path.controller_name.camelize}Controller < ApplicationController
0
-end
0
-RUBY
0
- rails_path.append generated_code
0
- elsif choice.to_sym == :helper
0
- generated_code = <<-RUBY
0
-module #{rails_path.controller_name.camelize}Helper
0
-end
0
-RUBY
0
- rails_path.append generated_code
0
- end
0
+ end
0
+ generated_code = case choice.to_sym
0
+ when :controller
0
+ "class #{rails_path.controller_name.camelize}Controller < ApplicationController\nend"
0
+ when :helper
0
+ "module #{rails_path.controller_name.camelize}Helper\nend"
0
+ when :unit_test
0
+ "require File.dirname(__FILE__) + '/../test_helper'
0
+
0
+class #{Inflector.singularize(rails_path.controller_name).camelize}Test < ActiveSupport::TestCase
0
+ # Replace this with your real tests.
0
+ def test_truth
0
+ assert true
0
+ end
0
+end"
0
+ when :functional_test
0
+ "require File.dirname(__FILE__) + '/../test_helper'
0
+
0
+class #{rails_path.controller_name.camelize}ControllerTest < ActionController::TestCase
0
+end"
0
+ end
0
+ rails_path.touch
0
+ rails_path.append generated_code if generated_code
0
     TextMate.refresh_project_drawer
0
   end
0
 

Comments

    No one has commented yet.