Sha256: a5175e1d2d09a6eb2a467a09c3da1dc6e3b84bce6679dc51efb88e092dd9612d

Contents?: true

Size: 854 Bytes

Versions: 8

Compression:

Stored size: 854 Bytes

Contents

require "test_helper"
require File.expand_path("../../../lib/generators/active_snapshot/install/install_generator", __dir__)

class InstallGeneratorTest < Rails::Generators::TestCase
  tests ActiveSnapshot::InstallGenerator
  destination File.expand_path("tmp", __dir__)

  setup do
    prepare_destination # cleanup the tmp directory
    run_generator
  end

  teardown do
    ### Disable during debugging
    prepare_destination # cleanup the tmp directory
  end

  def test_should_add_migration
    run_generator

    relative_path = "db/migrate/create_snapshots_tables.rb"

    assert_migration(relative_path) do |content|
      assert_match(/create_table :snapshots/, content)
      assert_match(/create_table :snapshot_items/, content)
    end

    ### Test for syntax errors in file
    require send(:migration_file_name, relative_path)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_snapshot-0.3.0 test/generators/active_snapshot/install_generator_test.rb
active_snapshot-0.2.4 test/generators/active_snapshot/install_generator_test.rb
active_snapshot-0.2.3 test/generators/active_snapshot/install_generator_test.rb
active_snapshot-0.2.2 test/generators/active_snapshot/install_generator_test.rb
active_snapshot-0.2.1 test/generators/active_snapshot/install_generator_test.rb
active_snapshot-0.2.0 test/generators/active_snapshot/install_generator_test.rb
active_snapshot-0.1.1 test/generators/active_snapshot/install_generator_test.rb
active_snapshot-0.1.0 test/generators/active_snapshot/install_generator_test.rb