Sha256: 0acf58dd01368554a839fd778018ef8845d602da5591195b7a622109745a3ab2

Contents?: true

Size: 1003 Bytes

Versions: 1

Compression:

Stored size: 1003 Bytes

Contents

require 'test_helper'

class Erb::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
  destination File.join(Rails.root)
  tests Rails::Generators::ScaffoldGenerator
  arguments %w(product_line title:string price:integer --template-engine erb)

  setup :prepare_destination
  setup :copy_routes

  test "should invoke template engine" do
    run_generator

    %w(index edit new show _form).each { |view| assert_file "app/views/product_lines/#{view}.html.erb" }
    assert_no_file "app/views/layouts/product_lines.html.erb"
  end

  test "should revoke template engine" do
    run_generator
    run_generator ["product_line"], :behavior => :revoke

    assert_no_file "app/views/product_lines"
    assert_no_file "app/views/layouts/product_lines.html.erb"
  end

  test "should invoke form builder" do
    run_generator %w(product_line title:string price:integer --template-engine erb --form-builder some-form-builder)
    assert_no_file "app/views/product_lines/_form.html.erb"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap-generators-0.0.1 test/lib/generators/erb/scaffold_generator_test.rb