aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/rails_resource_generator_test.rb
blob: 1f5bd0ef1e6d5a0c2e3e774d243f49f7a04b47a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'generators/generator_test_helper'

class RailsResourceGeneratorTest < GeneratorTestCase
  def test_resource_generates_resources
    run_generator('resource', %w(Product name:string))

    assert_generated_controller_for :products
    assert_generated_model_for :product
    assert_generated_fixtures_for :products
    assert_generated_functional_test_for :products
    assert_generated_helper_for :products
    assert_generated_helper_test_for :products
    assert_generated_migration :create_products
    assert_added_route_for :products
  end

  def test_resource_skip_migration_skips_migration
    run_generator('resource', %w(Product name:string --skip-migration))

    assert_generated_controller_for :products
    assert_generated_model_for :product
    assert_generated_fixtures_for :products
    assert_generated_functional_test_for :products
    assert_generated_helper_for :products
    assert_generated_helper_test_for :products
    assert_skipped_migration :create_products
    assert_added_route_for :products
  end
end