Skip to content
This repository
Browse code

Added test when task generator called on revoke

  • Loading branch information...
commit d4265021d0ec4becbbf7ae4ee00bb815a05f868a 1 parent 91f53db
Arun Agrawal authored November 23, 2013
14  railties/test/generators/task_generator_test.rb
@@ -7,6 +7,18 @@ class TaskGeneratorTest < Rails::Generators::TestCase
7 7
 
8 8
   def test_task_is_created
9 9
     run_generator
10  
-    assert_file "lib/tasks/feeds.rake", /namespace :feeds/
  10
+    assert_file "lib/tasks/feeds.rake" do |content|
  11
+      assert_match(/namespace :feeds/, content)
  12
+      assert_match(/task foo:/, content)
  13
+      assert_match(/task bar:/, content)
  14
+    end
  15
+  end
  16
+
  17
+  def test_task_on_revoke
  18
+    task_path = 'lib/tasks/feeds.rake'
  19
+    run_generator
  20
+    assert_file task_path
  21
+    run_generator ['feeds'], behavior: :revoke
  22
+    assert_no_file task_path
11 23
   end
12 24
 end

0 notes on commit d426502

Please sign in to comment.
Something went wrong with that request. Please try again.