Sha256: 32246018e5340c7a545914028e457760ebe30a7cf5d3f3de0b9b94820af25d72

Contents?: true

Size: 743 Bytes

Versions: 30

Compression:

Stored size: 743 Bytes

Contents

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

shared_context 'rake' do
  let(:rake)      { Rake::Application.new }
  let(:task_name) { self.class.top_level_description }
  let(:task_path) { "lib/tasks/#{task_name.split(':').first}/#{task_name.split(':').last}" }
  let(:root_path) { File.expand_path('../../../..', __FILE__) }
  subject(:task)  { 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, [root_path], loaded_files_excluding_current_rake_file)
    Rake::Task.define_task(:environment)
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
g5_authenticatable-0.9.1.pre.2 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-0.3.0 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.8.1.pre spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-0.2.5.beta spec/support/shared_contexts/rake.rb
g5_authenticatable-0.8.0 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.8.0.beta1 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.7.5 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.7.5.beta spec/support/shared_contexts/rake.rb
g5_authenticatable-0.7.4 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-0.2.4 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.7.4.beta.1 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-0.2.4.beta spec/support/shared_contexts/rake.rb
g5_authenticatable-0.7.3 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-0.2.3 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.7.2 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.7.1 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.7.0 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.6.0 spec/support/shared_contexts/rake.rb
devise_g5_authenticatable-0.2.2 spec/support/shared_contexts/rake.rb
g5_authenticatable-0.5.1 spec/support/shared_contexts/rake.rb