Sha256: fe1f679141a3c1fa4fc41190956226fa1f588c56a0d42fba2474299bc2833a54

Contents?: true

Size: 1.33 KB

Versions: 38

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

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

38 entries across 35 versions & 3 rubygems

Version Path
mongo-2.4.0.rc0 spec/mongo/gridfs_spec.rb
mongo-2.3.0 spec/mongo/gridfs_spec.rb
mongo-2.2.7 spec/mongo/gridfs_spec.rb
mongo-2.2.6 spec/mongo/gridfs_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mongo-2.2.5/spec/mongo/gridfs_spec.rb
mongo-2.2.5 spec/mongo/gridfs_spec.rb
mongo-2.2.4 spec/mongo/gridfs_spec.rb
mongo-2.2.3 spec/mongo/gridfs_spec.rb
mongo-2.2.2 spec/mongo/gridfs_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mongo-2.2.1/spec/mongo/gridfs_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/mongo-2.2.1/spec/mongo/gridfs_spec.rb
mongo-2.2.1 spec/mongo/gridfs_spec.rb
mongo-2.2.0 spec/mongo/gridfs_spec.rb
mongo-2.2.0.rc0 spec/mongo/gridfs_spec.rb
mongo-2.1.2 spec/mongo/gridfs_spec.rb
mongo-2.1.1 spec/mongo/gridfs_spec.rb
mongo-2.1.0 spec/mongo/gridfs_spec.rb
mongo-2.1.0.rc0 spec/mongo/gridfs_spec.rb