baretest 0.2.4 → 0.4.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +6 -6
- data/MANIFEST.txt +40 -18
- data/README.rdoc +8 -1
- data/bin/baretest +126 -118
- data/doc/baretest.rdoc +1 -1
- data/doc/mocking_stubbing_test_doubles.rdoc +31 -3
- data/doc/news/news-0.3.0.rdoc +7 -0
- data/doc/quickref.rdoc +74 -28
- data/doc/whats_going_on.rdoc +5 -0
- data/doc/writing_tests.rdoc +25 -13
- data/examples/components/rack-test.rb +17 -0
- data/examples/{tests/irb_mode → irb_mode}/failures.rb +0 -0
- data/examples/rake/test.rake +40 -0
- data/examples/tests/01_basics_I.rb +34 -0
- data/examples/tests/02_basics_II_helpers.rb +25 -0
- data/examples/tests/03_basics_III_setup_and_teardown.rb +53 -0
- data/examples/tests/04_advanced_I_dependencies.rb +31 -0
- data/examples/tests/05_advanced_II_tags.rb +12 -0
- data/examples/tests/06_advanced_III_requires.rb +21 -0
- data/examples/tests/07_advanced_IV_components.rb +48 -0
- data/examples/tests/08_expert_I_setup_variants.rb +46 -0
- data/lib/baretest.rb +142 -21
- data/lib/baretest/assertion.rb +83 -92
- data/lib/baretest/assertion/context.rb +9 -0
- data/lib/baretest/assertion/support.rb +88 -61
- data/lib/baretest/commandline.rb +268 -0
- data/lib/baretest/formatter.rb +58 -0
- data/lib/baretest/invalidselectors.rb +24 -0
- data/lib/baretest/irb_mode.rb +100 -58
- data/lib/baretest/persistence.rb +94 -0
- data/lib/baretest/run.rb +138 -37
- data/lib/baretest/run/cli.rb +97 -43
- data/lib/baretest/run/minimal.rb +2 -1
- data/lib/baretest/run/none.rb +21 -0
- data/lib/baretest/run/xml.rb +21 -19
- data/lib/baretest/setup.rb +2 -0
- data/lib/baretest/status.rb +93 -0
- data/lib/baretest/suite.rb +185 -59
- data/lib/baretest/uid.rb +51 -0
- data/lib/baretest/use/mocha.rb +24 -0
- data/lib/baretest/use/rack_test.rb +9 -0
- data/lib/baretest/use/rr.rb +17 -0
- data/lib/baretest/version.rb +18 -4
- data/lib/command.rb +36 -0
- data/lib/command/argument.rb +11 -0
- data/lib/command/decoratinghash.rb +31 -0
- data/lib/command/definition.rb +294 -0
- data/lib/command/directorynotfounderror.rb +11 -0
- data/lib/command/env.rb +11 -0
- data/lib/command/filenotfounderror.rb +11 -0
- data/lib/command/kernel.rb +14 -0
- data/lib/command/nodirectoryerror.rb +11 -0
- data/lib/command/nofileerror.rb +11 -0
- data/lib/command/option.rb +16 -0
- data/lib/command/parser.rb +145 -0
- data/lib/command/result.rb +11 -0
- data/lib/command/types.rb +33 -0
- data/lib/command/version.rb +28 -0
- data/test/setup.rb +3 -0
- data/test/suite/lib/baretest.rb +0 -178
- data/test/suite/lib/baretest/assertion.rb +133 -112
- data/test/suite/lib/baretest/assertion/context.rb +40 -0
- data/test/suite/lib/baretest/assertion/failure.rb +19 -0
- data/test/suite/lib/baretest/assertion/skip.rb +19 -0
- data/test/suite/lib/baretest/assertion/support.rb +366 -84
- data/test/suite/lib/baretest/run.rb +114 -15
- data/test/suite/lib/baretest/suite.rb +70 -29
- metadata +46 -24
- data/examples/test.rake +0 -65
- data/examples/tests/mock_developer/test/helper/mocks.rb +0 -0
- data/examples/tests/mock_developer/test/setup.rb +0 -57
- data/examples/tests/mock_developer/test/suite/mock_demo.rb +0 -19
- data/examples/tests/overview/test.rb +0 -89
- data/examples/tests/variations/variations_01.rb +0 -14
- data/examples/tests/variations/variations_02.rb +0 -19
- data/examples/tests/variations/variations_03.rb +0 -19
- data/lib/baretest/mocha.rb +0 -18
- data/lib/baretest/rr.rb +0 -16
- data/lib/baretest/run/errors.rb +0 -49
- data/lib/baretest/skipped.rb +0 -15
- data/lib/baretest/skipped/assertion.rb +0 -20
- data/lib/baretest/skipped/suite.rb +0 -49
- data/test/external/bootstraptest.rb +0 -5
- data/test/external/bootstrapwrap.rb +0 -2
- data/test/helper/mocks.rb +0 -0
data/LICENSE.txt
CHANGED
@@ -11,14 +11,14 @@ below (also known as the 'Ruby License'):
|
|
11
11
|
|
12
12
|
a) place your modifications in the Public Domain or otherwise
|
13
13
|
make them Freely Available, such as by posting said
|
14
|
-
|
15
|
-
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
16
|
|
17
17
|
b) use the modified software only within your corporation or
|
18
18
|
organization.
|
19
19
|
|
20
20
|
c) rename any non-standard executables so the names do not conflict
|
21
|
-
|
21
|
+
with standard executables, which must also be provided.
|
22
22
|
|
23
23
|
d) make other distribution arrangements with the author.
|
24
24
|
|
@@ -26,11 +26,11 @@ below (also known as the 'Ruby License'):
|
|
26
26
|
form, provided that you do at least ONE of the following:
|
27
27
|
|
28
28
|
a) distribute the executables and library files of the software,
|
29
|
-
|
30
|
-
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
31
|
|
32
32
|
b) accompany the distribution with the machine-readable source of
|
33
|
-
|
33
|
+
the software.
|
34
34
|
|
35
35
|
c) give non-standard executables non-standard names, with
|
36
36
|
instructions on where to get the original software distribution.
|
data/MANIFEST.txt
CHANGED
@@ -4,49 +4,71 @@ README.rdoc
|
|
4
4
|
bin/baretest
|
5
5
|
doc/baretest.rdoc
|
6
6
|
doc/mocking_stubbing_test_doubles.rdoc
|
7
|
+
doc/news/news-0.3.0.rdoc
|
7
8
|
doc/quickref.rdoc
|
8
9
|
doc/whats_going_on.rdoc
|
9
10
|
doc/writing_tests.rdoc
|
10
|
-
examples/test.
|
11
|
-
examples/
|
12
|
-
examples/
|
13
|
-
examples/tests/
|
14
|
-
examples/tests/
|
15
|
-
examples/tests/
|
16
|
-
examples/tests/
|
17
|
-
examples/tests/
|
18
|
-
examples/tests/
|
11
|
+
examples/components/rack-test.rb
|
12
|
+
examples/irb_mode/failures.rb
|
13
|
+
examples/rake/test.rake
|
14
|
+
examples/tests/01_basics_I.rb
|
15
|
+
examples/tests/02_basics_II_helpers.rb
|
16
|
+
examples/tests/03_basics_III_setup_and_teardown.rb
|
17
|
+
examples/tests/04_advanced_I_dependencies.rb
|
18
|
+
examples/tests/05_advanced_II_tags.rb
|
19
|
+
examples/tests/06_advanced_III_requires.rb
|
20
|
+
examples/tests/07_advanced_IV_components.rb
|
21
|
+
examples/tests/08_expert_I_setup_variants.rb
|
19
22
|
lib/baretest.rb
|
20
23
|
lib/baretest/assertion.rb
|
21
24
|
lib/baretest/assertion/context.rb
|
22
25
|
lib/baretest/assertion/failure.rb
|
23
26
|
lib/baretest/assertion/skip.rb
|
24
27
|
lib/baretest/assertion/support.rb
|
28
|
+
lib/baretest/commandline.rb
|
29
|
+
lib/baretest/formatter.rb
|
30
|
+
lib/baretest/invalidselectors.rb
|
25
31
|
lib/baretest/irb_mode.rb
|
26
32
|
lib/baretest/layout.rb
|
27
|
-
lib/baretest/
|
28
|
-
lib/baretest/rr.rb
|
33
|
+
lib/baretest/persistence.rb
|
29
34
|
lib/baretest/run.rb
|
30
35
|
lib/baretest/run/cli.rb
|
31
|
-
lib/baretest/run/errors.rb
|
32
36
|
lib/baretest/run/minimal.rb
|
37
|
+
lib/baretest/run/none.rb
|
33
38
|
lib/baretest/run/profile.rb
|
34
39
|
lib/baretest/run/spec.rb
|
35
40
|
lib/baretest/run/tap.rb
|
36
41
|
lib/baretest/run/xml.rb
|
37
42
|
lib/baretest/setup.rb
|
38
|
-
lib/baretest/
|
39
|
-
lib/baretest/skipped/assertion.rb
|
40
|
-
lib/baretest/skipped/suite.rb
|
43
|
+
lib/baretest/status.rb
|
41
44
|
lib/baretest/suite.rb
|
45
|
+
lib/baretest/uid.rb
|
46
|
+
lib/baretest/use/mocha.rb
|
47
|
+
lib/baretest/use/rack_test.rb
|
48
|
+
lib/baretest/use/rr.rb
|
42
49
|
lib/baretest/version.rb
|
50
|
+
lib/command.rb
|
51
|
+
lib/command/argument.rb
|
52
|
+
lib/command/decoratinghash.rb
|
53
|
+
lib/command/definition.rb
|
54
|
+
lib/command/directorynotfounderror.rb
|
55
|
+
lib/command/env.rb
|
56
|
+
lib/command/filenotfounderror.rb
|
57
|
+
lib/command/kernel.rb
|
58
|
+
lib/command/nodirectoryerror.rb
|
59
|
+
lib/command/nofileerror.rb
|
60
|
+
lib/command/option.rb
|
61
|
+
lib/command/parser.rb
|
62
|
+
lib/command/result.rb
|
63
|
+
lib/command/types.rb
|
64
|
+
lib/command/version.rb
|
43
65
|
lib/ruby/kernel.rb
|
44
|
-
test/external/bootstraptest.rb
|
45
|
-
test/external/bootstrapwrap.rb
|
46
|
-
test/helper/mocks.rb
|
47
66
|
test/setup.rb
|
48
67
|
test/suite/lib/baretest.rb
|
49
68
|
test/suite/lib/baretest/assertion.rb
|
69
|
+
test/suite/lib/baretest/assertion/context.rb
|
70
|
+
test/suite/lib/baretest/assertion/failure.rb
|
71
|
+
test/suite/lib/baretest/assertion/skip.rb
|
50
72
|
test/suite/lib/baretest/assertion/support.rb
|
51
73
|
test/suite/lib/baretest/irb_mode.rb
|
52
74
|
test/suite/lib/baretest/run.rb
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= BareTest
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
A testframework that doesn't stand in your way or forces you to learn a new
|
8
8
|
language. Two methods is all that is required to know.
|
9
|
+
If you need it, it provides you with all kinds of features to support you
|
10
|
+
writing your tests.
|
9
11
|
|
10
12
|
|
11
13
|
|
@@ -70,6 +72,11 @@ To get baretest edge, use:
|
|
70
72
|
2. Change into the baretest directory: `cd the/baretest/directory`
|
71
73
|
3. Run the installation task: `rake gem:install` (alternatively `rake install:lib`)
|
72
74
|
|
75
|
+
IMPORTANT: if the gem:install task fails, it might be because I forgot to update
|
76
|
+
the MANIFEST.txt. Simply delete MANIFEST.txt, then run `rake manifest:create`
|
77
|
+
and then retry `rake gem:install`.
|
78
|
+
Also notice that you should have the gems 'nokogiri' and 'rdoc' installed.
|
79
|
+
|
73
80
|
If you have multiple ruby versions installed parallely, this might pick the wrong gem
|
74
81
|
executable to install the gem. You can set the GEM env variable to ensure it uses the
|
75
82
|
right one: `rake gem:install GEM=gem1.9`
|
data/bin/baretest
CHANGED
@@ -8,143 +8,151 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
Version = "0.
|
11
|
+
Version = "0.4.0" # Executable version
|
12
12
|
|
13
|
+
# assume baretest is not installed and this is a cold-run from source
|
14
|
+
lib_dir = File.expand_path("#{__FILE__}/../../lib")
|
15
|
+
$LOAD_PATH.unshift(lib_dir) if File.directory?(lib_dir)
|
16
|
+
lib_dir = File.expand_path("#{__FILE__}/../../../command/lib")
|
17
|
+
$LOAD_PATH.unshift(lib_dir) if File.directory?(lib_dir)
|
13
18
|
|
14
19
|
|
15
|
-
require 'optparse'
|
16
|
-
begin
|
17
|
-
# if baretest is installed as a gem, the executable is be wrapped by rubgems anyway, so we don't
|
18
|
-
# need to require rubygems ourself.
|
19
|
-
require 'baretest'
|
20
|
-
rescue LoadError
|
21
|
-
# assume baretest is not installed and this is a cold-run from source
|
22
|
-
$LOAD_PATH.unshift(File.expand_path("#{__FILE__}/../../lib"))
|
23
|
-
require 'baretest'
|
24
|
-
end
|
25
20
|
|
21
|
+
require 'command'
|
22
|
+
require 'baretest'
|
26
23
|
|
27
24
|
|
28
|
-
# Get all the command-line arguments and adapt options to it
|
29
|
-
format = ENV['FORMAT'] || 'cli'
|
30
|
-
interactive = ['false', nil].include?(ENV['INTERACTIVE']) ? false : true
|
31
|
-
setup_path = nil
|
32
|
-
|
33
|
-
opts = OptionParser.new("", 24, ' ') do |opts|
|
34
|
-
opts.banner = "Usage: baretest [options] [glob, ...]"
|
35
|
-
|
36
|
-
opts.separator "Glob defaults to 'test/{suite,unit,integration,system}/**/*.rb'"
|
37
|
-
opts.separator "Providing a directory as glob is equivalent to dir/**/*.rb\n"
|
38
|
-
opts.separator "Options:"
|
39
|
-
|
40
|
-
opts.on(nil, "--init", "create the necessary directories and files") {
|
41
|
-
core = %w[
|
42
|
-
test
|
43
|
-
test/external
|
44
|
-
test/helper
|
45
|
-
test/helper/suite
|
46
|
-
test/suite
|
47
|
-
]
|
48
|
-
mirror = {
|
49
|
-
'bin' => %w[test/helper/suite test/suite],
|
50
|
-
'lib' => %w[test/helper/suite test/suite],
|
51
|
-
'rake' => %w[test/helper/suite test/suite],
|
52
|
-
}
|
53
|
-
files = {
|
54
|
-
'test/setup.rb' => <<-END_OF_SETUP.gsub(/^ {8}/, '')
|
55
|
-
$LOAD_PATH.unshift(File.expand_path("\#{__FILE__}/../../lib")) # Add PROJECT/lib to $LOAD_PATH
|
56
|
-
END_OF_SETUP
|
57
|
-
}
|
58
|
-
|
59
|
-
puts "Creating all directories and files needed in #{File.expand_path('.')}"
|
60
|
-
core.each do |dir|
|
61
|
-
if File.exist?(dir) then
|
62
|
-
puts "Directory #{dir} exists already -- skipping"
|
63
|
-
else
|
64
|
-
puts "Creating #{dir}"
|
65
|
-
Dir.mkdir(dir)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
mirror.each do |path, destinations|
|
69
|
-
if File.exist?(path) then
|
70
|
-
destinations.each do |destination|
|
71
|
-
destination = File.join(destination,path)
|
72
|
-
if File.exist?(destination) then
|
73
|
-
puts "Mirror #{destination} of #{path} exists already -- skipping"
|
74
|
-
else
|
75
|
-
puts "Mirroring #{path} in #{destination}"
|
76
|
-
Dir.mkdir(destination)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
files.each do |path, data|
|
82
|
-
if File.exist?(path) then
|
83
|
-
puts "File #{path} exists already -- skipping"
|
84
|
-
else
|
85
|
-
puts "Writing #{path}"
|
86
|
-
File.open(path, 'wb') do |fh|
|
87
|
-
fh.write(data)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
25
|
|
92
|
-
|
93
|
-
|
26
|
+
# Specify commands and options
|
27
|
+
Command "run" do
|
28
|
+
# global arguments
|
29
|
+
virtual_argument :command, '[command]', "The command to run. See `baretest commands`"
|
30
|
+
virtual_argument :options, '[options]', "The flags and options, see in the \"Options\" section."
|
94
31
|
|
95
|
-
|
96
|
-
|
97
|
-
|
32
|
+
# global options
|
33
|
+
o :commands, nil, '--commands', :Boolean, "overview over the commands"
|
34
|
+
o :help, '-h', '--help', :Boolean, "help for usage and flags"
|
35
|
+
o :version, '-v', '--version', :Boolean, "print the version and exit"
|
36
|
+
o :init, nil, '--init', "Deprecated form for `baretest --init`"
|
98
37
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
puts "- #{File.basename(path, '.rb')}"
|
103
|
-
}
|
104
|
-
exit
|
105
|
-
}
|
38
|
+
# specify the 'run' command, its default options, its options and helptext
|
39
|
+
command "run", :format => 'cli', :interactive => false, :verbose => false do
|
40
|
+
usage
|
106
41
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
42
|
+
virtual_argument :command
|
43
|
+
virtual_argument :options
|
44
|
+
virtual_argument :selector, '*(selector | -selector)', :String,
|
45
|
+
"The tests to run. Example:\n" \
|
46
|
+
" baretest -- test/suite/a -test/suite/a/x @tag -@other %failure -%pending\n" \
|
47
|
+
"Defaults to 'test/{suite,unit,integration,system}\n" \
|
48
|
+
"See `baretest selectors` to get more information"
|
111
49
|
|
112
|
-
|
113
|
-
interactive = true
|
114
|
-
}
|
50
|
+
text "\nDefault command is 'run', which runs the testsuite or the provided testfiles.\n\nOptions:\n"
|
115
51
|
|
116
|
-
|
117
|
-
|
118
|
-
|
52
|
+
o :commands
|
53
|
+
o :debug, '-d', '--debug', :Boolean, "set debugging flags (set $DEBUG to true)"
|
54
|
+
o :interactive, '-i', '--interactive', :Boolean, "drop into IRB on error or failure"
|
55
|
+
o :format, '-f', '--format FORMAT', :String, "use FORMAT for output, see `baretest formats`"
|
56
|
+
o :setup_file, '-s', '--setup FILE', :File, "specify setup file"
|
57
|
+
o :verbose, '-w', '--warn', :Boolean, "turn warnings on for your script"
|
58
|
+
o :help
|
59
|
+
o :version
|
60
|
+
o :init
|
119
61
|
|
120
|
-
|
121
|
-
puts "baretest executable version #{Version}, library version #{BareTest::VERSION}"
|
122
|
-
exit
|
123
|
-
}
|
62
|
+
text ""
|
124
63
|
|
125
|
-
|
126
|
-
$VERBOSE = true
|
127
|
-
}
|
64
|
+
placeholder :format_options
|
128
65
|
|
129
|
-
|
130
|
-
|
66
|
+
text "\nEnvironment variables:\n"
|
67
|
+
|
68
|
+
env_option :format, 'FORMAT'
|
69
|
+
env_option :verbose, 'VERBOSE'
|
70
|
+
env_option :interactive, 'INTERACTIVE'
|
71
|
+
end
|
72
|
+
|
73
|
+
command "init" do
|
74
|
+
usage
|
131
75
|
|
76
|
+
virtual_argument :command
|
77
|
+
virtual_argument :options
|
78
|
+
text "\n Create the necessary directories and files"
|
132
79
|
|
80
|
+
o :help
|
81
|
+
end
|
133
82
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
83
|
+
command "formats"
|
84
|
+
command "env"
|
85
|
+
command "version"
|
86
|
+
command "commands"
|
87
|
+
command "selectors"
|
88
|
+
command "help"
|
89
|
+
end
|
141
90
|
|
142
91
|
|
143
92
|
|
144
|
-
#
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
93
|
+
# Execute command
|
94
|
+
Command.with(ARGV) do
|
95
|
+
# parse out the command
|
96
|
+
command = command!
|
97
|
+
# parse all options we know about and leave alone those we don't
|
98
|
+
options = options! :ignore_invalid_options
|
99
|
+
|
100
|
+
# some options are equivalent to commands - if they are set, change the
|
101
|
+
# command
|
102
|
+
if set = [:help, :commands, :version].find { |flag| options[flag] } then
|
103
|
+
run_command = set.to_s
|
104
|
+
elsif options[:init]
|
105
|
+
abort "`#{$0} --init` is depreciated, please use `baretest init`."
|
106
|
+
else
|
107
|
+
run_command = command
|
108
|
+
end
|
109
|
+
if %w[run help].include?(command) then
|
110
|
+
formatter = BareTest::CommandLine.load_formatter(options[:format])
|
111
|
+
|
112
|
+
definition[command].content_for :format_options do |d|
|
113
|
+
if formatter.is_a?(BareTest::Formatter) then
|
114
|
+
d.default_options.update(formatter.command[:option_defaults]) do |k,v1,v2| v2 end
|
115
|
+
formatter.command[:elements].each do |key, args|
|
116
|
+
d.send(key, *args)
|
117
|
+
end
|
118
|
+
else
|
119
|
+
d.text "Formatter '#{options[:format]}' does not specify any custom options."
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
options = options! # reparse with new information
|
125
|
+
|
126
|
+
case run_command
|
127
|
+
when "run" # run the testsuite/-file
|
128
|
+
begin
|
129
|
+
success = BareTest::CommandLine.run(arguments, options)
|
130
|
+
rescue BareTest::InvalidSelectors => e
|
131
|
+
puts e
|
132
|
+
puts "Valid state selectors are: #{BareTest::ValidStateSelectors.join(', ')}"
|
133
|
+
success = false
|
134
|
+
end
|
135
|
+
exit(success ? 0 : 1)
|
136
|
+
when "init" # create the test directory
|
137
|
+
BareTest::CommandLine.init(arguments, options)
|
138
|
+
when "formats" # list available formats
|
139
|
+
BareTest::CommandLine.formats(arguments, options)
|
140
|
+
when "env" # show information about baretest (config, version, paths, ...)
|
141
|
+
BareTest::CommandLine.env(arguments, options)
|
142
|
+
when "version" # show version information about baretest
|
143
|
+
BareTest::CommandLine.version(arguments, options)
|
144
|
+
when "selectors" # show version information about selectors baretest recognizes
|
145
|
+
BareTest::CommandLine.selectors(arguments, options)
|
146
|
+
when "help"
|
147
|
+
if command == 'help' then
|
148
|
+
BareTest::CommandLine.help(arguments, options)
|
149
|
+
else
|
150
|
+
puts definition[command].usage_text
|
151
|
+
end
|
152
|
+
when "commands"
|
153
|
+
BareTest::CommandLine.commands(arguments, options)
|
154
|
+
else
|
155
|
+
puts "Unknown command '#{command}'"
|
156
|
+
BareTest::CommandLine.commands(arguments, options)
|
157
|
+
end
|
150
158
|
end
|
data/doc/baretest.rdoc
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Basic Usage:
|
8
8
|
|
9
|
-
baretest [options] [glob, ...]
|
9
|
+
baretest [options] [glob, ...]
|
10
10
|
|
11
11
|
Either you provide a `glob` (or a directory, which is equivalent to DIRECTORY/\*\*/\*.rb),
|
12
12
|
then baretest will load all the files it matches and invoke BareTest.run in the end. Or you
|
@@ -1,5 +1,33 @@
|
|
1
1
|
= Mocking, Stubbing and TestDoubles
|
2
2
|
|
3
|
-
BareTest off-the-shelf provides currently only integration with mocha.
|
4
|
-
|
5
|
-
|
3
|
+
BareTest off-the-shelf provides currently only integration with mocha and rr.
|
4
|
+
They are available as components.
|
5
|
+
Until baretest 0.5 is released (which will resolve the issue), you should not
|
6
|
+
use multiple different stubbing/mocking libraries within your tests, as they
|
7
|
+
might collide (define methods with the same name e.g.).
|
8
|
+
|
9
|
+
== Mocha
|
10
|
+
|
11
|
+
Example suite using mocha:
|
12
|
+
suite "Some suite using mocha", :use => :mocha do
|
13
|
+
setup do
|
14
|
+
...FIXME...
|
15
|
+
end
|
16
|
+
|
17
|
+
assert FIXME do
|
18
|
+
...FIXME...
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
== RR
|
23
|
+
|
24
|
+
Example suite using rr:
|
25
|
+
suite "Some suite using rr", :use => :rr do
|
26
|
+
setup do
|
27
|
+
...FIXME...
|
28
|
+
end
|
29
|
+
|
30
|
+
assert FIXME do
|
31
|
+
...FIXME...
|
32
|
+
end
|
33
|
+
end
|