Skip to content

Commit fdf2860

Browse files
committed
Make config methods more flexible.
1 parent 3c983e0 commit fdf2860

3 files changed

Lines changed: 30 additions & 13 deletions

File tree

HISTORY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 0.7.0 / 2013-02-18
44

55
Version 0.7 is a significant release. The library has been simplified
6-
by spinning-off the both the command-line tool and the Rake task as
6+
by spinning-off both the command-line tool and the Rake task as
77
`rubytest-cli` and `rubytest-rake` respectively. This was done for a
88
couple of good reasons: a) It focuses the the library on it's core
99
functionality and b) and it makes the library suitable for becoming

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ to the configuration options of the `Test.run/Test.configure` API. Use
9494

9595
If you are using a build tool to run your tests, such as Rake or Ergo, shelling
9696
out to `rubytest` is a good way to go as it keeps your test environment as
97-
prestine as possible, e.g.
97+
pristine as possible, e.g.
9898

9999
desc "run tests"
100100
task :test
@@ -105,7 +105,7 @@ prestine as possible, e.g.
105105

106106
There is also a Rake plug-in that can be installed called `rubytest-rake`.
107107
Surf over to its [webpage](http://rubyworks.github.com/rubytest-rake) for details.
108-
A basic example in its case, add to one's Rakefile:
108+
A basic example in its case, add to ones Rakefile:
109109

110110
require 'rubytest/rake'
111111

lib/rubytest/config.rb

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def suite=(test_objects)
145145
# List of test files to run.
146146
#
147147
# @return [Array<String>]
148-
def files
148+
def files(*list)
149+
@files.concat(makelist(list)) unless list.empty?
149150
@files
150151
end
151152
alias test_files files
@@ -175,19 +176,27 @@ def autopath=(boolean)
175176
# Paths to add to $LOAD_PATH.
176177
#
177178
# @return [Array<String>]
178-
attr :loadpath
179+
def loadpath(*list)
180+
@loadpath.concat(makelist(list)) unless list.empty?
181+
@loadpath
182+
end
183+
alias :load_path :loadpath
179184

180185
# Set paths to add to $LOAD_PATH.
181186
#
182187
# @return [Array<String>]
183188
def loadpath=(list)
184189
@loadpath = makelist(list)
185190
end
191+
alias :load_path= :loadpath=
186192

187193
# Scripts to require prior to tests.
188194
#
189195
# @return [Array<String>]
190-
attr :requires
196+
def requires(*list)
197+
@requires.concat(makelist(list)) unless list.empty?
198+
@requires
199+
end
191200

192201
# Set the features that need to be required before the
193202
# test files.
@@ -200,15 +209,19 @@ def requires=(list)
200209
# Name of test report format, by default it is `dotprogress`.
201210
#
202211
# @return [String] format
203-
def format
212+
def format(name=nil)
213+
@format = name.to_s if name
204214
@format || DEFAULT_FORMAT
205215
end
206216

207217
# Set test report format.
208218
#
219+
# @param [String] name
220+
# Name of the report format.
221+
#
209222
# @return [String] format
210-
def format=(format)
211-
@format = format.to_s
223+
def format=(name)
224+
@format = name.to_s
212225
end
213226

214227
# Provide extra details in reports?
@@ -228,7 +241,8 @@ def verbose=(boolean)
228241
# Selection of tags for filtering tests.
229242
#
230243
# @return [Array<String>]
231-
def tags
244+
def tags(*list)
245+
@tags.concat(makelist(list)) unless list.empty?
232246
@tags
233247
end
234248

@@ -242,7 +256,8 @@ def tags=(list)
242256
# Description match for filtering tests.
243257
#
244258
# @return [Array<String>]
245-
def match
259+
def match(*list)
260+
@match.concat(makelist(list)) unless list.empty?
246261
@match
247262
end
248263

@@ -257,7 +272,8 @@ def match=(list)
257272
# which are matched against module, class and method names.
258273
#
259274
# @return [Array<String>]
260-
def units
275+
def units(*list)
276+
@units.concat(makelist(list)) unless list.empty?
261277
@units
262278
end
263279

@@ -286,7 +302,8 @@ def hard=(boolean)
286302
# Change to this directory before running tests.
287303
#
288304
# @return [String]
289-
def chdir
305+
def chdir(dir=nil)
306+
@chdir = dir.to_s if dir
290307
@chdir
291308
end
292309

0 commit comments

Comments
 (0)