Sha256: c8ad30b4a1f89b8a5595b569ada69b6f0569fc1b9529d86b6532ffcf43b359a3

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

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

def tags
  ENV['TAGS']
end

namespace :spec do
  def format_options(file_name)
    file_name = "artifacts/#{file_name}/index.html"
    dir_name = File.dirname(file_name)
    FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
    ["--format","html:#{file_name}","--format","p"]
  end

  desc "Run all functional specs"
  Spec::Rake::SpecTask.new :functional do |t|
    t.spec_files = Dir.taglob('spec/functional/**/*_spec.rb',tags)
    t.spec_opts << format_options("functional/all")
  end
  desc "Run all integration specs"
  Spec::Rake::SpecTask.new :integration do |t|
    t.spec_files = Dir.taglob('spec/integration/**/*_spec.rb',tags)
    t.spec_opts << format_options("integration/all")
  end

  namespace :functional do
    Dir.glob('./spec/functional/*/').each do |dir|
      site_name = File.basename(dir)
      desc "Run all functional specs for #{site_name}"
      Spec::Rake::SpecTask.new site_name.to_sym do |t|
        t.spec_files = Dir.taglob("#{dir}**/*_spec.rb",tags)
        t.spec_opts << format_options("functional/#{site_name}/all")
      end
      namespace site_name.to_sym do
        Dir.glob("./spec/functional/#{site_name}/*_spec.rb").each do |page_spec_file|
          page_spec_name = File.basename(page_spec_file)
          page_name = page_spec_name.chomp('_spec.rb')
          Spec::Rake::SpecTask.new page_name.to_sym do |t|
            t.spec_files = page_spec_file
            t.spec_opts << format_options("functional/#{site_name}/#{page_name}")
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scudco-taza-0.8.1 lib/taza/tasks.rb