public
Description: A Ruby web application framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack.git
Click here to lend your support to: mack and make a donation at www.pledgie.com !
Fixed: rake stats doesn't work with Test::Unit::TestCase [#45 state:resolved]
markbates (author)
Mon Jul 28 11:34:02 -0700 2008
commit  0b93f4274052c0ea2c42f3b2b0a9798d9d02e01b
tree    de2504af4cfea6aa4be198fd03617c06a68dc794
parent  e81da1d91b7450d718f3cf3b7e4b48454990c2f4
...
 
1
2
3
...
1
2
3
4
0
@@ -1,3 +1,4 @@
0
+* [#45] rake stats task now works with Test::Unit::TestCase
0
 * [#57] Moved most files under to lib/mack
0
 * [#54] Added DataMapper 0.9.3 support
0
 * [#24] Added mack-mailer support.
...
25
26
27
 
28
29
30
31
32
33
34
 
 
 
 
 
35
36
37
...
41
42
43
 
44
45
46
...
25
26
27
28
29
 
 
 
 
 
 
30
31
32
33
34
35
36
37
...
41
42
43
44
45
46
47
0
@@ -25,13 +25,13 @@ namespace :test do
0
   task :stats do |t|
0
     ENV["MACK_ENV"] = "test"
0
     Rake::Task["mack:environment"].invoke
0
+    Rake::Task["test:setup"].invoke
0
     x = `rcov test/**/*_#{app_config.mack.testing_framework == "rspec" ? "spec" : "test"}.rb -T --no-html -x Rakefile,config\/`
0
-    @print = false
0
-    x.each do |line|
0
-      puts line if @print
0
-      unless @print
0
-        if line.match(/\d+ tests, \d+ assertions, \d+ failures, \d+ errors/)
0
-          @print = true
0
+    if app_config.mack.testing_framework == "test_case"
0
+      x.each do |line|
0
+        case line
0
+        when /^\+[\+\-]*\+$/, /^\|.*\|$/, /\d+\sLines\s+\d+\sLOC/
0
+          puts line
0
         end
0
       end
0
     end
0
@@ -41,6 +41,7 @@ namespace :test do
0
   task :coverage do |t|
0
     ENV["MACK_ENV"] = "test"
0
     Rake::Task["mack:environment"].invoke
0
+    Rake::Task["test:setup"].invoke
0
     `rcov test/**/*_#{app_config.mack.testing_framework == "rspec" ? "spec" : "test"}.rb -x Rakefile,config\/`
0
     `open coverage/index.html`
0
   end
...
1
2
3
4
5
6
7
 
 
 
 
 
 
 
8
9
 
10
11
12
13
 
 
 
 
 
14
15
16
17
 
18
19
 
20
21
...
1
2
 
 
 
 
 
3
4
5
6
7
8
9
10
 
11
12
 
 
 
13
14
15
16
17
18
 
 
19
20
21
22
23
24
25
0
@@ -1,20 +1,24 @@
0
 require File.join(File.dirname(__FILE__), "helpers")
0
 
0
-module Spec # :nodoc:
0
-  module Example # :nodoc:
0
-    module ExampleMethods # :nodoc:
0
-      include Mack::Routes::Urls
0
-      include Mack::Testing::Helpers
0
+if app_config.mack.testing_framework == "rspec"
0
+  require 'spec'
0
+  module Spec # :nodoc:
0
+    module Example # :nodoc:
0
+      module ExampleMethods # :nodoc:
0
+        include Mack::Routes::Urls
0
+        include Mack::Testing::Helpers
0
       
0
-      alias_method :mack_spec_execute, :execute
0
+        alias_method :mack_spec_execute, :execute
0
 
0
-      def execute(options, instance_variables)
0
-        in_session do
0
-          @__res = mack_spec_execute(options, instance_variables)
0
+        def execute(options, instance_variables)
0
+          in_session do
0
+            @__res = mack_spec_execute(options, instance_variables)
0
+          end
0
+          @__res
0
         end
0
-        @__res
0
-      end
0
       
0
+      end
0
     end
0
   end
0
+
0
 end
0
\ No newline at end of file
...
34
35
36
37
 
38
39
40
...
34
35
36
 
37
38
39
40
0
@@ -34,7 +34,7 @@ unless Mack::Configuration.initialized_core
0
   Mack.logger.info "Initializing core classes..."
0
   # Require all the necessary files to make Mack actually work!
0
   lib_dirs = ["errors", "core_extensions", "utils", "runner_helpers", "routing", "view_helpers", "rendering", "controller", "tasks", "initialization/server", "generators", "distributed"]
0
-  lib_dirs << "testing" if Mack.env == "test"
0
+  lib_dirs << "testing"# if Mack.env == "test"
0
   lib_dirs.each do |dir|
0
     dir_globs = Dir.glob(File.join(fl, dir, "**/*.rb"))
0
     dir_globs.each do |d|

Comments