mspec 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,6 +27,7 @@ class MSpecScript
27
27
  config[:xprofiles] = []
28
28
  config[:atags] = []
29
29
  config[:astrings] = []
30
+ config[:ltags] = []
30
31
  config[:abort] = true
31
32
  end
32
33
 
@@ -51,7 +52,7 @@ class MSpecScript
51
52
  end
52
53
 
53
54
  def register
54
- config[:formatter].new(config[:output]).register
55
+ config[:formatter].new(config[:output]).register if config[:formatter]
55
56
 
56
57
  MatchFilter.new(:include, *config[:includes]).register unless config[:includes].empty?
57
58
  MatchFilter.new(:exclude, *config[:excludes]).register unless config[:excludes].empty?
@@ -75,6 +76,15 @@ class MSpecScript
75
76
  end
76
77
  end
77
78
 
79
+ def files(list)
80
+ list.inject([]) do |files, item|
81
+ stat = File.stat(File.expand_path(item))
82
+ files << item if stat.file?
83
+ files.concat(Dir[item+"/**/*_spec.rb"].sort) if stat.directory?
84
+ files
85
+ end
86
+ end
87
+
78
88
  def self.main
79
89
  $VERBOSE = nil unless ENV['OUTPUT_WARNINGS']
80
90
  script = new
data/lib/mspec/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MSpec
2
- VERSION = '1.4.0'
2
+ VERSION = '1.5.0'
3
3
  end
@@ -4,16 +4,16 @@ require 'mspec/commands/mkspec'
4
4
 
5
5
  describe "The -c, --constant CONSTANT option" do
6
6
  before :each do
7
- @options = OptionParser.new
8
- OptionParser.stub!(:new).and_return(@options)
7
+ @options = MSpecOptions.new
8
+ MSpecOptions.stub!(:new).and_return(@options)
9
9
  @script = MkSpec.new
10
10
  @config = @script.config
11
11
  end
12
12
 
13
13
  it "is enabled by #options" do
14
14
  @options.stub!(:on)
15
- @options.should_receive(:on).with("-c", "--constant CONSTANT",
16
- String, an_instance_of(String))
15
+ @options.should_receive(:on).with("-c", "--constant", "CONSTANT",
16
+ an_instance_of(String))
17
17
  @script.options
18
18
  end
19
19
 
@@ -28,16 +28,16 @@ end
28
28
 
29
29
  describe "The -b, --base DIR option" do
30
30
  before :each do
31
- @options = OptionParser.new
32
- OptionParser.stub!(:new).and_return(@options)
31
+ @options = MSpecOptions.new
32
+ MSpecOptions.stub!(:new).and_return(@options)
33
33
  @script = MkSpec.new
34
34
  @config = @script.config
35
35
  end
36
36
 
37
37
  it "is enabled by #options" do
38
38
  @options.stub!(:on)
39
- @options.should_receive(:on).with("-b", "--base DIR",
40
- String, an_instance_of(String))
39
+ @options.should_receive(:on).with("-b", "--base", "DIR",
40
+ an_instance_of(String))
41
41
  @script.options
42
42
  end
43
43
 
@@ -52,16 +52,16 @@ end
52
52
 
53
53
  describe "The -r, --require LIBRARY option" do
54
54
  before :each do
55
- @options = OptionParser.new
56
- OptionParser.stub!(:new).and_return(@options)
55
+ @options = MSpecOptions.new
56
+ MSpecOptions.stub!(:new).and_return(@options)
57
57
  @script = MkSpec.new
58
58
  @config = @script.config
59
59
  end
60
60
 
61
61
  it "is enabled by #options" do
62
62
  @options.stub!(:on)
63
- @options.should_receive(:on).with("-r", "--require LIBRARY",
64
- String, an_instance_of(String))
63
+ @options.should_receive(:on).with("-r", "--require", "LIBRARY",
64
+ an_instance_of(String))
65
65
  @script.options
66
66
  end
67
67
 
@@ -76,8 +76,8 @@ end
76
76
 
77
77
  describe MkSpec, "#options" do
78
78
  before :each do
79
- @options = OptionParser.new
80
- OptionParser.stub!(:new).and_return(@options)
79
+ @options = MSpecOptions.new
80
+ MSpecOptions.stub!(:new).and_return(@options)
81
81
  @script = MkSpec.new
82
82
  end
83
83
 
@@ -92,8 +92,9 @@ describe MkSpec, "#options" do
92
92
  end
93
93
 
