tasks/unit_test.rake in alf-0.9.2 vs tasks/unit_test.rake in alf-0.9.3

- old
+ new

@@ -1,77 +1,52 @@ -# Installs a rake task for for running unit tests. -# -# This file installs the 'rake unit_test' and extends 'rake test' to run unit -# tests, if any. It is automatically generated by Noe from your .noespec file, -# and should therefore be configured there, under the variables/rake_tasks/unit_test -# entry, as illustrated below: -# -# variables: -# rake_tasks: -# unit_test: -# pattern: test/test*.rb -# verbose: false -# warning: false -# ... -# -# If you have specific needs requiring manual intervention on this file, -# don't forget to set safe-override to false in your noe specification: -# -# template-info: -# manifest: -# tasks/unit_test.rake: -# safe-override: false -# -# More info about the TestTask and its options can be found on -# http://rake.rubyforge.org/classes/Rake/TestTask.html -# begin - require 'rake/testtask' - desc "Run unit tests" - Rake::TestTask.new(:unit_test) do |t| + require "rspec/core/rake_task" + desc "Run RSpec code examples" + RSpec::Core::RakeTask.new(:unit_test) do |t| + # Glob pattern to match files. + t.pattern = "spec/unit/**/test_*.rb" - # List of directories to added to $LOAD_PATH before running the - # tests. (default is 'lib') - t.libs = ["lib"] + # By default, if there is a Gemfile, the generated command will include + # 'bundle exec'. Set this to true to ignore the presence of a Gemfile, + # and not add 'bundle exec' to the command. + t.skip_bundler = false - # True if verbose test output desired. (default is false) - t.verbose = false + # Name of Gemfile to use + t.gemfile = "Gemfile" - # Test options passed to the test suite. An explicit TESTOPTS=opts - # on the command line will override this. (default is NONE) - t.options = nil + # Whether or not to fail Rake when an error occurs (typically when + # examples fail). + t.fail_on_error = true - # Request that the tests be run with the warning flag set. - # E.g. warning=true implies "ruby -w" used to run the tests. - t.warning = false + # A message to print to stderr when there are failures. + t.failure_message = nil - # Glob pattern to match test files. (default is 'test/test*.rb') - t.pattern = "test/test*.rb" + # Use verbose output. If this is set to true, the task will print the + # executed spec command to stdout. + t.verbose = true - # Style of test loader to use. Options are: - # - # * :rake -- Rake provided test loading script (default). - # * :testrb -- Ruby provided test loading script. - # * :direct -- Load tests using command line loader. - # - t.loader = :rake + # Use rcov for code coverage? + t.rcov = false - # Array of commandline options to pass to ruby when running test - # loader. + # Path to rcov. + t.rcov_path = "rcov" + + # Command line options to pass to rcov. See 'rcov --help' about this + t.rcov_opts = [] + + # Command line options to pass to ruby. See 'ruby --help' about this t.ruby_opts = [] - # Explicitly define the list of test files to be included in a - # test. +list+ is expected to be an array of file names (a - # FileList is acceptable). If both +pattern+ and +test_files+ are - # used, then the list of test files is the union of the two. - t.test_files = nil + # Path to rspec + t.rspec_path = "rspec" + # Command line options to pass to rspec. See 'rspec --help' about this + t.rspec_opts = ["--color", "--backtrace"] end rescue LoadError => ex task :unit_test do abort 'rspec is not available. In order to run spec, you must: gem install rspec' end ensure - desc "Run all tests" + task :spec => [:unit_test] task :test => [:unit_test] end -