Sha256: 2b919b245d7be8f87ed66fd9107fcae14aa8dd2c10ca9859db5b0c0015e2d7b9

Contents?: true

Size: 1.36 KB

Versions: 21

Compression:

Stored size: 1.36 KB

Contents

require 'assert'
require 'ardb/runner/migrate_command'

class Ardb::Runner::MigrateCommand

  class BaseTests < Assert::Context
    desc "Ardb::Runner::MigrateCommand"
    setup do
      @cmd = Ardb::Runner::MigrateCommand.new
    end
    subject{ @cmd }

    should have_readers :migrations_path, :schema_file_path, :version, :verbose

    should "use the config's migrations and schema file paths" do
      assert_equal Ardb.config.migrations_path, subject.migrations_path
      assert_equal Ardb.config.schema_path, subject.schema_file_path
    end

    should "not target a specific version by default" do
      assert_nil subject.version
    end

    should "be verbose by default" do
      assert subject.verbose
    end

  end

  class VersionTests < BaseTests
    desc "with a version ENV setting"
    setup do
      ENV["VERSION"] = '12345'
      @cmd = Ardb::Runner::MigrateCommand.new
    end
    teardown do
      ENV["VERSION"] = nil
    end

    should "should target the given version" do
      assert_equal 12345, subject.version
    end

  end

  class VerboseTests < BaseTests
    desc "with a verbose ENV setting"
    setup do
      ENV["VERBOSE"] = 'no'
      @cmd = Ardb::Runner::MigrateCommand.new
    end
    teardown do
      ENV["VERBOSE"] = nil
    end

    should "turn off verbose mode if not set to 'true'" do
      assert_not subject.verbose
    end

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ardb-0.20.0 test/unit/runner/migrate_command_tests.rb
ardb-0.19.0 test/unit/runner/migrate_command_tests.rb
ardb-0.18.0 test/unit/runner/migrate_command_tests.rb
ardb-0.17.0 test/unit/runner/migrate_command_tests.rb
ardb-0.16.0 test/unit/runner/migrate_command_tests.rb
ardb-0.15.0 test/unit/runner/migrate_command_tests.rb
ardb-0.14.0 test/unit/runner/migrate_command_tests.rb
ardb-0.13.0 test/unit/runner/migrate_command_tests.rb
ardb-0.12.0 test/unit/runner/migrate_command_tests.rb
ardb-0.11.0 test/unit/runner/migrate_command_tests.rb
ardb-0.10.0 test/unit/runner/migrate_command_tests.rb
ardb-0.9.0 test/unit/runner/migrate_command_tests.rb
ardb-0.8.0 test/unit/runner/migrate_command_tests.rb
ardb-0.7.0 test/unit/runner/migrate_command_tests.rb
ardb-0.6.0 test/unit/runner/migrate_command_tests.rb
ardb-0.5.0 test/unit/runner/migrate_command_tests.rb
ardb-0.4.1 test/unit/runner/migrate_command_tests.rb
ardb-0.4.0 test/unit/runner/migrate_command_tests.rb
ardb-0.3.0 test/unit/runner/migrate_command_tests.rb
ardb-0.2.0 test/unit/runner/migrate_command_tests.rb