Sha256: 31ec2f939bcf1eec424439c9b181a0ea534745915e9ba043eb8024df7123c661

Contents?: true

Size: 1.23 KB

Versions: 21

Compression:

Stored size: 1.23 KB

Contents

require 'assert'
require 'ardb/runner/generate_command'

class Ardb::Runner::GenerateCommand

  class BaseTests < Assert::Context
    desc "Ardb::Runner::GenerateCommand"
    setup do
      @cmd = Ardb::Runner::GenerateCommand.new(['something'])
    end
    subject{ @cmd }

    should have_instance_methods :run, :migration_cmd

  end

  class MigrationTests < BaseTests
    desc "Ardb::Runner::GenerateCommand::MigrationCommand"
    setup do
      @cmd = Ardb::Runner::GenerateCommand::MigrationCommand.new('a_migration')
    end

    should have_readers :identifier, :class_name, :file_name, :template

    should "know its given identifier" do
      assert_equal 'a_migration', subject.identifier
    end

    should "know its class name" do
      assert_equal "AMigrations", subject.class_name
    end

    should "know its file name" do
      assert_match /.+_a_migration$/, subject.file_name
    end

    should "know its template" do
      assert_includes "require 'ardb/migration_helpers'", subject.template
      assert_includes "class #{subject.class_name} < ActiveRecord::Migration", subject.template
      assert_includes "include Ardb::MigrationHelpers", subject.template
      assert_includes "def change", subject.template
    end

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

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