Sha256: bc5b1c4eb9827f4b0b6c8d0e87c612c09b4868c1e19d299e4b060e74ff6ee478
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require 'spec_helper' describe DataMigrate::DataMigrator do let(:subject) { DataMigrate::DataMigrator } let(:db_config) do { adapter: "sqlite3", database: "spec/db/test.db" } end describe :assure_data_schema_table do before do allow(subject).to receive(:db_config) { db_config }.at_least(:once) ActiveRecord::Base.establish_connection(db_config) end after do ActiveRecord::Migration.drop_table("data_migrations") end it do expect( ActiveRecord::Base.connection.table_exists?("data_migrations") ).to eq false subject.assure_data_schema_table expect( ActiveRecord::Base.connection.table_exists?("data_migrations") ).to eq true end end describe :match do context "when the file does not match" do it "returns nil" do expect(subject.match("not_a_data_migration_file")).to be_nil end end context "when the file matches" do it "returns a valid MatchData object" do match_data = subject.match("20091231235959_some_name.rb") expect(match_data[0]).to eq "20091231235959_some_name.rb" expect(match_data[1]).to eq "20091231235959" expect(match_data[2]).to eq "some_name" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
data_migrate-4.0.0 | spec/data_migrate/data_migrator_spec.rb |