Sha256: 4c69b9f65b13fe8d95408d15924e5c4043f9bbf38f68e799bc10f5b2f5664548

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'
require 'lib/generators/slim/testing_helper'

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

  setup :prepare_destination
  setup :copy_routes

  test "should invoke template engine" do
    run_generator

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

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

    assert_no_file File.join "app", "views", "product_lines"
    assert_no_file File.join "app", "views", "layouts", "product_lines.html.slim"
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slim-rails-1.1.1 test/lib/generators/slim/scaffold_generator_test.rb
slim-rails-1.1.0 test/lib/generators/slim/scaffold_generator_test.rb
slim-rails-1.0.3 test/lib/generators/slim/scaffold_generator_test.rb
slim-rails-1.0.2 test/lib/generators/slim/scaffold_generator_test.rb
slim-rails-1.0.1 test/lib/generators/slim/scaffold_generator_test.rb
slim-rails-1.0.0 test/lib/generators/slim/scaffold_generator_test.rb