Sha256: 93e63bb4a58b3ce230b3f9344c0d6dd398243f7b7286270b0bb4b017d9c7ae4e

Contents?: true

Size: 651 Bytes

Versions: 2

Compression:

Stored size: 651 Bytes

Contents

require 'generators/generators_test_helper'
require 'rails/generators/rails/task/task_generator'

class TaskGeneratorTest < Rails::Generators::TestCase
  include GeneratorsTestHelper
  arguments %w(feeds foo bar)

  def test_task_is_created
    run_generator
    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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activejob-lock-0.0.2 rails/railties/test/generators/task_generator_test.rb
activejob-lock-0.0.1 rails/railties/test/generators/task_generator_test.rb