Sha256: b8cc39d5787e81651488a5f7adfcbb1da303991a19da6e4c9f899447455a440a

Contents?: true

Size: 1.46 KB

Versions: 39

Compression:

Stored size: 1.46 KB

Contents

require 'rake/testtask'

module Bones::Plugins::Test
  include ::Bones::Helpers
  extend self

  def initialize_test
    ::Bones.config {
      desc 'Configuration settings for the Ruby test framework.'
      test {
        files FileList['test/**/test_*.rb'], :desc => <<-__
          The list of test files to run. This defaults to all the ruby fines
          in the 'test' directory that start with 'test_' as their filename.
        __

        file 'test/all.rb', :desc => <<-__
          In fashion at one time was the concept of an encompassing test file
          that would run all ruby tests for your project. You can specify that
          file here. If the file does not exist this setting will be ignored.
        __

        opts [], :desc => <<-__
          Extra ruby options to be used when running tests.
        __
      }
    }
  end

  def post_load
    config = ::Bones.config
    have?(:test) {
      Kernel.test(?e, config.test.file) or not config.test.files.to_a.empty?
    }
  end

  def define_tasks
    return unless have? :test
    config = ::Bones.config

    namespace :test do
      Rake::TestTask.new(:run) do |t|
        t.libs = config.libs
        t.test_files = if test(?f, config.test.file) then [config.test.file]
                       else config.test.files end
        t.ruby_opts += config.ruby_opts
        t.ruby_opts += config.test.opts
      end
    end  # namespace :test

    desc 'Alias to test:run'
    task :test => 'test:run'
  end

end

# EOF

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
bones-3.9.0 lib/bones/plugins/test.rb
bones-3.8.5 lib/bones/plugins/test.rb
bones-3.8.4 lib/bones/plugins/test.rb
bones-3.8.3 lib/bones/plugins/test.rb
bones-3.8.2 lib/bones/plugins/test.rb
bones-3.8.1 lib/bones/plugins/test.rb
bones-3.8.0 lib/bones/plugins/test.rb
bones-3.7.3 lib/bones/plugins/test.rb
bones-3.7.2 lib/bones/plugins/test.rb
bones-3.7.1 lib/bones/plugins/test.rb
bones-3.7.0 lib/bones/plugins/test.rb
bones-3.6.5 lib/bones/plugins/test.rb
bones-3.6.4 lib/bones/plugins/test.rb
bones-3.6.2 lib/bones/plugins/test.rb
bones-3.6.1 lib/bones/plugins/test.rb
bones-3.6.0 lib/bones/plugins/test.rb
bones-3.5.5 lib/bones/plugins/test.rb
bones-3.5.4 lib/bones/plugins/test.rb
bones-3.5.3 lib/bones/plugins/test.rb
bones-3.5.2 lib/bones/plugins/test.rb