Sha256: afab579fe0ee966f79697484207cd011ce7f11a5ad110262b9c48227e26b6068

Contents?: true

Size: 1.05 KB

Versions: 19

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
require 'rails/generators'
require 'rails/generators/migration'
require 'generators/data_migration/data_migration_generator'

describe DataMigrate::Generators::DataMigrationGenerator do
  let(:subject) { DataMigrate::Generators::DataMigrationGenerator }
  describe :next_migration_number do
    it "next migration" do
      Timecop.freeze("2016-12-03 22:15:26 -0800") do
        expect(ActiveRecord::Base).to receive(:timestamped_migrations) { true }
        expect(subject.next_migration_number(1)).to eq("20161204061526")
      end
    end
  end

  describe :migration_base_class_name do
    let(:subject) { DataMigrate::Generators::DataMigrationGenerator.new(['my_migration']) }
    it "returns the correct base class name" do
      if ActiveRecord.version >= Gem::Version.new('5.0')
        expect(subject.send(:migration_base_class_name)).to eq("ActiveRecord::Migration[#{ActiveRecord::Migration.current_version}]")
      else
        expect(subject.send(:migration_base_class_name)).to eq('ActiveRecord::Migration')
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
data_migrate-6.0.0.beta spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-5.3.2 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-5.3.1 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-5.3.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-5.2.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-5.1.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-5.0.2 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-5.0.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-4.0.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-3.5.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-3.4.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-3.3.1 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-3.3.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-3.2.2 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-3.2.1 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-3.2.0 spec/generators/data_migration/data_migration_generator_spec.rb
data_migrate-3.1.0 spec/generators/data_migration/data_migration_generator_spec.rb
salsify-data_migrate-3.1.0 spec/generators/data_migration/data_migration_generator_spec.rb
salsify-data_migrate-3.0.1 spec/generators/data_migration/data_migration_generator_spec.rb