Sha256: 0f50278beb37882073bba3ecd5f1314c4ce50c298a1f11c9133022eadb7e905a

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 KB

Contents

$: << File.expand_path('../../lib', __FILE__)
require 'new'
$: << File.expand_path('../../tasks', __FILE__)
$: << File.expand_path('../fixtures', __FILE__)
$: << File.expand_path('tasks', New::CUSTOM_DIR)

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true
  config.filter_run :focus
  config.order = :random

  config.before do
    New.stub(:say)
    stub_const 'New::DEFAULT_DIR', root('spec', 'fixtures')
    stub_const 'New::CUSTOM_DIR', root('spec', 'fixtures', 'custom')
  end

  config.before :each do
    # Force specs to always lookup new templates and tasks
    New.instance_variables.each{ |v| New.instance_variable_set(v, nil) }
  end
end

def root *paths
  paths.unshift(File.expand_path('../../', __FILE__)).compact.join '/'
end

def require_task task
  require "#{task}/#{task}"
end

def new_task task, options = {}
  task_class = "New::Task::#{task.to_s.classify}".constantize

  task_class.any_instance.stub(:get_part).and_return(:patch)
  task_class.any_instance.stub(:run)

  task_hash = {}
  task_hash[task] = {}
  task_options = {
    tasks: task_hash
  }.merge(options)

  task_class.new task_options
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
new-0.0.14 spec/spec_helper.rb
new-0.0.13 spec/spec_helper.rb
new-0.0.12 spec/spec_helper.rb
new-0.0.11 spec/spec_helper.rb
new-0.0.10 spec/spec_helper.rb
new-0.0.9 spec/spec_helper.rb
new-0.0.8 spec/spec_helper.rb
new-0.0.7 spec/spec_helper.rb