Sha256: 6b0397bf202f5797815a8f4165d07b12ee6d4834965ace46ba48b13c13b21f1b

Contents?: true

Size: 1.71 KB

Versions: 6

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

module RevealCK
  module Builders
    describe CopyFilesTask do
      let :source_dir do
        'source'
      end

      let :file_a_source do
        "#{source_dir}/file_a"
      end

      let :file_b_source do
        "#{source_dir}/file_b"
      end

      let :file_listing do
        file_listing = double

        allow(file_listing)
          .to receive(:files)
          .and_return([file_a_source, file_b_source])

        allow(file_listing)
          .to receive(:dir)
          .and_return(source_dir)

        file_listing
      end

      let :destination_directory do
        'destination'
      end

      let :file_a_destination do
        "#{destination_directory}/file_a"
      end

      let :file_b_destination do
        "#{destination_directory}/file_b"
      end

      it 'creates the directory from the file_listing' do

        task = CopyFilesTask.new(application: Rake::Application.new,
                                 file_listing: file_listing,
                                 output_dir: destination_directory)
        expect(task)
          .to receive(:create_directory)
          .with(destination_directory)
          .at_least(:once)

        task.prepare
      end

      it 'creates the files from the file_listing' do
        task = CopyFilesTask.new(application: Rake::Application.new,
                                 file_listing: file_listing,
                                 output_dir: destination_directory)

        expect(task)
          .to receive(:copy_file)
          .with(file_a_source, file_a_destination)

        expect(task)
          .to receive(:copy_file)
          .with(file_b_source, file_b_destination)

        task.prepare
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reveal-ck-0.6.0 spec/lib/reveal-ck/builders/copy_files_task_spec.rb
reveal-ck-0.5.1 spec/lib/reveal-ck/builders/copy_files_task_spec.rb
reveal-ck-0.5.0 spec/lib/reveal-ck/builders/copy_files_task_spec.rb
reveal-ck-0.4.2 spec/lib/reveal-ck/builders/copy_files_task_spec.rb
reveal-ck-0.4.1 spec/lib/reveal-ck/builders/copy_files_task_spec.rb
reveal-ck-0.4.0 spec/lib/reveal-ck/builders/copy_files_task_spec.rb