Sha256: c0ff3f1e827ed1c6aeae10fac9d38c38d6174771282494e79ab76c53ec308adc

Contents?: true

Size: 942 Bytes

Versions: 4

Compression:

Stored size: 942 Bytes

Contents

require 'integration_spec_helper'

describe 'Folders operations' do

  if account_file_exists?

    before(:all) do
      @name = "test_folder_#{rand.denominator}_#{rand.denominator}"
      @storage = login
    end

    def find_folder
      @storage.root.folders.find { |f| f.name == @name }
    end

    context 'when #create_folder is called on a node' do

      it 'creates a new folder under that node' do
        folder = @storage.root.create_folder(@name)
        expect(folder.name).to eql @name
      end
    end

    context 'searching for a folder by its name' do

      it 'returns the matching folder' do
        expect(find_folder.name).to eql @name
      end
    end

    context 'when #delete is called on a folder node' do

      it 'deletes the folder' do
        expect(find_folder.delete).to eql 0
      end

      it 'does not find the folder anymore' do
        expect(find_folder).to be_nil
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rmega-0.1.3 spec/integration/folder_operations_spec.rb
rmega-0.1.2 spec/integration/folder_operations_spec.rb
rmega-0.1.1 spec/integration/folder_operations_spec.rb
rmega-0.1.0 spec/integration/folder_operations_spec.rb