Permalink
Browse files

Add standalone generator

Add new generator (standalone) with its own helper to be used when
tests are needed outside of Rails.
  • Loading branch information...
1 parent 0844150 commit 2d6a0a7c82a0a7d547551c6ed7b0259b5a8ee8c9 @elskwid elskwid committed Jan 26, 2013
@@ -0,0 +1,18 @@
+if RUBY_ENGINE == "ruby"
+ begin
+ require "simplecov"
+ SimpleCov.start do
+ add_filter "test"
+ add_filter "config"
+ command_name "MiniTest"
+ end
+ rescue LoadError
+ warn "unable to load SimpleCov"
+ end
+end
+
+require "thincloud-test"
+
+# 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 }
@@ -32,6 +32,22 @@ def test
say_status "success", "thincloud-test has finished."
end
+ # Generates thincloud test infrastructure outside of Rails
+ def standalone
+ remove_file "test/test_helper.rb"
+
+ copy_file "minitest_helper_standalone.rb", "test/minitest_helper.rb"
+ copy_file "minitest_reporters.rb", "test/support/minitest_reporters.rb"
+ copy_file "test.rake", "lib/tasks/test.rake"
+ copy_file "Guardfile"
+
+ create_file ".gitignore" unless File.exist?(".gitignore")
+ append_file ".gitignore", "coverage"
+
+ say_status "", ""
+ say_status "success", "thincloud-test has finished."
+ end
+
end
end
end
@@ -6,7 +6,7 @@ module Thincloud
module Test
class Generator
def self.generate
- ::Thincloud::Generators::TestGenerator.new.test
+ ::Thincloud::Generators::TestGenerator.new.standalone
end
end
end

0 comments on commit 2d6a0a7

Please sign in to comment.