Class: Taza::Rake::Tasks

Inherits:
Object show all
Defined in:
lib/taza/tasks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Tasks

Returns a new instance of Tasks.

Yields:

  • (_self)

Yield Parameters:



15
16
17
18
# File 'lib/taza/tasks.rb', line 15

def initialize
  yield self if block_given?
  define
end

Instance Attribute Details

#spec_optsObject

Returns the value of attribute spec_opts.



13
14
15
# File 'lib/taza/tasks.rb', line 13

def spec_opts
  @spec_opts
end

Instance Method Details

#defineObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/taza/tasks.rb', line 27

def define
  namespace :spec do
    desc "Run all functional specs"
    define_spec_task(:functional,'spec/functional/**/*_spec.rb')
    desc "Run all integration specs"
    define_spec_task(:integration,'spec/integration/**/*_spec.rb')

    namespace :functional do
      Dir.glob('./spec/functional/*/').each do |dir|
        site_name = File.basename(dir)
        desc "Run all functional specs for #{site_name}"
        define_spec_task(site_name,"#{dir}**/*_spec.rb")

        namespace site_name do
          Dir.glob("./spec/functional/#{site_name}/*_spec.rb").each do |page_spec_file|
            page_name = File.basename(page_spec_file,'_spec.rb')
            define_spec_task(page_name,page_spec_file)
          end
        end

      end
    end

  end
end

#define_spec_task(name, glob_path) ⇒ Object



20
21
22
23
24
25
# File 'lib/taza/tasks.rb', line 20

def define_spec_task(name,glob_path)
  Spec::Rake::SpecTask.new name do |t|
    t.spec_files = Dir.taglob(glob_path,tags)
    t.spec_opts << spec_opts
  end
end