Sha256: ef49d7ec30b251fd0a9c012d7948c76424756a69ac48a388a71f5f7537ebe68a

Contents?: true

Size: 723 Bytes

Versions: 5

Compression:

Stored size: 723 Bytes

Contents

# Adapted from: http://robots.thoughtbot.com/test-rake-tasks-like-a-boss
require "rake"

shared_context "rake" do
  let(:rake)      { Rake::Application.new }
  let(:task_name) { self.class.top_level_description }
  let(:task_path) {
    name = task_name.gsub("bigbluebutton_rails:", "")
    "../../lib/tasks/bigbluebutton_rails/#{name.split(":").first}"
  }
  subject         { rake[task_name] }

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

5 entries across 5 versions & 1 rubygems

Version Path
bigbluebutton_rails-3.0.0 spec/support/shared_contexts/rake.rb
bigbluebutton_rails-2.3.0 spec/support/shared_contexts/rake.rb
bigbluebutton_rails-2.2.0 spec/support/shared_contexts/rake.rb
bigbluebutton_rails-2.1.0 spec/support/shared_contexts/rake.rb
bigbluebutton_rails-2.0.0 spec/support/shared_contexts/rake.rb