Added test when task generator called on revoke

This commit is contained in:
Arun Agrawal 2013-11-23 16:48:19 +01:00
parent 91f53dbd7a
commit d4265021d0
1 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,18 @@ class TaskGeneratorTest < Rails::Generators::TestCase
def test_task_is_created
run_generator
assert_file "lib/tasks/feeds.rake", /namespace :feeds/
assert_file "lib/tasks/feeds.rake" do |content|
assert_match(/namespace :feeds/, content)
assert_match(/task foo:/, content)
assert_match(/task bar:/, content)
end
end
def test_task_on_revoke
task_path = 'lib/tasks/feeds.rake'
run_generator
assert_file task_path
run_generator ['feeds'], behavior: :revoke
assert_no_file task_path
end
end