Sha256: 49499b890e6f50504b365a825d305445175491d5fe06d7dab9afcfd0427a6be0

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper.rb'
require 's3ranger/sync'

include S3Ranger


describe "Local file system IO" do

  it "should list local files" do

    # Given that I have remote source and a local destination with a couple
    # files
    source = "mybucket:path"
    destination = directory "directory2"
    file destination, "file1.txt", "First file"
    file destination, "file2.txt", "Second file"

    # When I create a new local directory based on that path
    local = LocalDirectory.new destination

    # Then I see that the directory nodes contain both their parent paths and
    # their names
    local.list_files.should be_eql [
      Node.new(fixture("directory2"), "file1.txt", 10),
      Node.new(fixture("directory2"), "file2.txt", 11),
    ]

    rm destination
  end

  it "should skip local folders while listing files" do
    # Given that I have remote source and a local destination with files
    source = "mybucket:path"
    destination = directory "directory2"
    file destination, "file1.txt", "First file"
    file destination, "file2.txt", "Second file"

    # And with a sub-directory
    subdir = directory "directory2/subd"
    file subdir, "sub1.txt", "Sub content"

    # When I create a new local directory based on that path
    local = LocalDirectory.new destination

    # Then I see that the directory nodes contain both their parent paths and
    # their names
    local.list_files.should be_eql [
      Node.new(fixture("directory2"), "file1.txt", 10),
      Node.new(fixture("directory2"), "file2.txt", 11),
      Node.new(fixture("directory2"), "subd/sub1.txt", 11),
    ]

    rm destination
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
s3ranger-0.3.0 spec/local_source_spec.rb
s3ranger-0.2.1 spec/local_source_spec.rb
s3ranger-0.2.0 spec/local_source_spec.rb
s3ranger-0.1.0 spec/local_source_spec.rb