Module: RSpec::Rake::ExampleGroup

Defined in:
lib/rspec/rake/example_group.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rspec/rake/example_group.rb', line 7

def self.included(base)
  base.instance_eval do

    [:type] = :task
    [:tasks_path] ||= File.join('../', 'lib', 'tasks')
    [:rakefile] ||= nil

    subject(:task)  { Rake.application[self.class.top_level_description] }

    before(:all) do
       = self.class.
      task_name = self.class.top_level_description

      rakefile = [:rakefile] || task_name.split(':').first
      task_path = File.join([:tasks_path], rakefile)

      Rake.application = Rake::Application.new
      # We are sending an empty list of loaded files
      # in order to force loading of existing files
      Rake.application.rake_require(task_path, $LOAD_PATH, [])
    end
  end

end