Sha256: c9d6fefe0bf518c6d2d0e8f648c883c068999195cadbcc89db81aea1e692f0d4

Contents?: true

Size: 988 Bytes

Versions: 81

Compression:

Stored size: 988 Bytes

Contents

require 'spec_helper'

describe Mongo::Grid::FSBucket::Stream do

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

  describe '.get' do

    let(:stream) do
      described_class.get(fs, mode)
    end

    context 'when mode is read' do

      let(:mode) do
        Mongo::Grid::FSBucket::Stream::READ_MODE
      end

      it 'returns a Stream::Read object' do
        expect(stream).to be_a(Mongo::Grid::FSBucket::Stream::Read)
      end
    end

    context 'when mode is write' do

      let(:mode) do
        Mongo::Grid::FSBucket::Stream::WRITE_MODE
      end

      it 'returns a Stream::Write object' do
        expect(stream).to be_a(Mongo::Grid::FSBucket::Stream::Write)
      end

      context 'when options are provided' do

        let(:stream) do
          described_class.get(fs, mode, chunk_size: 100)
        end

        it 'sets the options on the stream object' do
          expect(stream.options[:chunk_size]).to eq(100)
        end
      end
    end
  end
end

Version data entries

81 entries across 78 versions & 3 rubygems

Version Path
mongo-2.13.3 spec/mongo/grid/stream_spec.rb
mongo-2.14.1 spec/mongo/grid/stream_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongo-2.8.0/spec/mongo/grid/stream_spec.rb
mongo-2.15.0.alpha spec/mongo/grid/stream_spec.rb
mongo-2.13.2 spec/mongo/grid/stream_spec.rb
mongo-2.14.0 spec/mongo/grid/stream_spec.rb
mongo-2.14.0.rc1 spec/mongo/grid/stream_spec.rb
mongo-2.13.1 spec/mongo/grid/stream_spec.rb
mongo-2.12.4 spec/mongo/grid/stream_spec.rb
mongo-2.11.6 spec/mongo/grid/stream_spec.rb
mongo-2.13.0 spec/mongo/grid/stream_spec.rb
mongo-2.12.3 spec/mongo/grid/stream_spec.rb
mongo-2.13.0.rc1 spec/mongo/grid/stream_spec.rb
mongo-2.12.2 spec/mongo/grid/stream_spec.rb
mongo-2.10.5 spec/mongo/grid/stream_spec.rb
mongo-2.11.5 spec/mongo/grid/stream_spec.rb
mongo-2.13.0.beta1 spec/mongo/grid/stream_spec.rb
mongo-2.12.1 spec/mongo/grid/stream_spec.rb
mongo-2.12.0.rc0 spec/mongo/grid/stream_spec.rb
mongo-2.11.4 spec/mongo/grid/stream_spec.rb