Sha256: b0ac8cc048ed0ecd6d528eb426992a6ceff32564318f18d5dde781fe85981c17

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
require 'yaml'

class New::Task::TaskSpec < New::Task
  OPTIONS = {
    default: true
  }
  def run; end
end

describe New::Task do
  let(:task){ New::Task::TaskSpec.new YAML.load(File.open(root('spec', 'fixtures', 'project', '.new'))).deep_symbolize_keys! }

  describe '.inherited' do
    it 'should create a name from the class name' do
      expect(task.class.name).to eq :task_spec
    end
  end

  describe 'instances' do
    before do
      allow(task).to receive(:name).and_return(:foo_task)
    end

    after do
      allow(task).to receive(:name).and_call_original
    end

    it 'should not merge other tasks in' do
      # make sure the custom config has the extra task, and make sure it doesnt come through to the task
      expect(YAML.load(File.open(root('spec', 'fixtures', 'custom', New::CONFIG_FILE))).deep_symbolize_keys![:tasks].has_key?(:dont_include)).to eq true
      expect(task.project_options[:tasks].has_key?(:dont_include)).to eq false
    end

    it 'should get the correct task options' do
      expect(task.options).to eq({ foo: 'project', project: true, custom: true, default: true })
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
new-0.1.1 spec/lib/new/task_spec.rb
new-0.0.15 spec/lib/new/task_spec.rb