public
Rubygem
Description: BDD that talks to domain experts first and code second
Homepage: http://cukes.info/
Clone URL: git://github.com/aslakhellesoy/cucumber.git
Modified run_features to capture command output into self.results (changes 
stolen from autotest).
alan (author)
Sat Nov 29 03:38:57 -0800 2008
commit  7a32dfb703cfd037bf1c6f806baac9300bb9fec7
tree    8537ad660a323179d11fcb0543c7d98731a1df5f
parent  52b40d1f8973b78eaec754a1f40869ad17b72082
...
70
71
72
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
75
76
...
70
71
72
 
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
0
@@ -70,7 +70,29 @@ module Autotest::CucumberMixin
0
       cmd = self.make_cucumber_cmd self.scenarios_to_run, dirty_scenarios_file.path
0
       return if cmd.empty?
0
       puts cmd unless $q
0
-      system cmd
0
+      old_sync = $stdout.sync
0
+      $stdout.sync = true
0
+      self.results = []
0
+      line = []
0
+      begin
0
+        open("| #{cmd}", "r") do |f|
0
+          until f.eof? do
0
+            c = f.getc
0
+            putc c
0
+            line << c
0
+            if c == ?\n then
0
+              self.results << if RUBY_VERSION >= "1.9" then
0
+                                line.join
0
+                              else
0
+                                line.pack "c*"
0
+                              end
0
+              line.clear
0
+            end
0
+          end
0
+        end
0
+      ensure
0
+        $stdout.sync = old_sync
0
+      end
0
       self.scenarios_to_run = dirty_scenarios_file.readlines.map { |l| l.chomp }
0
       self.tainted = true unless self.scenarios_to_run == []
0
     end

Comments