Sha256: 74762f3ea43377ff0d81209a49e57e2ada85cd8e9fffd4d2dd4f7d7a27905c98

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require 'test_helper'
require 'rails/generators/rails/scaffold/scaffold_generator'
require 'generators/haml/scaffold/scaffold_generator'

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

3 entries across 2 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/haml-rails-2.1.0/test/lib/generators/haml/scaffold_generator_test.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/haml-rails-2.1.0/test/lib/generators/haml/scaffold_generator_test.rb
haml-rails-2.1.0 test/lib/generators/haml/scaffold_generator_test.rb