Sha256: 42ee424b0c78c8892a040eea069b779d6cdc1c4194cacab5dd166269155e0a76

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe 'Transactions API' do

  TRANSACTIONS_API_TESTS.sort.each do |file|

    spec = Mongo::Transactions::Spec.new(file)

    context(spec.description) do
      spec.tests.each do |test_factory|
        test_instance = test_factory.call

        context(test_instance.description) do
          require_transaction_support

          if spec.min_server_version
            min_server_fcv spec.min_server_version.split('.')[0..1].join('.')
          end

          if test_instance.skip_reason
            before do
              skip test_instance.skip_reason
            end
          end

          let(:test) { test_factory.call }

          before(:each) do
            test.setup_test
          end

          after(:each) do
            test.teardown_test
          end

          let(:results) do
            test.run
          end

          let(:verifier) { Mongo::Transactions::Verifier.new(test) }

          it 'returns the correct result' do
            verifier.verify_operation_result(results[:results])
          end

          it 'has the correct data in the collection', if: test_instance.outcome_collection_data do
            results
            verifier.verify_collection_data(results[:contents])
          end

          if test_instance.expectations
            it 'has the correct number of command_started events' do
              verifier.verify_command_started_event_count(results)
            end

            test_instance.expectations.each_with_index do |expectation, i|
              it "has the correct command_started event #{i}" do
                verifier.verify_command_started_event(results, i)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongo-2.8.0/spec/spec_tests/transactions_api_spec.rb
mongo-2.8.0 spec/spec_tests/transactions_api_spec.rb
mongo-2.7.2 spec/spec_tests/transactions_api_spec.rb
mongo-2.8.0.rc0 spec/spec_tests/transactions_api_spec.rb
mongo-2.7.1 spec/spec_tests/transactions_api_spec.rb