94
94
  it "prints help and exits if passed an unrecognized option" do
95
- @script.should_receive(:puts).exactly(3).times
96
- @script.should_receive(:exit)
95
+ @options.should_receive(:raise).with(MSpecOptions::ParseError, an_instance_of(String))
96
+ @options.stub!(:puts)
97
+ @options.stub!(:exit)
97
98
  @script.options "--iunknown"
98
99
  end
99
100
  end
@@ -257,8 +258,8 @@ end
257
258
 
258
259
  describe MkSpec, "#run" do
259
260
  before :each do
260
- @options = OptionParser.new
261
- OptionParser.stub!(:new).and_return(@options)
261
+ @options = MSpecOptions.new
262
+ MSpecOptions.stub!(:new).and_return(@options)
262
263
 
263
264
  @map = NameMap.new
264
265
  NameMap.stub!(:new).and_return(@map)
@@ -13,7 +13,7 @@ describe MSpecCI, "#options" do
13
13
  end
14
14
 
15
15
  it "enables the config option" do
16
- @options.should_receive(:add_config)
16
+ @options.should_receive(:configure)
17
17
  @script.options
18
18
  end
19
19
 
@@ -23,47 +23,47 @@ describe MSpecCI, "#options" do
23
23
  end
24
24
 
25
25
  it "enables the name option" do
26
- @options.should_receive(:add_name)
26
+ @options.should_receive(:name)
27
27
  @script.options
28
28
  end
29
29
 
30
30
  it "enables the dry run option" do
31
- @options.should_receive(:add_pretend)
31
+ @options.should_receive(:pretend)
32
32
  @script.options
33
33
  end
34
34
 
35
35
  it "enables the interrupt single specs option" do
36
- @options.should_receive(:add_interrupt)
36
+ @options.should_receive(:interrupt)
37
37
  @script.options
38
38
  end
39
39
 
40
40
  it "enables the formatter options" do
41
- @options.should_receive(:add_formatters)
41
+ @options.should_receive(:formatters)
42
42
  @script.options
43
43
  end
44
44
 
45
45
  it "enables the verbose option" do
46
- @options.should_receive(:add_verbose)
46
+ @options.should_receive(:verbose)
47
47
  @script.options
48
48
  end
49
49
 
50
50
  it "enables the action options" do
51
- @options.should_receive(:add_actions)
51
+ @options.should_receive(:actions)
52
52
  @script.options
53
53
  end
54
54
 
55
55
  it "enables the action filter options" do
56
- @options.should_receive(:add_action_filters)
56
+ @options.should_receive(:action_filters)
57
57
  @script.options
58
58
  end
59
59
 
60
60
  it "enables the version option" do
61
- @options.should_receive(:add_version)
61
+ @options.should_receive(:version)
62
62
  @script.options
63
63
  end
64
64
 
65
65
  it "enables the help option" do
66
- @options.should_receive(:add_help)
66
+ @options.should_receive(:help)
67
67
  @script.options
68
68
  end
69
69
  end
@@ -100,37 +100,10 @@ describe MSpecCI, "#run" do
100
100
  @script.run
101
101
  end
102
102
 
103
- it "registers a tag filter for 'fails'" do
103
+ it "registers a tag filter for 'fails', 'unstable', 'incomplete', 'critical', 'unsupported'" do
104
104
  filter = mock("fails filter")
105
- TagFilter.should_receive(:new).with(:exclude, 'fails').and_return(filter)
106
- filter.should_receive(:register)
107
- @script.run
108
- end
109
-
110
- it "registers a tag filter for 'unstable'" do
111
- filter = mock("unstable filter")
112
- TagFilter.should_receive(:new).with(:exclude, 'unstable').and_return(filter)
113
- filter.should_receive(:register)
114
- @script.run
115
- end
116
-
117
- it "registers a tag filter for 'incomplete'" do
118
- filter = mock("incomplete filter")
119
- TagFilter.should_receive(:new).with(:exclude, 'incomplete').and_return(filter)
120
- filter.should_receive(:register)
121
- @script.run
122
- end
123
-
124
- it "registers a tag filter for 'critical'" do
125
- filter = mock("critical filter")
126
- TagFilter.should_receive(:new).with(:exclude, 'critical').and_return(filter)
127
- filter.should_receive(:register)
128
- @script.run
129
- end
130
-
131
- it "registers a tag filter for 'unsupported'" do
132
- filter = mock("unsupported filter")
133
- TagFilter.should_receive(:new).with(:exclude, 'unsupported').and_return(filter)
105
+ TagFilter.should_receive(:new).with(:exclude,
106
+ "fails", "critical", "unstable", "incomplete", "unsupported").and_return(filter)
134
107
  filter.should_receive(:register)
