Sha256: d1b9634a9d93b2f5ea6354ce0ca89b82355b11c398c45f4520043007a130eb74

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'
require 'anvil/task_manager'

describe Anvil::TaskManager do
  describe '.all_tasks' do
    it 'returns the Anvil::Task descendants' do
      expect(::Anvil::Task).to receive(:descendants)
      described_class.all_tasks
    end
  end

  describe '.files_from_current_project' do
    let(:gemfile_path) { described_class.current_project_path }
    let(:project_task_path) { gemfile_path + '/lib/anvil/' }

    it 'returns the task files in the path' do
      expect(described_class)
        .to receive(:files_from_path).with(project_task_path)

      described_class.files_from_current_project
    end
  end

  describe '.files_from_gems' do
    it 'asks Gem to return the anvil tasks' do
      expect(Gem).to receive(:find_latest_files).with('anvil/tasks/**/*_task.rb')
      described_class.files_from_gems
    end
  end

  describe '.load_tasks' do
    let(:all_files) { %w[file1 file2] }

    before do
      described_class.stub(:all_files).and_return(all_files)
    end

    it 'loads the files' do
      expect(described_class).to receive(:load).with(all_files[0])
      expect(described_class).to receive(:load).with(all_files[1])

      described_class.load_tasks
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
anvil-core-0.0.1.pre.alpha.3 spec/lib/anvil/task_manager_spec.rb
anvil-core-0.0.1.pre.alpha.2 spec/lib/anvil/task_manager_spec.rb