public
Fork of vigetlabs/helper_me_test
Description: Providing quick and easy ways to create and write tests for your Rails helpers.
Clone URL: git://github.com/brianjlandau/helper_me_test.git
Add tests for --skip-method-tests option
brianjlandau (author)
Thu Jul 03 13:13:49 -0700 2008
commit  3e1c54dd6cb1a994fa21127b759c90cd04821c88
tree    ca8aa2a74c8d2cbe67bbd9b1ff8c5066d85a7dfe
parent  74fd2d39b846795cc15721052f779d450e440a8d
...
166
167
168
 
 
 
 
 
 
169
...
166
167
168
169
170
171
172
173
174
175
0
@@ -166,4 +166,10 @@ class GeneratorTestCase < ActiveSupport::TestCase
0
     end
0
   end
0
   
0
+ def assert_has_no_method(body, *methods)
0
+ methods.each do |name|
0
+ assert body !~ /^\s*def #{name}(\(.+\))?\n((\n| .*\n)*) end/, "should have method #{name}"
0
+ end
0
+ end
0
+
0
 end
...
46
47
48
 
 
 
 
 
 
 
 
 
 
 
 
49
50
51
...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
0
@@ -46,6 +46,18 @@ class HelperTestsGeneratorTest < GeneratorTestCase
0
     end
0
   end
0
   
0
+ context 'using generator with skip-method-tests option' do
0
+ setup do
0
+ run_generator('helper_tests', %w(--skip-method-tests BlogHelper))
0
+ end
0
+
0
+ should 'create just one helper test' do
0
+ assert_generated_class 'test/helpers/blog_helper_test', 'ActionView::TestCase' do |file|
0
+ assert_has_no_method file, :test_post_formater, :test_date_formater
0
+ end
0
+ end
0
+ end
0
+
0
   context 'using generator with a namespaced module parameter' do
0
     setup do
0
       run_generator('helper_tests', %w(Admin::PostHelper))

Comments

    No one has commented yet.