135
108
  @script.run
136
109
  end
@@ -19,12 +19,12 @@ describe MSpecRun, "#options" do
19
19
  end
20
20
 
21
21
  it "enables the filter options" do
22
- @options.should_receive(:add_filters)
22
+ @options.should_receive(:filters)
23
23
  @script.options @argv
24
24
  end
25
25
 
26
- it "enables the config option" do
27
- @options.should_receive(:add_config)
26
+ it "enables the configure option" do
27
+ @options.should_receive(:configure)
28
28
  @script.options @argv
29
29
  end
30
30
 
@@ -34,57 +34,57 @@ describe MSpecRun, "#options" do
34
34
  end
35
35
 
36
36
  it "enables the name option" do
37
- @options.should_receive(:add_name)
37
+ @options.should_receive(:name)
38
38
  @script.options @argv
39
39
  end
40
40
 
41
41
  it "enables the randomize option to runs specs in random order" do
42
- @options.should_receive(:add_randomize)
42
+ @options.should_receive(:randomize)
43
43
  @script.options @argv
44
44
  end
45
45
 
46
46
  it "enables the dry run option" do
47
- @options.should_receive(:add_pretend)
47
+ @options.should_receive(:pretend)
48
48
  @script.options @argv
49
49
  end
50
50
 
51
51
  it "enables the interrupt single specs option" do
52
- @options.should_receive(:add_interrupt)
52
+ @options.should_receive(:interrupt)
53
53
  @script.options @argv
54
54
  end
55
55
 
56
56
  it "enables the formatter options" do
57
- @options.should_receive(:add_formatters)
57
+ @options.should_receive(:formatters)
58
58
  @script.options @argv
59
59
  end
60
60
 
61
61
  it "enables the verbose option" do
62
- @options.should_receive(:add_verbose)
62
+ @options.should_receive(:verbose)
63
63
  @script.options @argv
64
64
  end
65
65
 
66
66
  it "enables the verify options" do
67
- @options.should_receive(:add_verify)
67
+ @options.should_receive(:verify)
68
68
  @script.options @argv
69
69
  end
70
70
 
71
71
  it "enables the action options" do
72
- @options.should_receive(:add_actions)
72
+ @options.should_receive(:actions)
73
73
  @script.options @argv
74
74
  end
75
75
 
76
76
  it "enables the action filter options" do
77
- @options.should_receive(:add_action_filters)
77
+ @options.should_receive(:action_filters)
78
78
  @script.options @argv
79
79
  end
80
80
 
81
81
  it "enables the version option" do
82
- @options.should_receive(:add_version)
82
+ @options.should_receive(:version)
83
83
  @script.options @argv
84
84
  end
85
85
 
86
86
  it "enables the help option" do
87
- @options.should_receive(:add_help)
87
+ @options.should_receive(:help)
88
88
  @script.options @argv
89
89
  end
90
90
 
@@ -5,16 +5,14 @@ require 'mspec/commands/mspec'
5
5
  describe MSpecMain, "#options" do
6
6
  before :each do
7
7
  @options, @config = new_option
8
- @options.stub!(:parser).and_return(mock("parser"))
9
- @options.parser.stub!(:filter!).and_return(["blocked!"])
10
8
  MSpecOptions.stub!(:new).and_return(@options)
11
9
 
12
10
  @script = MSpecMain.new
13
11
  @script.stub!(:config).and_return(@config)
14
12
  end
15
13
 
16
- it "enables the config option" do
17
- @options.should_receive(:add_config)
14
+ it "enables the configure option" do
15
+ @options.should_receive(:configure)
18
16
  @script.options
19
17
  end
20
18
 
@@ -24,14 +22,36 @@ describe MSpecMain, "#options" do
24
22
  end
25
23
 
26
24
  it "enables the target options" do
27
- @options.should_receive(:add_targets)
25
+ @options.should_receive(:targets)
28
26
  @script.options
29
27
  end
30
28
 
31
29
  it "enables the version option" do
32
- @options.should_receive(:add_version)
30
+ @options.should_receive(:version)
33
31
  @script.options
34
32
  end
