Sha256: 2e63d37d77798874347d2ff3c5024627072fd0f9ac41f78746042cd8e17e304d

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

require 'runners/gridfs'

describe 'GridFS' do
  include Mongo::GridFS

  GRIDFS_TESTS.each do |file|

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

    context(spec.description) do

      spec.tests.each do |test|

        context(test.description) do

          after do
            fs.files_collection.delete_many
            fs.chunks_collection.delete_many
            test.expected_files_collection.delete_many
            test.expected_chunks_collection.delete_many
          end

          let!(:result) do
            test.run(fs)
          end

          let(:fs) do
            authorized_collection.database.fs
          end

          it "raises the correct error", if: test.error? do
            expect(result).to match_error(test.expected_error)
          end

          it 'completes successfully', unless: test.error? do
            expect(result).to completes_successfully(test)
          end

          it 'has the correct documents in the files collection', if: test.assert_data? do
            expect(fs.files_collection).to match_files_collection(test.expected_files_collection)
          end

          it 'has the correct documents in the chunks collection', if: test.assert_data? do
            expect(fs.chunks_collection).to match_chunks_collection(test.expected_chunks_collection)
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mongo-2.13.3 spec/spec_tests/gridfs_spec.rb
mongo-2.14.1 spec/spec_tests/gridfs_spec.rb
mongo-2.15.0.alpha spec/spec_tests/gridfs_spec.rb
mongo-2.13.2 spec/spec_tests/gridfs_spec.rb
mongo-2.14.0 spec/spec_tests/gridfs_spec.rb
mongo-2.14.0.rc1 spec/spec_tests/gridfs_spec.rb
mongo-2.13.1 spec/spec_tests/gridfs_spec.rb
mongo-2.13.0 spec/spec_tests/gridfs_spec.rb
mongo-2.13.0.rc1 spec/spec_tests/gridfs_spec.rb
mongo-2.13.0.beta1 spec/spec_tests/gridfs_spec.rb