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.11.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.10.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.9.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.9.0.beta.5 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.8.0.beta.5 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.8.0.beta.4 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.7.0.beta.3 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.7.0.beta.2 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.7.0.beta.1 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.6.0 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.5.1 spec/migrations/24_populate_pact_contents_spec.rb
pact_broker-2.5.0 spec/migrations/24_populate_pact_contents_spec.rb