33
+
34
+ it "sets config[:options] to all argv entries that are not registered options" do
35
+ @options.on "-X", "--exclude", "ARG", "description"
36
+ @script.options [".", "-G", "fail", "-X", "ARG", "--list", "unstable", "some/file.rb"]
37
+ @config[:options].should == [".", "-G", "fail", "--list", "unstable", "some/file.rb"]
38
+ end
39
+
40
+ it "passes -h, --help to the subscript" do
41
+ ["-h", "--help"].each do |opt|
42
+ @config[:options] = []
43
+ @script.options ["ci", opt]
44
+ @config[:options].sort.should == ["-h"]
45
+ end
46
+ end
47
+
48
+ it "passes -v, --version to the subscript" do
49
+ ["-v", "--version"].each do |opt|
50
+ @config[:options] = []
51
+ @script.options ["ci", opt]
52
+ @config[:options].sort.should == ["-v"]
53
+ end
54
+ end
35
55
  end
36
56
 
37
57
  describe MSpecMain, "#parallel" do
@@ -205,15 +225,29 @@ describe MSpecMain, "#run" do
205
225
  @options, @config = new_option
206
226
  MSpecOptions.stub!(:new).and_return(@options)
207
227
  @script = MSpecMain.new
228
+ @script.stub!(:config).and_return(@config)
229
+ @script.stub!(:exec)
208
230
  end
209
231
 
210
232
  it "sets MSPEC_RUNNER = '1' in the environment" do
211
- @script.stub!(:exec)
212
233
  ENV["MSPEC_RUNNER"] = "0"
213
234
  @script.run
214
235
  ENV["MSPEC_RUNNER"].should == "1"
215
236
  end
216
237
 
238
+ it "sets RUBY_EXE = config[:target] in the environment" do
239
+ ENV["RUBY_EXE"] = nil
240
+ @script.run
241
+ ENV["RUBY_EXE"].should == @config[:target]
242
+ end
243
+
244
+ it "sets RUBY_FLAGS = config[:flags] in the environment" do
245
+ ENV["RUBY_FLAGS"] = nil
246
+ @config[:flags] = ["-w", "-Q"]
247
+ @script.run
248
+ ENV["RUBY_FLAGS"].should == "-w -Q"
249
+ end
250
+
217
251
  it "uses exec to invoke the runner script" do
218
252
  @script.should_receive(:exec).with("ruby", "-v", %r"mspec/bin/mspec-run$")
219
253
  @script.options
@@ -1,6 +1,30 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
  require 'mspec/runner/mspec'
3
3
  require 'mspec/commands/mspec-tag'
4
+ require 'mspec/runner/actions/tag'
5
+ require 'mspec/runner/actions/taglist'
6
+
7
+ describe MSpecTag, ".new" do
8
+ before :each do
9
+ @script = MSpecTag.new
10
+ end
11
+
12
+ it "sets config[:ltags] to an empty list" do
13
+ @script.config[:ltags].should == []
14
+ end
15
+
16
+ it "sets config[:tagger] to :add" do
17
+ @script.config[:tagger] = :add
18
+ end
19
+
20
+ it "sets config[:tag] to 'fails:'" do
21
+ @script.config[:tag] = 'fails:'
22
+ end
23
+
24
+ it "sets config[:outcome] to :fail" do
25
+ @script.config[:outcome] = :fail
26
+ end
27
+ end
4
28
 
5
29
  describe MSpecTag, "#options" do
6
30
  before :each do
@@ -19,12 +43,12 @@ describe MSpecTag, "#options" do
19
43
  end
20
44
 
21
45
  it "enables the filter options" do
22
- @options.should_receive(:add_filters)
46
+ @options.should_receive(:filters)
23
47
  @script.options @argv
24
48
  end
25
49
 
26
- it "enables the config option" do
27
- @options.should_receive(:add_config)
50
+ it "enables the configure option" do
51
+ @options.should_receive(:configure)
28
52
  @script.options @argv
29
53
  end
30
54
 
@@ -34,42 +58,37 @@ describe MSpecTag, "#options" do
34
58
  end
35
59
 
36
60
  it "enables the name option" do
37
- @options.should_receive(:add_name)
61
+ @options.should_receive(:name)
38
62
  @script.options @argv
39
63
  end
40
64
 
41
65
  it "enables the dry run option" do
42
- @options.should_receive(:add_pretend)
66
+ @options.should_receive(:pretend)
43
67
  @script.options @argv
44
68
  end
45
69
 
46
70
  it "enables the interrupt single specs option" do
47
- @options.should_receive(:add_interrupt)
71
+ @options.should_receive(:interrupt)
48
72
  @script.options @argv
