Sha256: 0c3d9814d21778022b6cabea72b742ae86b57e6cca80280a25ca9bcf00300d9e

Contents?: true

Size: 587 Bytes

Versions: 9

Compression:

Stored size: 587 Bytes

Contents

require 'spec_helper'

module Rmega
  describe Storage do

    describe '#stats' do

      let(:session) { Session.new }

      let(:subject) { Storage.new(session) }

      let(:nodes) do
        [{'s' => 10, 't' => 0}, {'t' => 1}, {'s' => 5, 't' => 0}].map do |data|
          Nodes::Factory.build(session, data)
        end
      end

      before do
        allow(subject).to receive(:nodes).and_return(nodes)
      end

      it 'returns a hash with the number of file nodes and the total size' do
        expect(subject.stats).to eq(files: 2, size: 15)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rmega-0.3.2 spec/rmega/lib/storage_spec.rb
rmega-0.3.1 spec/rmega/lib/storage_spec.rb
rmega-0.2.7 spec/rmega/lib/storage_spec.rb
rmega-0.2.6 spec/rmega/lib/storage_spec.rb
rmega-0.2.5 spec/rmega/lib/storage_spec.rb
rmega-0.2.4 spec/rmega/lib/storage_spec.rb
rmega-0.2.2 spec/rmega/lib/storage_spec.rb
rmega-0.2.1 spec/rmega/lib/storage_spec.rb
rmega-0.2.0 spec/rmega/lib/storage_spec.rb