Sha256: 81c02eae4531700e2177d00bc2cc11e8012b15025afb00e3ce6e69d17a824f29

Contents?: true

Size: 1.09 KB

Versions: 14

Compression:

Stored size: 1.09 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
      task.stub(:name).and_return(:foo_task)
    end

    after do
      task.unstub(:name)
    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 be_true
      expect(task.project_options[:tasks].has_key?(:dont_include)).to be_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

14 entries across 14 versions & 1 rubygems

Version Path
new-0.0.14 spec/lib/new/task_spec.rb
new-0.0.13 spec/lib/new/task_spec.rb
new-0.0.12 spec/lib/new/task_spec.rb
new-0.0.11 spec/lib/new/task_spec.rb
new-0.0.10 spec/lib/new/task_spec.rb
new-0.0.9 spec/lib/new/task_spec.rb
new-0.0.8 spec/lib/new/task_spec.rb
new-0.0.7 spec/lib/new/task_spec.rb
new-0.0.6 spec/lib/new/task_spec.rb
new-0.0.5 spec/lib/new/task_spec.rb
new-0.0.4 spec/lib/new/task_spec.rb
new-0.0.3 spec/lib/new/task_spec.rb
new-0.0.2 spec/lib/new/task_spec.rb
new-0.0.0 spec/lib/new/task_spec.rb