49
73
  end
50
74
 
51
75
  it "enables the formatter options" do
52
- @options.should_receive(:add_formatters)
76
+ @options.should_receive(:formatters)
53
77
  @script.options @argv
54
78
  end
55
79
 
56
80
  it "enables the verbose option" do
57
- @options.should_receive(:add_verbose)
58
- @script.options @argv
59
- end
60
-
61
- it "enables the tagging options" do
62
- @options.should_receive(:add_tagging)
81
+ @options.should_receive(:verbose)
63
82
  @script.options @argv
64
83
  end
65
84
 
66
85
  it "enables the version option" do
67
- @options.should_receive(:add_version)
86
+ @options.should_receive(:version)
68
87
  @script.options @argv
69
88
  end
70
89
 
71
90
  it "enables the help option" do
72
- @options.should_receive(:add_help)
91
+ @options.should_receive(:help)
73
92
  @script.options @argv
74
93
  end
75
94
 
@@ -81,6 +100,136 @@ describe MSpecTag, "#options" do
81
100
  end
82
101
  end
83
102
 
103
+ describe MSpecTag, "options" do
104
+ before :each do
105
+ @options, @config = new_option
106
+ MSpecOptions.stub!(:new).and_return(@options)
107
+ @script = MSpecTag.new
108
+ @script.stub!(:config).and_return(@config)
109
+ end
110
+
111
+ describe "-N, --add TAG" do
112
+ it "is enabled with #options" do
113
+ @options.stub!(:on)
114
+ @options.should_receive(:on).with("-N", "--add", "TAG", an_instance_of(String))
115
+ @script.options ["file.rb"]
116
+ end
117
+
118
+ it "sets the mode to :add and sets the tag to TAG" do
119
+ ["-N", "--add"].each do |opt|
120
+ @config[:tagger] = nil
121
+ @config[:tag] = nil
122
+ @script.options [opt, "taggit", "file.rb"]
123
+ @config[:tagger].should == :add
124
+ @config[:tag].should == "taggit:"
125
+ end
126
+ end
127
+ end
128
+
129
+ describe "-R, --del TAG" do
130
+ it "is enabled with #options" do
131
+ @options.stub!(:on)
132
+ @options.should_receive(:on).with("-R", "--del", "TAG",
133
+ an_instance_of(String))
134
+ @script.options ["file.rb"]
135
+ end
136
+
137
+ it "it sets the mode to :del, the tag to TAG, and the outcome to :pass" do
138
+ ["-R", "--del"].each do |opt|
139
+ @config[:tagger] = nil
140
+ @config[:tag] = nil
141
+ @config[:outcome] = nil
142
+ @script.options [opt, "taggit", "file.rb"]
143
+ @config[:tagger].should == :del
144
+ @config[:tag].should == "taggit:"
145
+ @config[:outcome].should == :pass
146
+ end
147
+ end
148
+ end
149
+
150
+ describe "-Q, --pass" do
151
+ it "is enabled with #options" do
152
+ @options.stub!(:on)
153
+ @options.should_receive(:on).with("-Q", "--pass", an_instance_of(String))
154
+ @script.options ["file.rb"]
155
+ end
156
+
157
+ it "sets the outcome to :pass" do
158
+ ["-Q", "--pass"].each do |opt|
159
+ @config[:outcome] = nil
160
+ @script.options [opt, "file.rb"]
161
+ @config[:outcome].should == :pass
162
+ end
163
+ end
164
+ end
165
+
166
+ describe "-F, --fail" do
167
+ it "is enabled with #options" do
168
+ @options.stub!(:on)
169
+ @options.should_receive(:on).with("-F", "--fail", an_instance_of(String))
170
+ @script.options ["file.rb"]
171
+ end
172
+
173
+ it "sets the outcome to :fail" do
174
+ ["-F", "--fail"].each do |opt|
175
+ @config[:outcome] = nil
176
+ @script.options [opt, "file.rb"]
177
+ @config[:outcome].should == :fail
178
+ end
179
+ end
180
+ end
181
+
182
+ describe "-L, --all" do
183
+ it "is enabled with #options" do
184
+ @options.stub!(:on)
185
+ @options.should_receive(:on).with("-L", "--all", an_instance_of(String))
186
+ @script.options ["file.rb"]
187
+ end
188
+
189
+ it "sets the outcome to :all" do
190
+ ["-L", "--all"].each do |opt|
191
+ @config[:outcome] = nil
192
+ @script.options [opt, "file.rb"]
193
+ @config[:outcome].should == :all
194
+ end
195
+ end
196
+ end
197
+
198
+ describe "--list TAG" do
199
+ it "is enabled with #options" do
200
+ @options.stub!(:on)
201
+ @options.should_receive(:on).with("--list", "TAG", an_instance_of(String))
202
+ @script.options ["file.rb"]
203
+ end
204
+
205
+ it "sets the mode to :list" do
206
+ @config[:tagger] = nil
207
+ @script.options ["--list", "TAG", "file.rb"]
208
+ @config[:tagger].should == :list
209
+ end
210
+
211
+ it "sets ltags to include TAG" do
212
+ @config[:tag] = nil
213
+ @script.options ["--list", "TAG", "file.rb"]
214
+ @config[:ltags].should == ["TAG"]
215
+ end
216
+ end
217
+
218
+ describe "--list-all" do
219
+ it "is enabled with #options" do
220
+ @options.stub!(:on)
221
+ @options.should_receive(:on).with("--list-all", an_instance_of(String))
222
+ @script.options ["file.rb"]
223
+ end
224
+
225
+ it "sets the mode to :list_all" do
226
+ @config[:tagger] = nil
227
+ @script.options ["--list-all", "file.rb"]
228
+ @config[:tagger].should == :list_all
229
+ end
230
+ end
231
+ end
232
+
84
233
  describe MSpecTag, "#run" do
