Sha256: c953c0ec82e884a141c0df37add43d9bf06f14d18e54a20cd2849d5dfae513f7

Contents?: true

Size: 872 Bytes

Versions: 25

Compression:

Stored size: 872 Bytes

Contents

# frozen_string_literal: true

# Based on: http://robots.thoughtbot.com/test-rake-tasks-like-a-boss
# Modified for a non-Rails environment
require 'rake'

RSpec.shared_context 'rake' do
  let(:rake)      { Rake::Application.new }
  let(:task_name) { self.class.top_level_description }
  let(:task_path) do
    "lib/tasks/#{task_name.split(':').first}/#{task_name.split(':').last}"
  end
  let(:root_path) { File.expand_path('../../../..', __FILE__) }
  subject(:task)  { rake[task_name] }

  def loaded_files_excluding_current_rake_file
    $LOADED_FEATURES.reject { |file| file =~ /#{task_path}\.rake$/ }
  end

  before do
    Rake.application = rake
    Rake.application.rake_require(task_path,
                                  [root_path],
                                  loaded_files_excluding_current_rake_file)
    Rake::Task.define_task(:environment)
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
g5_authenticatable-1.1.4 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-1.0.3 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.4.rc.3 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-1.0.2.rc.3 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.4.rc.2 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-1.0.2.rc.2 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.4.rc.1 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-1.0.2.rc.1 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.2 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.2.pre.1 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.2.rc.5 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-1.0.1.rc.1 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.2.rc.4 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.2.rc.3 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.2.rc.2 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.2.rc.1 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.1 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.1.0 spec/support/shared_contexts/rake.rb
g5_authenticatable-1.0.0 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-1.0.0 spec/support/shared_contexts/rake.rb