public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
Added ProfileFilter to MSpec.

This filter takes a file as an argument and filters the specs
based on the methods in that file. The file is YAML; refer to
examples in spec/profiles.
brixen (author)
Fri Apr 18 14:55:01 -0700 2008
commit  b1d3f0b86cf99d43c5e2ab85b01b65d9e3de8490
tree    6397b4e30a432b0a9395afbfd2f114ab9918a2b7
parent  0759866e770988b2ee4ae727927929f41e663002
...
43
44
45
46
47
48
49
50
51
 
 
 
 
 
 
 
 
52
53
54
...
43
44
45
 
 
 
 
 
 
46
47
48
49
50
51
52
53
54
55
56
0
@@ -43,12 +43,14 @@ class MSpecScript
0
   def register
0
     config[:formatter].new.register
0
 
0
- MatchFilter.new(:include, *config[:includes]).register unless config[:includes].empty?
0
- MatchFilter.new(:exclude, *config[:excludes]).register unless config[:excludes].empty?
0
- RegexpFilter.new(:include, *config[:patterns]).register unless config[:patterns].empty?
0
- RegexpFilter.new(:exclude, *config[:xpatterns]).register unless config[:xpatterns].empty?
0
- TagFilter.new(:include, *config[:tags]).register unless config[:tags].empty?
0
- TagFilter.new(:exclude, *config[:xtags]).register unless config[:xtags].empty?
0
+ MatchFilter.new(:include, *config[:includes]).register unless config[:includes].empty?
0
+ MatchFilter.new(:exclude, *config[:excludes]).register unless config[:excludes].empty?
0
+ RegexpFilter.new(:include, *config[:patterns]).register unless config[:patterns].empty?
0
+ RegexpFilter.new(:exclude, *config[:xpatterns]).register unless config[:xpatterns].empty?
0
+ TagFilter.new(:include, *config[:tags]).register unless config[:tags].empty?
0
+ TagFilter.new(:exclude, *config[:xtags]).register unless config[:xtags].empty?
0
+ ProfileFilter.new(:include, *config[:profiles]).register unless config[:profiles].empty?
0
+ ProfileFilter.new(:exclude, *config[:xprofiles]).register unless config[:xprofiles].empty?
0
 
0
     DebugAction.new(config[:atags], config[:astrings]).register if config[:debugger]
0
     GdbAction.new(config[:atags], config[:astrings]).register if config[:gdb]
...
1
2
3
 
...
1
2
3
4
0
@@ -1,3 +1,4 @@
0
 require 'mspec/runner/filters/match'
0
 require 'mspec/runner/filters/regexp'
0
 require 'mspec/runner/filters/tag'
0
+require 'mspec/runner/filters/profile'
...
1
2
 
 
 
 
 
3
4
5
...
90
91
92
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
95
96
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
99
100
...
1
2
3
4
5
6
7
8
9
10
...
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
0
@@ -1,5 +1,10 @@
0
 require File.dirname(__FILE__) + '/../../spec_helper'
0
 require File.dirname(__FILE__) + '/../../bin/script'
0
+require File.dirname(__FILE__) + '/../../runner/mspec'
0
+require File.dirname(__FILE__) + '/../../runner/filters'
0
+require File.dirname(__FILE__) + '/../../runner/actions/filter'
0
+require File.dirname(__FILE__) + '/../../runner/actions/debug'
0
+require File.dirname(__FILE__) + '/../../runner/actions/gdb'
0
 
0
 describe MSpecScript, ".config" do
0
   it "returns a Hash" do
0
@@ -90,11 +95,125 @@ describe MSpecScript, "#initialize" do
0
 end
0
 
0
 describe MSpecScript, "#load" do
