public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
Yehuda Katz (author)
Thu Jul 02 16:27:15 -0700 2009
commit  edcf92171d3a6648b26c08450550bf698e719ce8
tree    7b5ed9d965f8c180131b3aa7a0183344696abe51
parent  a400264b8efa3074ee6e0441231a529f5cadd215
rubinius / mspec / 0001-Added-d-debug-to-set-MSpec-debugging-verbosity.patch
100644 154 lines (141 sloc) 4.49 kb
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
From b29d3477bfaae5d4de3fd4c10eb64203773d3bdd Mon Sep 17 00:00:00 2001
From: Brian Ford <bford@engineyard.com>
Date: Wed, 29 Apr 2009 12:22:12 -0700
Subject: [PATCH 1/3] Added -d, --debug to set MSpec debugging (verbosity) flag.
 
---
 lib/mspec/commands/mspec-ci.rb | 1 +
 lib/mspec/commands/mspec-run.rb | 1 +
 lib/mspec/commands/mspec-tag.rb | 1 +
 lib/mspec/utils/options.rb | 7 +++++++
 spec/commands/mspec_ci_spec.rb | 5 +++++
 spec/commands/mspec_run_spec.rb | 5 +++++
 spec/commands/mspec_tag_spec.rb | 5 +++++
 spec/utils/options_spec.rb | 26 ++++++++++++++++++++++++++
 8 files changed, 51 insertions(+), 0 deletions(-)
 
diff --git a/lib/mspec/commands/mspec-ci.rb b/lib/mspec/commands/mspec-ci.rb
index e838ffc..f5bc84f 100644
--- a/lib/mspec/commands/mspec-ci.rb
+++ b/lib/mspec/commands/mspec-ci.rb
@@ -42,6 +42,7 @@ class MSpecCI < MSpecScript
     options.action_filters
 
     options.doc "\n Help!"
+ options.debug
     options.version MSpec::VERSION
     options.help
 
diff --git a/lib/mspec/commands/mspec-run.rb b/lib/mspec/commands/mspec-run.rb
index 547a484..1026f71 100644
--- a/lib/mspec/commands/mspec-run.rb
+++ b/lib/mspec/commands/mspec-run.rb
@@ -53,6 +53,7 @@ class MSpecRun < MSpecScript
     options.action_filters
 
     options.doc "\n Help!"
+ options.debug
     options.version MSpec::VERSION
     options.help
 
diff --git a/lib/mspec/commands/mspec-tag.rb b/lib/mspec/commands/mspec-tag.rb
index 804599a..bba35e7 100644
--- a/lib/mspec/commands/mspec-tag.rb
+++ b/lib/mspec/commands/mspec-tag.rb
@@ -72,6 +72,7 @@ class MSpecTag < MSpecScript
     end
 
     options.doc "\n Help!"
+ options.debug
     options.version MSpec::VERSION
     options.help
 
diff --git a/lib/mspec/utils/options.rb b/lib/mspec/utils/options.rb
index 0a7d815..52183f6 100644
--- a/lib/mspec/utils/options.rb
+++ b/lib/mspec/utils/options.rb
@@ -440,4 +440,11 @@ class MSpecOptions
       config[:gdb] = true
     end
   end
+
+ def debug
+ on("-d", "--debug",
+ "Set MSpec debugging flag for more verbose output") do
+ $MSPEC_DEBUG = true
+ end
+ end
 end
diff --git a/spec/commands/mspec_ci_spec.rb b/spec/commands/mspec_ci_spec.rb
index c6c84f7..b0f1515 100644
--- a/spec/commands/mspec_ci_spec.rb
+++ b/spec/commands/mspec_ci_spec.rb
@@ -88,6 +88,11 @@ describe MSpecCI, "#options" do
     @script.options
   end
 
+ it "enables the debug option" do
+ @options.should_receive(:debug)
+ @script.options @argv
+ end
+
   it "calls #custom_options" do
     @script.should_receive(:custom_options).with(@options)
     @script.options
diff --git a/spec/commands/mspec_run_spec.rb b/spec/commands/mspec_run_spec.rb
index a53aa86..6d930d6 100644
--- a/spec/commands/mspec_run_spec.rb
+++ b/spec/commands/mspec_run_spec.rb
@@ -118,6 +118,11 @@ describe MSpecRun, "#options" do
     @script.options @argv
   end
 
+ it "enables the debug option" do
+ @options.should_receive(:debug)
+ @script.options @argv
+ end
+
   it "exits if there are no files to process" do
     @options.should_receive(:parse).and_return([])
     @script.should_receive(:exit)
diff --git a/spec/commands/mspec_tag_spec.rb b/spec/commands/mspec_tag_spec.rb
index 2c048b3..d2092af 100644
--- a/spec/commands/mspec_tag_spec.rb
+++ b/spec/commands/mspec_tag_spec.rb
@@ -98,6 +98,11 @@ describe MSpecTag, "#options" do
     @script.options @argv
   end
 
+ it "enables the debug option" do
+ @options.should_receive(:debug)
+ @script.options @argv
+ end
+
   it "calls #custom_options" do
     @script.should_receive(:custom_options).with(@options)
     @script.options @argv
diff --git a/spec/utils/options_spec.rb b/spec/utils/options_spec.rb
index e488b89..c8383f6 100644
--- a/spec/utils/options_spec.rb
+++ b/spec/utils/options_spec.rb
@@ -1290,3 +1290,29 @@ describe "The --spec-gdb option" do
     @config[:gdb].should == true
   end
 end
+
+describe "The -d, --debug option" do
+ before :each do
+ @options, @config = new_option
+ @options.debug
+ end
+
+ after :each do
+ $MSPEC_DEBUG = nil
+ end
+
+ it "is enabled with #debug" do
+ @options.stub!(:on)
+ @options.should_receive(:on).with("-d", "--debug", an_instance_of(String))
+ @options.debug
+ end
+
+ it "sets $MSPEC_DEBUG to true" do
+ ["-d", "--debug"].each do |opt|
+ $MSPEC_DEBUG.should_not be_true
+ @options.parse opt
+ $MSPEC_DEBUG.should be_true
+ $MSPEC_DEBUG = nil
+ end
+ end
+end
--
1.6.1.1