Sha256: dd285b8cfb161c333dd7670db96d66b8e5576e3a4ee4740961025cf98aa32d1b

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 Bytes

Contents

require "rake"

# Hat tip: http://robots.thoughtbot.com/test-rake-tasks-like-a-boss
shared_context "rake" do
  let(:rake)      { Rake::Application.new }
  let(:task_name) { self.class.top_level_description }
  let(:task_path) { File.join(File.dirname(__FILE__), "../../../lib/tasks/#{task_name.split(":").first}") }
  subject         { rake[task_name] }

  def loaded_files_excluding_current_rake_file
    $".reject { |file| file == "#{task_path}.rake" }
  end

  before do
    Rake.application = rake
    Rake.application.rake_require(task_path, [Rails.root.to_s], loaded_files_excluding_current_rake_file)

    Rake::Task.define_task(:environment)
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
detour-0.0.1 spec/support/shared_contexts/rake.rb
active_record_rollout-0.0.1 spec/support/shared_contexts/rake.rb