Sha256: fc3e2319eaeebfd0cf149173b36e95ad691c10ed0d8eda57e4c4c1fd6fb51426

Contents?: true

Size: 1.03 KB

Versions: 41

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'
require 'lib/generators/haml/testing_helper'

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

  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.haml" }
    assert_no_file "app/views/layouts/product_lines.html.haml"
  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.haml"
  end

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

Version data entries

41 entries across 41 versions & 8 rubygems

Version Path
rails3-generators-0.11.0 test/lib/generators/haml/scaffold_generator_test.rb