85
234
  before :each do
86
235
  MSpec.stub!(:process)
@@ -124,3 +273,87 @@ describe MSpecTag, "#run" do
124
273
  @script.run
125
274
  end
126
275
  end
276
+
277
+ describe MSpecTag, "#register" do
278
+ before :each do
279
+ @script = MSpecTag.new
280
+ @config = @script.config
281
+ @config[:tag] = "fake:"
282
+ @config[:atags] = []
283
+ @config[:astrings] = []
284
+ @config[:ltags] = ["fails", "unstable"]
285
+
286
+ @t = mock("TagAction")
287
+ @t.stub!(:register)
288
+
289
+ @tl = mock("TagListAction")
290
+ @tl.stub!(:register)
291
+ end
292
+
293
+ it "creates a TagAction if config[:tagger] is :add" do
294
+ TagAction.should_receive(:new).with(:add, :fail, "fake", nil, [], []).and_return(@t)
295
+ @script.register
296
+ end
297
+
298
+ it "creates a TagAction if config[:tagger] is :del" do
299
+ @config[:tagger] = :del
300
+ @config[:outcome] = :pass
301
+ TagAction.should_receive(:new).with(:del, :pass, "fake", nil, [], []).and_return(@t)
302
+ @script.register
303
+ end
304
+
305
+ it "calls #register on the TagAction instance" do
306
+ TagAction.should_receive(:new).and_return(@t)
307
+ @t.should_receive(:register)
308
+ @script.register
309
+ end
310
+
311
+ it "raises an ArgumentError if no recognized action is given" do
312
+ @config[:tagger] = :totally_whack
313
+ lambda { @script.register }.should raise_error(ArgumentError)
314
+ end
315
+
316
+ describe "when config[:tagger] is :list" do
317
+ before :each do
318
+ @config[:tagger] = :list
319
+ end
320
+
321
+ it "creates a TagListAction" do
322
+ TagListAction.should_receive(:new).with(@config[:ltags]).and_return(@tl)
323
+ @tl.should_receive(:register)
324
+ @script.register
325
+ end
326
+
327
+ it "registers MSpec pretend mode" do
328
+ MSpec.should_receive(:register_mode).with(:pretend)
329
+ @script.register
330
+ end
331
+
332
+ it "sets config[:formatter] to nil" do
333
+ @script.register
334
+ @config[:formatter].should be_nil
335
+ end
336
+ end
337
+
338
+ describe "when config[:tagger] is :list_all" do
339
+ before :each do
340
+ @config[:tagger] = :list_all
341
+ end
342
+
343
+ it "creates a TagListAction" do
344
+ TagListAction.should_receive(:new).with(nil).and_return(@tl)
345
+ @tl.should_receive(:register)
346
+ @script.register
347
+ end
348
+
349
+ it "registers MSpec pretend mode" do
350
+ MSpec.should_receive(:register_mode).with(:pretend)
351
+ @script.register
352
+ end
353
+
354
+ it "sets config[:formatter] to nil" do
355
+ @script.register
356
+ @config[:formatter].should be_nil
357
+ end
358
+ end
359
+ end