mspec 1.5.17 → 1.5.18
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +27 -0
- data/Gemfile +4 -0
- data/README +39 -159
- data/Rakefile +4 -44
- data/bin/mkspec.bat +1 -0
- data/bin/mspec-ci.bat +1 -0
- data/bin/mspec-run.bat +1 -0
- data/bin/mspec-tag.bat +1 -0
- data/bin/mspec.bat +1 -0
- data/lib/mspec/commands/mkspec.rb +2 -2
- data/lib/mspec/commands/mspec-run.rb +4 -0
- data/lib/mspec/commands/mspec.rb +18 -3
- data/lib/mspec/guards.rb +1 -0
- data/lib/mspec/guards/block_device.rb +22 -0
- data/lib/mspec/guards/guard.rb +14 -2
- data/lib/mspec/helpers.rb +5 -5
- data/lib/mspec/helpers/const_lookup.rb +6 -1
- data/lib/mspec/helpers/datetime.rb +28 -0
- data/lib/mspec/helpers/ducktype.rb +4 -4
- data/lib/mspec/helpers/environment.rb +19 -2
- data/lib/mspec/helpers/fs.rb +5 -1
- data/lib/mspec/helpers/io.rb +39 -1
- data/lib/mspec/helpers/numeric.rb +89 -0
- data/lib/mspec/helpers/pack.rb +3 -0
- data/lib/mspec/helpers/ruby_exe.rb +53 -15
- data/lib/mspec/helpers/singleton_class.rb +7 -0
- data/lib/mspec/helpers/stasy.rb +33 -0
- data/lib/mspec/helpers/tmp.rb +16 -3
- data/lib/mspec/matchers.rb +8 -0
- data/lib/mspec/matchers/be_computed_by.rb +37 -0
- data/lib/mspec/matchers/be_computed_by_function.rb +35 -0
- data/lib/mspec/matchers/be_nan.rb +20 -0
- data/lib/mspec/matchers/be_valid_dns_name.rb +25 -0
- data/lib/mspec/matchers/have_data.rb +6 -5
- data/lib/mspec/matchers/have_private_method.rb +24 -0
- data/lib/mspec/matchers/have_singleton_method.rb +24 -0
- data/lib/mspec/matchers/infinity.rb +28 -0
- data/lib/mspec/matchers/match_yaml.rb +5 -5
- data/lib/mspec/matchers/raise_error.rb +5 -3
- data/lib/mspec/matchers/signed_zero.rb +28 -0
- data/lib/mspec/mocks/mock.rb +15 -9
- data/lib/mspec/mocks/object.rb +4 -0
- data/lib/mspec/mocks/proxy.rb +26 -1
- data/lib/mspec/runner/actions.rb +0 -1
- data/lib/mspec/runner/context.rb +18 -16
- data/lib/mspec/runner/formatters.rb +2 -0
- data/lib/mspec/runner/formatters/dotted.rb +13 -1
- data/lib/mspec/runner/formatters/junit.rb +96 -0
- data/lib/mspec/runner/formatters/profile.rb +70 -0
- data/lib/mspec/runner/mspec.rb +11 -0
- data/lib/mspec/runner/shared.rb +1 -1
- data/lib/mspec/utils/options.rb +33 -9
- data/lib/mspec/utils/ruby_name.rb +1 -1
- data/lib/mspec/utils/script.rb +2 -1
- data/lib/mspec/version.rb +1 -1
- data/mspec.gemspec +40 -0
- data/spec/commands/mkspec_spec.rb +4 -3
- data/spec/commands/mspec_ci_spec.rb +1 -6
- data/spec/commands/mspec_run_spec.rb +1 -6
- data/spec/commands/mspec_spec.rb +14 -6
- data/spec/commands/mspec_tag_spec.rb +28 -27
- data/spec/expectations/expectations_spec.rb +1 -1
- data/spec/expectations/should_spec.rb +4 -4
- data/spec/guards/background_spec.rb +2 -2
- data/spec/guards/block_device_spec.rb +46 -0
- data/spec/guards/bug_spec.rb +2 -3
- data/spec/guards/compliance_spec.rb +2 -2
- data/spec/guards/conflict_spec.rb +2 -2
- data/spec/guards/endian_spec.rb +2 -2
- data/spec/guards/extensions_spec.rb +2 -2
- data/spec/guards/feature_spec.rb +2 -2
- data/spec/guards/guard_spec.rb +80 -22
- data/spec/guards/noncompliance_spec.rb +2 -2
- data/spec/guards/platform_spec.rb +2 -2
- data/spec/guards/quarantine_spec.rb +2 -2
- data/spec/guards/runner_spec.rb +2 -2
- data/spec/guards/specified_spec.rb +2 -2
- data/spec/guards/superuser_spec.rb +2 -2
- data/spec/guards/support_spec.rb +2 -2
- data/spec/guards/tty_spec.rb +2 -2
- data/spec/guards/user_spec.rb +2 -2
- data/spec/guards/version_spec.rb +2 -2
- data/spec/helpers/argv_spec.rb +3 -2
- data/spec/helpers/const_lookup_spec.rb +3 -2
- data/spec/helpers/datetime_spec.rb +44 -0
- data/spec/helpers/ducktype_spec.rb +3 -2
- data/spec/helpers/encode_spec.rb +3 -2
- data/spec/helpers/enumerator_class_spec.rb +5 -5
- data/spec/helpers/environment_spec.rb +15 -3
- data/spec/helpers/fixture_spec.rb +3 -2
- data/spec/helpers/flunk_spec.rb +4 -3
- data/spec/helpers/fs_spec.rb +35 -18
- data/spec/helpers/hash_spec.rb +3 -2
- data/spec/helpers/io_spec.rb +75 -6
- data/spec/helpers/language_version_spec.rb +3 -2
- data/spec/helpers/mock_to_path_spec.rb +3 -2
- data/spec/helpers/numeric_spec.rb +25 -0
- data/spec/helpers/ruby_exe_spec.rb +115 -29
- data/spec/helpers/scratch_spec.rb +3 -1
- data/spec/helpers/stasy_spec.rb +59 -0
- data/spec/helpers/tmp_spec.rb +21 -4
- data/spec/matchers/base_spec.rb +2 -2
- data/spec/matchers/be_an_instance_of_spec.rb +2 -2
- data/spec/matchers/be_ancestor_of_spec.rb +2 -2
- data/spec/matchers/be_close_spec.rb +2 -2
- data/spec/matchers/be_computed_by_function_spec.rb +36 -0
- data/spec/matchers/be_computed_by_spec.rb +42 -0
- data/spec/matchers/be_empty_spec.rb +2 -2
- data/spec/matchers/be_false_spec.rb +3 -3
- data/spec/matchers/be_kind_of_spec.rb +2 -2
- data/spec/matchers/be_nan_spec.rb +28 -0
- data/spec/matchers/be_nil_spec.rb +3 -3
- data/spec/matchers/be_true_spec.rb +3 -3
- data/spec/matchers/be_valid_dns_name_spec.rb +50 -0
- data/spec/matchers/complain_spec.rb +2 -2
- data/spec/matchers/eql_spec.rb +2 -2
- data/spec/matchers/equal_element_spec.rb +2 -2
- data/spec/matchers/equal_spec.rb +2 -2
- data/spec/matchers/equal_utf16_spec.rb +2 -2
- data/spec/matchers/have_class_variable_spec.rb +3 -3
- data/spec/matchers/have_constant_spec.rb +2 -2
- data/spec/matchers/have_data_spec.rb +8 -5
- data/spec/matchers/have_instance_method_spec.rb +2 -2
- data/spec/matchers/have_instance_variable_spec.rb +3 -3
- data/spec/matchers/have_method_spec.rb +2 -2
- data/spec/matchers/have_private_instance_method_spec.rb +3 -3
- data/spec/matchers/have_private_method_spec.rb +44 -0
- data/spec/matchers/have_protected_instance_method_spec.rb +2 -2
- data/spec/matchers/have_public_instance_method_spec.rb +2 -2
- data/spec/matchers/have_singleton_method_spec.rb +45 -0
- data/spec/matchers/include_spec.rb +2 -2
- data/spec/matchers/infinity_spec.rb +34 -0
- data/spec/matchers/match_yaml_spec.rb +3 -3
- data/spec/matchers/output_spec.rb +2 -2
- data/spec/matchers/output_to_fd_spec.rb +2 -2
- data/spec/matchers/raise_error_spec.rb +24 -3
- data/spec/matchers/respond_to_spec.rb +2 -2
- data/spec/matchers/signed_zero_spec.rb +32 -0
- data/spec/matchers/stringsymboladapter_spec.rb +2 -2
- data/spec/mocks/mock_spec.rb +12 -12
- data/spec/mocks/proxy_spec.rb +1 -1
- data/spec/runner/actions/gdb_spec.rb +1 -1
- data/spec/runner/actions/tag_spec.rb +1 -1
- data/spec/runner/actions/taglist_spec.rb +1 -1
- data/spec/runner/context_spec.rb +27 -27
- data/spec/runner/example_spec.rb +1 -1
- data/spec/runner/exception_spec.rb +1 -1
- data/spec/runner/filters/tag_spec.rb +2 -2
- data/spec/runner/formatters/describe_spec.rb +1 -1
- data/spec/runner/formatters/dotted_spec.rb +2 -2
- data/spec/runner/formatters/html_spec.rb +2 -2
- data/spec/runner/formatters/junit_spec.rb +147 -0
- data/spec/runner/formatters/unit_spec.rb +2 -2
- data/spec/runner/formatters/yaml_spec.rb +3 -3
- data/spec/runner/mspec_spec.rb +22 -21
- data/spec/runner/shared_spec.rb +9 -1
- data/spec/runner/tag_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -7
- data/spec/utils/name_map_spec.rb +1 -2
- data/spec/utils/options_spec.rb +58 -27
- data/spec/utils/script_spec.rb +5 -13
- data/spec/utils/version_spec.rb +1 -1
- metadata +254 -64
- data/lib/mspec/helpers/bignum.rb +0 -5
- data/lib/mspec/helpers/fmode.rb +0 -15
- data/lib/mspec/helpers/infinity.rb +0 -5
- data/lib/mspec/helpers/metaclass.rb +0 -7
- data/lib/mspec/helpers/nan.rb +0 -5
- data/lib/mspec/runner/actions/debug.rb +0 -17
- data/spec/helpers/bignum_spec.rb +0 -11
- data/spec/helpers/fmode_spec.rb +0 -14
- data/spec/helpers/infinity_spec.rb +0 -8
- data/spec/helpers/nan_spec.rb +0 -8
- data/spec/runner/actions/debug_spec.rb +0 -62
data/.gitignore
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
pkg
|
2
|
+
*.rbc
|
3
|
+
*.iml
|
4
|
+
*.iws
|
5
|
+
*.ipr
|
6
|
+
*.sw?
|
7
|
+
|
8
|
+
.rbx
|
9
|
+
|
10
|
+
# ctags dir
|
11
|
+
/tags
|
12
|
+
|
13
|
+
*.gem
|
14
|
+
.bundle
|
15
|
+
.config
|
16
|
+
.yardoc
|
17
|
+
Gemfile.lock
|
18
|
+
InstalledFiles
|
19
|
+
_yardoc
|
20
|
+
coverage
|
21
|
+
doc/
|
22
|
+
lib/bundler/man
|
23
|
+
rdoc
|
24
|
+
spec/reports
|
25
|
+
test/tmp
|
26
|
+
test/version_tmp
|
27
|
+
tmp
|
data/Gemfile
ADDED
data/README
CHANGED
@@ -1,197 +1,77 @@
|
|
1
|
-
|
1
|
+
1. Overview
|
2
2
|
|
3
3
|
MSpec is a specialized framework that is syntax-compatible with RSpec for
|
4
|
-
basic things like
|
4
|
+
basic things like 'describe', 'it' blocks and 'before', 'after' actions. MSpec
|
5
5
|
contains additional features that assist in writing the RubySpecs used by
|
6
6
|
multiple Ruby implementations.
|
7
7
|
|
8
8
|
MSpec attempts to use the simplest Ruby language features so that beginning
|
9
|
-
Ruby implementations can run the Ruby specs.
|
10
|
-
great concern given to constant clashes. Namespacing (or module scoping) is
|
11
|
-
not used because implementing this correctly took a significant amount of work
|
12
|
-
in Rubinius and it is likely that other implementations would also face
|
13
|
-
difficulties.
|
9
|
+
Ruby implementations can run the Ruby specs.
|
14
10
|
|
15
11
|
MSpec is not intended as a replacement for RSpec. MSpec attempts to provide a
|
16
12
|
subset of RSpec's features in some cases and a superset in others. It does not
|
17
|
-
provide all the matchers, for instance.
|
18
|
-
extensions to facilitate writing the Ruby specs in a manner compatible with
|
19
|
-
multiple Ruby implementations.
|
20
|
-
|
21
|
-
First, MSpec offers a set of guards to control execution of the specs. These
|
22
|
-
guards not only enable or disable execution but also annotate the specs with
|
23
|
-
additional information about why they are run or not run. Second, MSpec
|
24
|
-
provides a different shared spec implementation specifically designed to ease
|
25
|
-
writing specs for the numerous aliased methods in Ruby. The MSpec shared spec
|
26
|
-
implementation should not conflict with RSpec's own shared behavior facility.
|
27
|
-
Third, MSpec provides various helper methods to simplify some specs, for
|
28
|
-
example, creating temporary file names. Finally, MSpec has several specialized
|
29
|
-
runner scripts that includes a configuration facility with a default project
|
30
|
-
file and user-specific overrides.
|
31
|
-
|
32
|
-
Caveats:
|
33
|
-
|
34
|
-
* Use RSpec to run the MSpec specs. There are no plans currently to make
|
35
|
-
the MSpec specs runnable by MSpec.
|
36
|
-
* Don't mock the #hash method as MSpec's Mock implementation uses Hash
|
37
|
-
internally. This can be replaced if necessary, but at this point there is no
|
38
|
-
compelling need to do so.
|
39
|
-
|
40
|
-
|
41
|
-
== Architecture
|
42
|
-
|
43
|
-
|
44
|
-
== Matchers
|
45
|
-
|
46
|
-
Matchers are additional aids for the verification process. The default
|
47
|
-
is of course to #should or #should_not using the #== operator and its
|
48
|
-
friends but the matchers add a new set of 'operators' to help in the
|
49
|
-
task. They reside in `mspec/matchers/`. There are two broad categories,
|
50
|
-
those that apply to an individual object and those that apply to a
|
51
|
-
block:
|
52
|
-
|
53
|
-
=== Object
|
54
|
-
|
55
|
-
- `base` implements the standard #==, #< #<= #>= #> and #=~ with their
|
56
|
-
normal semantics for the objects that you invoke them on.
|
57
|
-
|
58
|
-
- `be_ancestor_of` is equivalent to checking `obj.ancestors.include?`.
|
59
|
-
|
60
|
-
- `be_close` is a "delta" for floating-point math. Due to the very
|
61
|
-
nature of it, floating-point comparisons should never be treated as
|
62
|
-
exact. By default the tolerance is 0.00003 but it can be altered if
|
63
|
-
so desired. So `0.23154.should be_close(0.23157)` would succeed
|
64
|
-
(which is usually close enough for floating point unless you are
|
65
|
-
doing some scientific computing.)
|
66
|
-
|
67
|
-
- `be_empty` checks `obj.empty?`
|
68
|
-
|
69
|
-
- `be_kind_of` is equivalent to `obj.kind_of?`
|
70
|
-
|
71
|
-
- `include` is `obj.include?`
|
72
|
-
|
73
|
-
=== Block
|
74
|
-
|
75
|
-
All of these should be applied to a block created with `lambda` or `proc`:
|
76
|
-
|
77
|
-
- `complain` is probably clearer stated as `lambda {...}.should complain`;
|
78
|
-
it checks that the block issues a warning. The message can be checked
|
79
|
-
against either a String or a Regexp.
|
80
|
-
|
81
|
-
- `output` checks that the block produces the given output (stdout as well
|
82
|
-
as stderr, in that order) matched either to a String or a Regexp. This one
|
83
|
-
uses overrides so if that is a problem (for e.g. speccing Readline or
|
84
|
-
something) see below.
|
85
|
-
|
86
|
-
- `output_to_fd` is a lower-level version and actually verifies that output
|
87
|
-
to a certain file descriptor is correct whether from an in-/output stream
|
88
|
-
or an actual file. Also can check with either a String or a Regexp.
|
13
|
+
provide all the matchers, for instance.
|
89
14
|
|
90
|
-
|
91
|
-
|
92
|
-
control (inheritance works normally so Exception would catch everything.)
|
15
|
+
However, MSpec provides several extensions to facilitate writing the Ruby
|
16
|
+
specs in a manner compatible with multiple Ruby implementations.
|
93
17
|
|
94
|
-
|
18
|
+
1. MSpec offers a set of guards to control execution of the specs. These
|
19
|
+
guards not only enable or disable execution but also annotate the specs
|
20
|
+
with additional information about why they are run or not run.
|
95
21
|
|
96
|
-
MSpec
|
97
|
-
|
98
|
-
|
22
|
+
2. MSpec provides a different shared spec implementation specifically
|
23
|
+
designed to ease writing specs for the numerous aliased methods in Ruby.
|
24
|
+
The MSpec shared spec implementation should not conflict with RSpec's own
|
25
|
+
shared behavior facility.
|
99
26
|
|
100
|
-
|
101
|
-
|
102
|
-
@obj = 1
|
103
|
-
end
|
27
|
+
3. MSpec provides various helper methods to simplify some specs, for
|
28
|
+
example, creating temporary file names.
|
104
29
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
30
|
+
4. MSpec has several specialized runner scripts that includes a
|
31
|
+
configuration facility with a default project file and user-specific
|
32
|
+
overrides.
|
109
33
|
|
110
|
-
it "returns false" do
|
111
|
-
# when this example is evaluated, @obj = 1 and @meth = :to_s
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
34
|
|
116
|
-
|
117
|
-
will be as follows:
|
35
|
+
2. Bundler
|
118
36
|
|
119
|
-
|
120
|
-
|
37
|
+
A Gemfile is provides. Use Bundler to install gem dependencies. To install
|
38
|
+
Bundler, run the following:
|
121
39
|
|
40
|
+
$ gem install bundler
|
122
41
|
|
123
|
-
|
42
|
+
To install the gem dependencies with Bundler, run the following:
|
124
43
|
|
125
|
-
|
126
|
-
convenience method to assist in writing specs for the numerous aliased methods
|
127
|
-
that Ruby provides. The following example illustrates shared blocks:
|
44
|
+
$ RUBYLIB=lib ruby -S bundle install
|
128
45
|
|
129
|
-
describe :someclass_some_method, :shared => true do
|
130
|
-
it "does something" do
|
131
|
-
end
|
132
|
-
end
|
133
46
|
|
134
|
-
|
135
|
-
it_should_behave_like "someclass_some_method"
|
136
|
-
end
|
47
|
+
3. Running Specs
|
137
48
|
|
138
|
-
|
139
|
-
|
140
|
-
example uses a symbol. This was the convention for the previous facility that
|
141
|
-
MSpec provided for aliased method (#it_behaves_like). However, this convention
|
142
|
-
is not set in stone (but the uniqueness requirement is). Note that the
|
143
|
-
argument to the #it_should_behave_like is a String because at this time RSpec
|
144
|
-
will not find the shared block by the symbol.
|
49
|
+
Use RSpec to run the MSpec specs. There are no plans currently to make the
|
50
|
+
MSpec specs runnable by MSpec.
|
145
51
|
|
146
|
-
|
147
|
-
specifying aliased methods. The syntax is as follows:
|
52
|
+
After installing the gem dependencies, the specs can be run as follows:
|
148
53
|
|
149
|
-
|
54
|
+
$ ruby -S rspec
|
150
55
|
|
151
|
-
|
152
|
-
it "returns true" do
|
153
|
-
obj.send(@method).should be_true
|
154
|
-
end
|
56
|
+
Or
|
155
57
|
|
156
|
-
|
157
|
-
@object.send(@method).should be_something_else
|
158
|
-
end
|
159
|
-
end
|
58
|
+
$ ruby -S rake
|
160
59
|
|
161
|
-
|
162
|
-
describe "SomeClass#some_method" do
|
163
|
-
it_behaves_like :someclass_some_method, :other_method
|
164
|
-
end
|
60
|
+
To run an individual spec file, use the following example:
|
165
61
|
|
166
|
-
|
167
|
-
describe "SomeOtherClass#some_method" do
|
168
|
-
it_behaves_like :someclass_some_method, :some_method, OtherClass
|
169
|
-
end
|
62
|
+
$ ruby -S rspec spec/helpers/ruby_exe_spec.rb
|
170
63
|
|
171
|
-
The first form above (#1) is used for typical aliases. That is, methods with
|
172
|
-
different names on the same class that behave identically. The
|
173
|
-
#it_behaves_like helper creates a before(:all) block that sets @method to
|
174
|
-
:other_method. The form of the first example block in the shared block
|
175
|
-
illustrates the typical form of a spec for an aliased method.
|
176
64
|
|
177
|
-
|
178
|
-
essentially aliases, even though Ruby does not provide a syntax for specifying
|
179
|
-
such methods as aliases. Examples are the methods on File, FileTest, and
|
180
|
-
File::Stat. In this case, the #it_behaves_like helper sets both @method and
|
181
|
-
@object in the before(:all) block (@method = :some_method, @object =
|
182
|
-
OtherClass in this example).
|
65
|
+
4. Documentation
|
183
66
|
|
184
|
-
|
185
|
-
use nested or shared 'describe' blocks as appropriate and use the
|
186
|
-
#it_should_behave_like method directly.
|
67
|
+
See http://rubyspec.org
|
187
68
|
|
188
|
-
== Guards
|
189
69
|
|
190
|
-
|
70
|
+
5. Source Code
|
191
71
|
|
192
|
-
|
72
|
+
See https://github.com/rubyspec/mspec
|
193
73
|
|
194
|
-
== Helpers
|
195
74
|
|
75
|
+
6. License
|
196
76
|
|
197
|
-
|
77
|
+
See the LICENSE in the source code.
|
data/Rakefile
CHANGED
@@ -1,47 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'rspec/core/rake_task'
|
4
4
|
|
5
|
-
|
6
|
-
require 'lib/mspec/version'
|
7
|
-
|
8
|
-
Spec::Rake::SpecTask.new
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
6
|
|
10
7
|
task :default => :spec
|
11
|
-
|
12
|
-
|
13
|
-
spec = Gem::Specification.new do |s|
|
14
|
-
s.name = %q{mspec}
|
15
|
-
s.version = MSpec::VERSION.to_s
|
16
|
-
|
17
|
-
s.specification_version = 2 if s.respond_to? :specification_version=
|
18
|
-
|
19
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
20
|
-
s.authors = ["Brian Ford"]
|
21
|
-
s.date = %q{2010-03-13}
|
22
|
-
s.email = %q{bford@engineyard.com}
|
23
|
-
s.has_rdoc = true
|
24
|
-
s.extra_rdoc_files = %w[ README LICENSE ]
|
25
|
-
s.executables = ["mkspec", "mspec", "mspec-ci", "mspec-run", "mspec-tag"]
|
26
|
-
s.files = FileList[ '{bin,lib,spec}/**/*.{yaml,txt,rb}', 'Rakefile', *s.extra_rdoc_files ]
|
27
|
-
s.homepage = %q{http://rubyspec.org}
|
28
|
-
s.rubyforge_project = 'http://rubyforge.org/projects/mspec'
|
29
|
-
s.require_paths = ["lib"]
|
30
|
-
s.rubygems_version = %q{1.3.5}
|
31
|
-
s.summary = <<EOS
|
32
|
-
MSpec is a specialized framework that is syntax-compatible
|
33
|
-
with RSpec for basic things like describe, it blocks and
|
34
|
-
before, after actions.
|
35
|
-
|
36
|
-
MSpec contains additional features that assist in writing
|
37
|
-
the RubySpecs used by multiple Ruby implementations. Also,
|
38
|
-
MSpec attempts to use the simplest Ruby language features
|
39
|
-
so that beginning Ruby implementations can run it.
|
40
|
-
EOS
|
41
|
-
|
42
|
-
s.rdoc_options << '--title' << 'MSpec Gem' <<
|
43
|
-
'--main' << 'README' <<
|
44
|
-
'--line-numbers'
|
45
|
-
end
|
46
|
-
|
47
|
-
Rake::GemPackageTask.new(spec){ |pkg| pkg.gem_spec = spec }
|
data/bin/mkspec.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@"ruby.exe" "%~dpn0" %*
|
data/bin/mspec-ci.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@"ruby.exe" "%~dpn0" %*
|
data/bin/mspec-run.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@"ruby.exe" "%~dpn0" %*
|
data/bin/mspec-tag.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@"ruby.exe" "%~dpn0" %*
|
data/bin/mspec.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
@"ruby.exe" "%~dpn0" %*
|
@@ -138,8 +138,8 @@ EOS
|
|
138
138
|
# Determine and return the path of the ruby executable.
|
139
139
|
|
140
140
|
def ruby
|
141
|
-
ruby = File.join(
|
142
|
-
|
141
|
+
ruby = File.join(RbConfig::CONFIG['bindir'],
|
142
|
+
RbConfig::CONFIG['ruby_install_name'])
|
143
143
|
|
144
144
|
ruby.gsub! File::SEPARATOR, File::ALT_SEPARATOR if File::ALT_SEPARATOR
|
145
145
|
|
@@ -34,6 +34,7 @@ class MSpecRun < MSpecScript
|
|
34
34
|
options.configure { |f| load f }
|
35
35
|
options.name
|
36
36
|
options.randomize
|
37
|
+
options.repeat
|
37
38
|
options.pretend
|
38
39
|
options.background
|
39
40
|
options.interrupt
|
@@ -68,6 +69,9 @@ class MSpecRun < MSpecScript
|
|
68
69
|
options.doc "\n $ mspec -g fails path/to/the_file_spec.rb"
|
69
70
|
options.doc "\n 3. To start the debugger before the spec matching 'this crashes'"
|
70
71
|
options.doc "\n $ mspec --spec-debug -S 'this crashes' path/to/the_file_spec.rb"
|
72
|
+
options.doc "\n 4. To run some specs matching 'this crashes'"
|
73
|
+
options.doc "\n $ mspec -e 'this crashes' path/to/the_file_spec.rb"
|
74
|
+
|
71
75
|
options.doc ""
|
72
76
|
|
73
77
|
patterns = options.parse argv
|
data/lib/mspec/commands/mspec.rb
CHANGED
@@ -6,6 +6,7 @@ require 'mspec/version'
|
|
6
6
|
require 'mspec/utils/options'
|
7
7
|
require 'mspec/utils/script'
|
8
8
|
require 'mspec/helpers/tmp'
|
9
|
+
require 'mspec/runner/actions/filter'
|
9
10
|
require 'mspec/runner/actions/timer'
|
10
11
|
|
11
12
|
|
@@ -17,6 +18,7 @@ class MSpecMain < MSpecScript
|
|
17
18
|
config[:flags] = []
|
18
19
|
config[:command] = nil
|
19
20
|
config[:options] = []
|
21
|
+
config[:launch] = []
|
20
22
|
end
|
21
23
|
|
22
24
|
def options(argv=ARGV)
|
@@ -38,17 +40,21 @@ class MSpecMain < MSpecScript
|
|
38
40
|
options.on("-D", "--gdb", "Run under gdb") do
|
39
41
|
config[:use_gdb] = true
|
40
42
|
end
|
43
|
+
|
41
44
|
options.on("-A", "--valgrind", "Run under valgrind") do
|
42
|
-
config[:
|
45
|
+
config[:use_valgrind] = true
|
43
46
|
end
|
47
|
+
|
44
48
|
options.on("--warnings", "Don't supress warnings") do
|
45
49
|
config[:flags] << '-w'
|
46
50
|
ENV['OUTPUT_WARNINGS'] = '1'
|
47
51
|
end
|
52
|
+
|
48
53
|
options.on("-j", "--multi", "Run multiple (possibly parallel) subprocesses") do
|
49
54
|
config[:multi] = true
|
50
55
|
config[:options] << "-fy"
|
51
56
|
end
|
57
|
+
|
52
58
|
options.version MSpec::VERSION do
|
53
59
|
if config[:command]
|
54
60
|
config[:options] << "-v"
|
@@ -57,6 +63,7 @@ class MSpecMain < MSpecScript
|
|
57
63
|
exit
|
58
64
|
end
|
59
65
|
end
|
66
|
+
|
60
67
|
options.help do
|
61
68
|
if config[:command]
|
62
69
|
config[:options] << "-h"
|
@@ -75,6 +82,7 @@ class MSpecMain < MSpecScript
|
|
75
82
|
options.doc " ci - Run the known good specs"
|
76
83
|
options.doc " tag - Add or remove tags\n"
|
77
84
|
options.doc " mspec COMMAND -h for more options\n"
|
85
|
+
options.doc " example: $ mspec run -h\n"
|
78
86
|
|
79
87
|
options.on_extra { |o| config[:options] << o }
|
80
88
|
config[:options].concat options.parse(argv)
|
@@ -140,6 +148,8 @@ class MSpecMain < MSpecScript
|
|
140
148
|
ENV['RUBY_FLAGS'] = config[:flags].join " "
|
141
149
|
|
142
150
|
argv = []
|
151
|
+
|
152
|
+
argv.concat config[:launch]
|
143
153
|
argv.concat config[:flags]
|
144
154
|
argv.concat config[:includes]
|
145
155
|
argv.concat config[:requires]
|
@@ -150,11 +160,16 @@ class MSpecMain < MSpecScript
|
|
150
160
|
if config[:multi] and config[:command] == "ci"
|
151
161
|
multi_exec argv
|
152
162
|
else
|
153
|
-
if config[:
|
163
|
+
if config[:use_valgrind]
|
164
|
+
more = ["--db-attach=#{config[:use_gdb] ? 'yes' : 'no'}", config[:target]] + argv
|
165
|
+
exec "valgrind", *more
|
166
|
+
elsif config[:use_gdb]
|
154
167
|
more = ["--args", config[:target]] + argv
|
155
168
|
exec "gdb", *more
|
156
169
|
else
|
157
|
-
|
170
|
+
cmd, *rest = config[:target].split(/\s+/)
|
171
|
+
argv = rest + argv unless rest.empty?
|
172
|
+
exec cmd, *argv
|
158
173
|
end
|
159
174
|
end
|
160
175
|
end
|