From 9ba6c68d3059e6b4fc8354f589643456bd07d565 Mon Sep 17 00:00:00 2001 From: "El Skwid (Don Morrison)" Date: Sun, 23 Sep 2012 13:33:45 -0700 Subject: [PATCH] Run generator on the dummy app --- test/dummy/.gitignore | 1 + test/dummy/Guardfile | 17 ++++++++++++++ test/dummy/lib/tasks/test.rake | 10 +++++++++ test/dummy/test/minitest_helper.rb | 36 ++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 test/dummy/.gitignore create mode 100644 test/dummy/Guardfile create mode 100644 test/dummy/lib/tasks/test.rake create mode 100644 test/dummy/test/minitest_helper.rb diff --git a/test/dummy/.gitignore b/test/dummy/.gitignore new file mode 100644 index 0000000..ed9f9cc --- /dev/null +++ b/test/dummy/.gitignore @@ -0,0 +1 @@ +coverage \ No newline at end of file diff --git a/test/dummy/Guardfile b/test/dummy/Guardfile new file mode 100644 index 0000000..e5113b0 --- /dev/null +++ b/test/dummy/Guardfile @@ -0,0 +1,17 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +guard "minitest" do + # with Minitest::Spec + watch(%r|^test/(.*)_test\.rb|) + watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" } + watch(%r|^test/minitest_helper\.rb|) { "test" } + watch(%r|^test/support/|) { "test" } + + # Rails 3.2 + watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" } + watch(%r|^app/mailers/(.*)\.rb|) { |m| "test/mailers/#{m[1]}_test.rb" } + watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" } + watch(%r|^app/models/(.*)\.rb|) { |m| "test/models/#{m[1]}_test.rb" } +end + diff --git a/test/dummy/lib/tasks/test.rake b/test/dummy/lib/tasks/test.rake new file mode 100644 index 0000000..2789348 --- /dev/null +++ b/test/dummy/lib/tasks/test.rake @@ -0,0 +1,10 @@ +require "rake/testtask" + +task default: :test + +Rake::TestTask.new(:test) do |t| + t.libs << "lib" + t.libs << "test" + t.pattern = "test/**/*_test.rb" + t.verbose = false +end diff --git a/test/dummy/test/minitest_helper.rb b/test/dummy/test/minitest_helper.rb new file mode 100644 index 0000000..8f0658b --- /dev/null +++ b/test/dummy/test/minitest_helper.rb @@ -0,0 +1,36 @@ +if RUBY_ENGINE == "ruby" + begin + require "simplecov" + SimpleCov.add_filter "test" + SimpleCov.add_filter "config" + SimpleCov.command_name "MiniTest" + SimpleCov.start + rescue LoadError + warn "unable to load SimpleCov" + end +end + +ENV["RAILS_ENV"] = "test" +require File.expand_path('../../config/environment', __FILE__) + +require "minitest/autorun" +require "minitest/rails" +require "minitest/pride" # Provides awesome colorful output + +# Uncomment if you want Capybara in accceptance/integration tests +# require "minitest/rails/capybara" + +require "mocha" + +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[File.join("./test/support/**/*.rb")].sort.each { |f| require f } + +class MiniTest::Rails::ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. + # fixtures :all + + # Add more helper methods to be used by all tests here... +end + +MiniTest::Rails.override_testunit!