Sha256: 8833b69c1a2a0a718968747a8012da869316d2c3f86d9b7a6359fa4c5ea5bf17

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe Buildbox::Artifact do
  let(:directory) { File.join(FIXTURES_PATH, "artifact-globber") }

  def test_for_files(files, expected)
    expected.each do |path|
      expect(files.keys).to include(path)
      expect(File.exist?(files[path])).to be_true
    end
  end

  describe "#files_to_upload" do
    it "handles specific files" do
      files = Buildbox::Artifact.files_to_upload(directory, "foo.txt")

      expect(files.length).to eql(1)
      test_for_files(files, %w(/foo.txt))
    end

    it "handles globs" do
      files = Buildbox::Artifact.files_to_upload(directory, "bar/**/*.txt")

      expect(files.length).to eql(4)
      test_for_files(files, %w(/bar/bang.txt /bar/bang1.txt /bar/bang2.txt /bar/inside-bar/bang3.txt))
    end

    it "handles absolute globs" do
      files = Buildbox::Artifact.files_to_upload(directory, File.join(File.expand_path(directory), "**/*.txt"))

      expect(files.length).to eql(5)
      test_for_files(files, %w(/foo.txt /bar/bang.txt /bar/bang1.txt /bar/bang2.txt /bar/inside-bar/bang3.txt))
    end

    it "handles specifying everything under a folder" do
      files = Buildbox::Artifact.files_to_upload(directory, "coverage/**/*")

      expect(files.length).to eql(25)
      test_for_files(files, %w(/coverage/index.html /coverage/assets/0.8.0/application.js))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
buildbox-0.6.beta2 spec/buildbox/buildbox/artifact_spec.rb
buildbox-0.6.beta1 spec/buildbox/buildbox/artifact_spec.rb