Sha256: 670f1724fad71b5f4917fa686f4b1d27c2300f1f5f51c1c5ea6a91cc7c260a1f

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

class SimpleFormWithClientValidationGeneratorTest < Rails::Generators::TestCase
  tests SimpleFormWithClientValidation::Generators::InstallGenerator
  destination File.expand_path('../../tmp', __FILE__)
  setup :prepare_destination
  teardown { rm_rf(destination_root) }

  test 'generates example locale file' do
    run_generator
    assert_file 'config/locales/simple_form.en.yml'
  end

  test 'generates the simple_form initializer' do
    run_generator
    assert_file 'config/initializers/simple_form.rb',
      /config\.default_wrapper = :default/, /config\.boolean_style = :nested/
  end

  test 'generates the simple_form initializer with the bootstrap wrappers' do
    run_generator %w(--bootstrap)
    assert_file 'config/initializers/simple_form.rb', /config\.wrappers :bootstrap/,
      /config\.default_wrapper = :bootstrap/
  end

  %W(erb haml slim).each do |engine|
    test "generates the scaffold template when using #{engine}" do
      run_generator ['-e', engine]
      assert_file "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_form_with_client_validation-0.0.2 test/generators/simple_form_generator_test.rb
simple_form_with_client_validation-0.0.0 test/generators/simple_form_generator_test.rb