0
- # TODO: specs
0
+ before :each do
0
+ File.stub!(:exist?).and_return(false)
0
+ @script = MSpecScript.new
0
+ @file = "default.mspec"
0
+ end
0
+
0
+ it "attempts to locate the file through the expanded path name" do
0
+ File.should_receive(:expand_path).with(@file).and_return(@file)
0
+ File.should_receive(:exist?).with(@file).and_return(true)
0
+ Kernel.should_receive(:load).with(@file).and_return(:loaded)
0
+ @script.load(@file).should == :loaded
0
+ end
0
+
0
+ it "attemps to locate the file in '.'" do
0
+ path = File.join ".", @file
0
+ File.should_receive(:exist?).with(path).and_return(true)
0
+ Kernel.should_receive(:load).with(path).and_return(:loaded)
0
+ @script.load(@file).should == :loaded
0
+ end
0
+
0
+ it "attemps to locate the file in 'spec'" do
0
+ path = File.join "spec", @file
0
+ File.should_receive(:exist?).with(path).and_return(true)
0
+ Kernel.should_receive(:load).with(path).and_return(:loaded)
0
+ @script.load(@file).should == :loaded
0
+ end
0
+end
0
+
0
+describe MSpecScript, "#register" do
0
+ before :each do
0
+ @script = MSpecScript.new
0
+
0
+ @formatter = mock("formatter", :null_object => true)
0
+ @script.config[:formatter] = @formatter
0
+ end
0
+
0
+ it "creates and registers the formatter" do
0
+ @formatter.should_receive(:new).and_return(@formatter)
0
+ @formatter.should_receive(:register)
0
+ @script.register
0
+ end
0
 end
0
 
0
 describe MSpecScript, "#register" do
0
- # TODO: specs
0
+ before :each do
0
+ @script = MSpecScript.new
0
+
0
+ @formatter = mock("formatter", :null_object => true)
0
+ @script.config[:formatter] = @formatter
0
+
0
+ @filter = mock("filter")
0
+ @filter.should_receive(:register)
0
+
0
+ @ary = ["some", "spec"]
0
+ end
0
+
0
+ it "creates and registers a MatchFilter for include specs" do
0
+ MatchFilter.should_receive(:new).with(:include, *@ary).and_return(@filter)
0
+ @script.config[:includes] = @ary
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a MatchFilter for excluded specs" do
0
+ MatchFilter.should_receive(:new).with(:exclude, *@ary).and_return(@filter)
0
+ @script.config[:excludes] = @ary
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a RegexpFilter for include specs" do
0
+ RegexpFilter.should_receive(:new).with(:include, *@ary).and_return(@filter)
0
+ @script.config[:patterns] = @ary
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a RegexpFilter for excluded specs" do
0
+ RegexpFilter.should_receive(:new).with(:exclude, *@ary).and_return(@filter)
0
+ @script.config[:xpatterns] = @ary
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a TagFilter for include specs" do
0
+ TagFilter.should_receive(:new).with(:include, *@ary).and_return(@filter)
0
+ @script.config[:tags] = @ary
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a TagFilter for excluded specs" do
0
+ TagFilter.should_receive(:new).with(:exclude, *@ary).and_return(@filter)
0
+ @script.config[:xtags] = @ary
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a ProfileFilter for include specs" do
0
+ ProfileFilter.should_receive(:new).with(:include, *@ary).and_return(@filter)
0
+ @script.config[:profiles] = @ary
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a ProfileFilter for excluded specs" do
0
+ ProfileFilter.should_receive(:new).with(:exclude, *@ary).and_return(@filter)
0
+ @script.config[:xprofiles] = @ary
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a DebugAction for excluded specs" do
0
+ @script.config[:atags] = ["some"]
0
+ @script.config[:astrings] = ["string"]
0
+ DebugAction.should_receive(:new).with(["some"], ["string"]).and_return(@filter)
0
+ @script.config[:debugger] = true
0
+ @script.register
0
+ end
0
+
0
+ it "creates and registers a GdbAction for excluded specs" do
0
+ @script.config[:atags] = ["some"]
0
+ @script.config[:astrings] = ["string"]
0
+ GdbAction.should_receive(:new).with(["some"], ["string"]).and_return(@filter)
0
+ @script.config[:gdb] = true
0
+ @script.register
0
+ end
0
 end
0
 
0
 describe MSpecScript, "#signals" do

Comments

    No one has commented yet.