Sha256: 687ac413bae04e4b9896e4556fbddc82a844accac4d35a760bcf3ce2248c5eab

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

require 'rubygems'
require 'rake'
require 'taglob/rake/tasks'
require 'spec/rake/spectask'

def tags
  ENV['TAGS']
end

module Taza
  module Rake
    class Tasks
      attr_accessor :spec_opts

      def initialize
        yield self if block_given?
        define
      end

      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

      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
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
scudco-taza-0.8.3 lib/taza/tasks.rb
taza-0.8.2 lib/taza/tasks.rb
taza-0.8.3 lib/taza/tasks.rb