spec/spec_helper.rb in new-0.0.6 vs spec/spec_helper.rb in new-0.0.7
- old
+ new
@@ -1,8 +1,10 @@
$: << File.expand_path('../../lib', __FILE__)
-$: << File.expand_path('../fixtures', __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
@@ -21,6 +23,25 @@
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