From 829360115208783d88ba3406536971577f9738bf Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 17 Oct 2017 10:47:10 +1100 Subject: [PATCH] test: updated tests for changing migration strategy --- .../change_migration_strategy/before/Gemfile | 2 +- .../change_migration_strategy_spec.rb | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/db/test/change_migration_strategy/before/Gemfile b/db/test/change_migration_strategy/before/Gemfile index ea8fcbacf..a1e758b44 100644 --- a/db/test/change_migration_strategy/before/Gemfile +++ b/db/test/change_migration_strategy/before/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' gem "rake", "~>12.0" -gem "pact_broker", git: "https://github.com/pact-foundation/pact_broker.git", ref: "a963fce89c44d89d00899956f218a62fa2b786c7" +gem "pact_broker", git: "https://github.com/pact-foundation/pact_broker.git", ref: "8783ef83730969f3fce0034f36c7cf4652dc8733" gem "sqlite3", "~>1.3" gem "pg" diff --git a/spec/migrations/change_migration_strategy_spec.rb b/spec/migrations/change_migration_strategy_spec.rb index accd3d80a..af75ab841 100644 --- a/spec/migrations/change_migration_strategy_spec.rb +++ b/spec/migrations/change_migration_strategy_spec.rb @@ -18,16 +18,16 @@ FileUtils.rm_rf DATABASE_PATH end - it "uses pact_broker v 2.0.5" do + it "uses pact_broker v 2.6.0" do Dir.chdir(TEST_DIR) do Bundler.with_clean_env do `bundle install --gemfile before/Gemfile` - expect(`BUNDLE_GEMFILE=before/Gemfile bundle exec rake pact_broker:version`.strip).to eq '2.0.5' + expect(`BUNDLE_GEMFILE=before/Gemfile bundle exec rake pact_broker:version`.strip).to eq '2.6.0' end end end - it "migrates using integer migrations using pact_broker v2.0.5" do + it "migrates using integer migrations using pact_broker v2.6.0" do Dir.chdir(TEST_DIR) do Bundler.with_clean_env do output = `BUNDLE_GEMFILE=before/Gemfile bundle exec rake pact_broker:db:migrate[35]` @@ -52,20 +52,20 @@ expect(@db.table_exists?(:schema_migrations)).to be false end - it "migrates using timestamp migrations using pact_broker > 2.0.5" do + it "migrates using timestamp migrations using pact_broker > 2.6.0" do Dir.chdir(TEST_DIR) do output = `bundle exec rake pact_broker:db:migrate` puts output output = `bundle exec rake pact_broker:db:version` puts output - expect(output.strip).to eq "36" + expect(output.strip).to eq "47" end end - it "uses the schema_migrations table after v2.0.5" do + it "uses the schema_migrations table after v2.6.0" do expect(@db.table_exists?(:schema_migrations)).to be true migrations_count = Dir.glob("db/migrations/**.*").select{ |f| f =~ /\/\d+/ }.count - expect(migrations_count).to be >= 36 + expect(migrations_count).to be >= 47 expect(@db[:schema_migrations].count).to eq migrations_count expect(@db[:schema_migrations].order(:filename).first[:filename]).to eq '000001_create_pacticipant_table.rb' end @@ -76,11 +76,11 @@ it "allows rollback" do Dir.chdir(TEST_DIR) do - output = `bundle exec rake pact_broker:db:migrate[34]` + output = `bundle exec rake pact_broker:db:migrate[45]` puts output output = `bundle exec rake pact_broker:db:version` puts output - expect(output.strip).to eq "34" + expect(output.strip).to eq "45" end end end