Sha256: 51a4006cd1ed967c2f72664f9e9993db3ee86bf2be69bacf460796cbd3f2b4eb

Contents?: true

Size: 695 Bytes

Versions: 9

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

require "rake"

RSpec.shared_context "rake" do
  let(:rake) { Rake::Application.new }
  let(:task_name) { self.class.description }
  let(:task_path) { "../../lib/tasks/#{task_name.split(":").join("/")}_task" }

  subject { rake[task_name] }

  def loaded_files_excluding_current_rake_file
    $LOADED_FEATURES.reject do |file|
      file == Rails.root.join("#{task_path}.rake").to_s
    end
  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

9 entries across 9 versions & 1 rubygems

Version Path
archangel-0.4.0 lib/archangel/testing_support/shared_contexts/rake.rb
archangel-0.3.0 lib/archangel/testing_support/shared_contexts/rake.rb
archangel-0.0.8 lib/archangel/testing_support/shared_contexts/rake.rb
archangel-0.0.7 lib/archangel/testing_support/shared_contexts/rake.rb
archangel-0.0.6 lib/archangel/testing_support/shared_contexts/rake.rb
archangel-0.0.5 lib/archangel/testing_support/shared_contexts/rake.rb
archangel-0.0.4 lib/archangel/testing_support/shared_contexts/rake.rb
archangel-0.0.3 lib/archangel/testing_support/shared_contexts/rake.rb
archangel-0.0.2 lib/archangel/testing_support/shared_contexts/rake.rb