Sha256: 192e0b97dbe22093e900c0abae61518c083a12cafd604c7317578fbe75b76f5c

Contents?: true

Size: 1.19 KB

Versions: 112

Compression:

Stored size: 1.19 KB

Contents

describe 'migrate to pact versions (migrate 22-24)', migration: true do
  before do
    PactBroker::Database.migrate(22)
  end

  let(:now) { DateTime.new(2017, 1, 1) }
  let(:pact_updated_at) { DateTime.new(2017, 1, 2) }
  let!(:consumer) { create(:pacticipants, {name: 'Consumer', created_at: now, updated_at: now}) }
  let!(:provider) { create(:pacticipants, {name: 'Provider', created_at: now, updated_at: now}) }
  let!(:consumer_version) { create(:versions, {number: '1.2.3', order: 1, pacticipant_id: consumer[:id], created_at: now, updated_at: now}) }
  let!(:pact_version_content) { create(:pact_version_contents, {content: {some: 'json'}.to_json, sha: '1234', created_at: now, updated_at: now}, :sha) }
  let!(:pact_1) { create(:pacts, {version_id: consumer_version[:id], provider_id: provider[:id], pact_version_content_sha: '1234', created_at: now, updated_at: pact_updated_at}) }

  let!(:pact_version_content_orphan) { create(:pact_version_contents, {content: {some: 'json'}.to_json, sha: '4567', created_at: now, updated_at: now}, :sha) }

  subject { PactBroker::Database.migrate(34) }

  it "deletes orphan pact_versions" do
    subject
    expect(database[:pact_versions].count).to eq 1
  end
end

Version data entries

112 entries across 112 versions & 1 rubygems

Version Path
pact_broker-2.52.1 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.52.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.51.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.50.1 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.50.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.49.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.48.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.47.1 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.47.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.46.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.45.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.44.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.43.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.42.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.41.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.40.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.39.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.38.1 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.38.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.37.0 spec/migrations/24_populate_pact_contents_spec.rb