Sha256: efb093fefa3b1c3d298d0c3ac2f99df351bac5e311a8f78880191127ff68128d

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

require "helper"
require "generators/minitest/install/install_generator"

class TestInstallGenerator < GeneratorTest

  def test_install_generator
    assert_output(/create  test\/test_helper.rb/m) do
      Minitest::Generators::InstallGenerator.start
    end
    assert File.exists? "test/test_helper.rb"
    contents = File.read "test/test_helper.rb"
    assert_match(/require "rails\/test_help"/m, contents)
    assert_match(/require "minitest\/rails"/m, contents)
    assert_match(/fixtures :all/m, contents)
    if Rails::VERSION::STRING >= "4.0"
      assert_match(/ActiveRecord::Migration.check_pending\!/m, contents)
    else
      refute_match(/ActiveRecord::Migration.check_pending\!/m, contents)
    end
  end

  def test_install_generator_without_active_record
    assert_output(/create  test\/test_helper.rb/m) do
      Minitest::Generators::InstallGenerator.start ["--skip-active-record"]
    end
    assert File.exists? "test/test_helper.rb"
    contents = File.read "test/test_helper.rb"
    assert_match(/require "rails\/test_help"/m, contents)
    assert_match(/require "minitest\/rails"/m, contents)
    refute_match(/fixtures :all/m, contents)
    refute_match(/ActiveRecord::Migration.check_pending\!/m, contents)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
minitest-rails-2.1.1 test/generators/test_install_generator.rb
minitest-rails-2.1.0 test/generators/test_install_generator.rb
minitest-rails-2.0.3 test/generators/test_install_generator.rb
minitest-rails-2.0.2 test/generators/test_install_generator.rb
minitest-rails-2.0.1 test/generators/test_install_generator.rb
minitest-rails-2.0.0 test/generators/test_install_generator.rb
minitest-rails-2.0.0.beta1 test/generators/test_install_generator.rb