mspec 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -7
- data/lib/mspec/commands/mspec.rb +0 -8
- data/lib/mspec/guards/platform.rb +4 -0
- data/lib/mspec/helpers/environment.rb +12 -22
- data/lib/mspec/helpers/io.rb +6 -1
- data/lib/mspec/helpers/mock_to_path.rb +1 -1
- data/lib/mspec/helpers/ruby_exe.rb +8 -3
- data/lib/mspec/runner/actions.rb +0 -1
- data/lib/mspec/utils/options.rb +0 -4
- data/lib/mspec/utils/script.rb +0 -1
- data/lib/mspec/version.rb +1 -1
- data/spec/commands/mkspec_spec.rb +31 -31
- data/spec/commands/mspec_ci_spec.rb +14 -14
- data/spec/commands/mspec_run_spec.rb +4 -4
- data/spec/commands/mspec_spec.rb +33 -56
- data/spec/commands/mspec_tag_spec.rb +26 -26
- data/spec/guards/background_spec.rb +1 -1
- data/spec/guards/block_device_spec.rb +1 -1
- data/spec/guards/bug_spec.rb +4 -4
- data/spec/guards/compliance_spec.rb +2 -2
- data/spec/guards/conflict_spec.rb +5 -5
- data/spec/guards/endian_spec.rb +8 -8
- data/spec/guards/extensions_spec.rb +1 -1
- data/spec/guards/feature_spec.rb +1 -1
- data/spec/guards/guard_spec.rb +20 -20
- data/spec/guards/noncompliance_spec.rb +1 -1
- data/spec/guards/platform_spec.rb +14 -14
- data/spec/guards/quarantine_spec.rb +1 -1
- data/spec/guards/runner_spec.rb +7 -7
- data/spec/guards/specified_spec.rb +7 -7
- data/spec/guards/superuser_spec.rb +3 -3
- data/spec/guards/support_spec.rb +1 -1
- data/spec/guards/tty_spec.rb +1 -1
- data/spec/guards/user_spec.rb +3 -3
- data/spec/guards/version_spec.rb +3 -3
- data/spec/helpers/ducktype_spec.rb +3 -3
- data/spec/helpers/environment_spec.rb +18 -10
- data/spec/helpers/flunk_spec.rb +2 -2
- data/spec/helpers/io_spec.rb +2 -2
- data/spec/helpers/ruby_exe_spec.rb +5 -9
- data/spec/matchers/have_singleton_method_spec.rb +1 -1
- data/spec/matchers/output_spec.rb +1 -1
- data/spec/mocks/mock_spec.rb +41 -41
- data/spec/mocks/proxy_spec.rb +1 -1
- data/spec/runner/actions/filter_spec.rb +1 -1
- data/spec/runner/actions/tag_spec.rb +17 -17
- data/spec/runner/actions/taglist_spec.rb +8 -8
- data/spec/runner/actions/tagpurge_spec.rb +11 -11
- data/spec/runner/actions/timer_spec.rb +4 -4
- data/spec/runner/context_spec.rb +32 -32
- data/spec/runner/example_spec.rb +1 -1
- data/spec/runner/filters/profile_spec.rb +2 -2
- data/spec/runner/filters/tag_spec.rb +6 -6
- data/spec/runner/formatters/describe_spec.rb +6 -6
- data/spec/runner/formatters/dotted_spec.rb +10 -10
- data/spec/runner/formatters/file_spec.rb +2 -2
- data/spec/runner/formatters/html_spec.rb +10 -10
- data/spec/runner/formatters/junit_spec.rb +11 -11
- data/spec/runner/formatters/method_spec.rb +3 -3
- data/spec/runner/formatters/specdoc_spec.rb +1 -1
- data/spec/runner/formatters/spinner_spec.rb +4 -4
- data/spec/runner/formatters/unit_spec.rb +7 -7
- data/spec/runner/formatters/yaml_spec.rb +10 -10
- data/spec/runner/mspec_spec.rb +25 -25
- data/spec/runner/shared_spec.rb +1 -1
- data/spec/utils/options_spec.rb +28 -50
- data/spec/utils/script_spec.rb +15 -24
- metadata +12 -16
- data/lib/mspec/runner/actions/gdb.rb +0 -17
- data/spec/runner/actions/gdb_spec.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 733fa565d5e2085c638435f1fc22513fa124bec8
|
4
|
+
data.tar.gz: ed6da518e6058b01ef1a7ea8f99ffd2f051c2994
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b61ffdbc4bfc08fcbd7bdcb31004186135b9e6e06f8c7c8b062ebf7b170d840e1368898af9d8b6995a701a647aa7e314d85ea80e5825e854365b351e98834589
|
7
|
+
data.tar.gz: d3312bdda59bfa8380bf7f85ccc010683f1e43e04e3dda5231ded27fea339af823bfad6bfca5d4b1c918f85e6cd9f8738ef0c7601bfd874ea6f6a4a40b94e81a
|
data/.travis.yml
CHANGED
@@ -5,14 +5,16 @@ jdk:
|
|
5
5
|
- openjdk7
|
6
6
|
rvm:
|
7
7
|
- 1.8.7
|
8
|
-
- 1.
|
9
|
-
- 2.0.0
|
10
|
-
- 2.1.0
|
8
|
+
- 2.1.5
|
11
9
|
- ruby-head
|
12
10
|
- rbx-2
|
13
11
|
- jruby-head
|
14
|
-
|
15
|
-
|
12
|
+
matrix:
|
13
|
+
allow_failures:
|
14
|
+
- rvm: jruby-head
|
15
|
+
- rvm: rbx-2
|
16
|
+
- rvm: ruby-head
|
16
17
|
notifications:
|
17
|
-
|
18
|
-
|
18
|
+
email:
|
19
|
+
recipients:
|
20
|
+
- brixen@gmail.com
|
data/lib/mspec/commands/mspec.rb
CHANGED
@@ -37,10 +37,6 @@ class MSpecMain < MSpecScript
|
|
37
37
|
|
38
38
|
options.targets
|
39
39
|
|
40
|
-
options.on("-D", "--gdb", "Run under gdb") do
|
41
|
-
config[:use_gdb] = true
|
42
|
-
end
|
43
|
-
|
44
40
|
options.on("-A", "--valgrind", "Run under valgrind") do
|
45
41
|
config[:use_valgrind] = true
|
46
42
|
end
|
@@ -162,12 +158,8 @@ class MSpecMain < MSpecScript
|
|
162
158
|
else
|
163
159
|
if config[:use_valgrind]
|
164
160
|
more = ["--child-silent-after-fork=yes",
|
165
|
-
"--db-attach=#{config[:use_gdb] ? 'yes' : 'no'}",
|
166
161
|
config[:target]] + argv
|
167
162
|
exec "valgrind", *more
|
168
|
-
elsif config[:use_gdb]
|
169
|
-
more = ["--args", config[:target]] + argv
|
170
|
-
exec "gdb", *more
|
171
163
|
else
|
172
164
|
cmd, *rest = config[:target].split(/\s+/)
|
173
165
|
argv = rest + argv unless rest.empty?
|
@@ -2,19 +2,13 @@ require 'mspec/guards/guard'
|
|
2
2
|
|
3
3
|
class Object
|
4
4
|
def env
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
platform_is :opal do
|
14
|
-
env = {}
|
5
|
+
if PlatformGuard.windows?
|
6
|
+
Hash[*`cmd.exe /C set`.split("\n").map { |e| e.split("=", 2) }.flatten]
|
7
|
+
elsif PlatformGuard.opal?
|
8
|
+
{}
|
9
|
+
else
|
10
|
+
Hash[*`env`.split("\n").map { |e| e.split("=", 2) }.flatten]
|
15
11
|
end
|
16
|
-
|
17
|
-
env
|
18
12
|
end
|
19
13
|
|
20
14
|
def windows_env_echo(var)
|
@@ -24,17 +18,13 @@ class Object
|
|
24
18
|
end
|
25
19
|
|
26
20
|
def username
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
platform_is_not :opal do
|
34
|
-
user = `whoami`.strip
|
21
|
+
if PlatformGuard.windows?
|
22
|
+
windows_env_echo('USERNAME')
|
23
|
+
elsif PlatformGuard.opal?
|
24
|
+
""
|
25
|
+
else
|
26
|
+
`whoami`.strip
|
35
27
|
end
|
36
|
-
|
37
|
-
user
|
38
28
|
end
|
39
29
|
|
40
30
|
def home_directory
|
data/lib/mspec/helpers/io.rb
CHANGED
@@ -146,11 +146,16 @@ class Object
|
|
146
146
|
|
147
147
|
if code and not File.exist?(code)
|
148
148
|
if opts[:escape]
|
149
|
-
|
149
|
+
heredoc_separator = "END_OF_RUBYCODE"
|
150
|
+
lines = code.lines
|
151
|
+
until lines.none? {|line| line.start_with? heredoc_separator }
|
152
|
+
heredoc_separator << heredoc_separator
|
153
|
+
end
|
154
|
+
|
155
|
+
body = %Q!-e "$(cat <<'#{heredoc_separator}'\n#{code}\n#{heredoc_separator}\n)"!
|
150
156
|
else
|
151
|
-
|
157
|
+
body = "-e #{code.inspect}"
|
152
158
|
end
|
153
|
-
body = "-e #{code}"
|
154
159
|
end
|
155
160
|
|
156
161
|
[RUBY_EXE, ENV['RUBY_FLAGS'], opts[:options], body, opts[:args]].compact.join(' ')
|
data/lib/mspec/runner/actions.rb
CHANGED
data/lib/mspec/utils/options.rb
CHANGED
@@ -468,10 +468,6 @@ class MSpecOptions
|
|
468
468
|
"Invoke the debugger when a spec description matches (see -K, -S)") do
|
469
469
|
config[:debugger] = true
|
470
470
|
end
|
471
|
-
on("--spec-gdb",
|
472
|
-
"Invoke Gdb when a spec description matches (see -K, -S)") do
|
473
|
-
config[:gdb] = true
|
474
|
-
end
|
475
471
|
end
|
476
472
|
|
477
473
|
def debug
|
data/lib/mspec/utils/script.rb
CHANGED
@@ -125,7 +125,6 @@ class MSpecScript
|
|
125
125
|
ProfileFilter.new(:exclude, *config[:xprofiles]).register unless config[:xprofiles].empty?
|
126
126
|
|
127
127
|
DebugAction.new(config[:atags], config[:astrings]).register if config[:debugger]
|
128
|
-
GdbAction.new(config[:atags], config[:astrings]).register if config[:gdb]
|
129
128
|
|
130
129
|
custom_register
|
131
130
|
end
|
data/lib/mspec/version.rb
CHANGED
@@ -5,13 +5,13 @@ require 'mspec/commands/mkspec'
|
|
5
5
|
describe "The -c, --constant CONSTANT option" do
|
6
6
|
before :each do
|
7
7
|
@options = MSpecOptions.new
|
8
|
-
MSpecOptions.stub
|
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
|
-
@options.stub
|
14
|
+
@options.stub(:on)
|
15
15
|
@options.should_receive(:on).with("-c", "--constant", "CONSTANT",
|
16
16
|
an_instance_of(String))
|
17
17
|
@script.options
|
@@ -29,13 +29,13 @@ end
|
|
29
29
|
describe "The -b, --base DIR option" do
|
30
30
|
before :each do
|
31
31
|
@options = MSpecOptions.new
|
32
|
-
MSpecOptions.stub
|
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
|
-
@options.stub
|
38
|
+
@options.stub(:on)
|
39
39
|
@options.should_receive(:on).with("-b", "--base", "DIR",
|
40
40
|
an_instance_of(String))
|
41
41
|
@script.options
|
@@ -53,13 +53,13 @@ end
|
|
53
53
|
describe "The -r, --require LIBRARY option" do
|
54
54
|
before :each do
|
55
55
|
@options = MSpecOptions.new
|
56
|
-
MSpecOptions.stub
|
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
|
-
@options.stub
|
62
|
+
@options.stub(:on)
|
63
63
|
@options.should_receive(:on).with("-r", "--require", "LIBRARY",
|
64
64
|
an_instance_of(String))
|
65
65
|
@script.options
|
@@ -77,13 +77,13 @@ end
|
|
77
77
|
describe "The -V, --version-guard VERSION option" do
|
78
78
|
before :each do
|
79
79
|
@options = MSpecOptions.new
|
80
|
-
MSpecOptions.stub
|
80
|
+
MSpecOptions.stub(:new).and_return(@options)
|
81
81
|
@script = MkSpec.new
|
82
82
|
@config = @script.config
|
83
83
|
end
|
84
84
|
|
85
85
|
it "is enabled by #options" do
|
86
|
-
@options.stub
|
86
|
+
@options.stub(:on)
|
87
87
|
@options.should_receive(:on).with("-V", "--version-guard", "VERSION",
|
88
88
|
an_instance_of(String))
|
89
89
|
@script.options
|
@@ -101,7 +101,7 @@ end
|
|
101
101
|
describe MkSpec, "#options" do
|
102
102
|
before :each do
|
103
103
|
@options = MSpecOptions.new
|
104
|
-
MSpecOptions.stub
|
104
|
+
MSpecOptions.stub(:new).and_return(@options)
|
105
105
|
@script = MkSpec.new
|
106
106
|
end
|
107
107
|
|
@@ -117,8 +117,8 @@ describe MkSpec, "#options" do
|
|
117
117
|
|
118
118
|
it "prints help and exits if passed an unrecognized option" do
|
119
119
|
@options.should_receive(:raise).with(MSpecOptions::ParseError, an_instance_of(String))
|
120
|
-
@options.stub
|
121
|
-
@options.stub
|
120
|
+
@options.stub(:puts)
|
121
|
+
@options.stub(:exit)
|
122
122
|
@script.options "--iunknown"
|
123
123
|
end
|
124
124
|
end
|
@@ -162,8 +162,8 @@ describe MkSpec, "#write_requires" do
|
|
162
162
|
@script = MkSpec.new
|
163
163
|
@script.config[:base] = "spec"
|
164
164
|
|
165
|
-
@file =
|
166
|
-
File.stub
|
165
|
+
@file = double("file")
|
166
|
+
File.stub(:open).and_yield(@file)
|
167
167
|
end
|
168
168
|
|
169
169
|
it "writes the spec_helper require line" do
|
@@ -172,7 +172,7 @@ describe MkSpec, "#write_requires" do
|
|
172
172
|
end
|
173
173
|
|
174
174
|
it "writes require lines for each library specified on the command line" do
|
175
|
-
@file.stub
|
175
|
+
@file.stub(:puts)
|
176
176
|
@file.should_receive(:puts).with("require File.expand_path('../../../../spec_helper', __FILE__)")
|
177
177
|
@file.should_receive(:puts).with("require 'complex'")
|
178
178
|
@script.config[:requires] << 'complex'
|
@@ -183,14 +183,14 @@ end
|
|
183
183
|
describe MkSpec, "#write_spec" do
|
184
184
|
before :each do
|
185
185
|
@file = IOStub.new
|
186
|
-
File.stub
|
186
|
+
File.stub(:open).and_yield(@file)
|
187
187
|
|
188
188
|
@script = MkSpec.new
|
189
|
-
@script.stub
|
189
|
+
@script.stub(:puts)
|
190
190
|
|
191
|
-
@response =
|
192
|
-
@response.stub
|
193
|
-
@script.stub
|
191
|
+
@response = double("system command response")
|
192
|
+
@response.stub(:=~).and_return(false)
|
193
|
+
@script.stub(:`).and_return(@response)
|
194
194
|
end
|
195
195
|
|
196
196
|
it "checks if specs exist for the method if the spec file exists" do
|
@@ -206,12 +206,12 @@ describe MkSpec, "#write_spec" do
|
|
206
206
|
end
|
207
207
|
|
208
208
|
it "returns nil if the spec file exists and contains a spec for the method" do
|
209
|
-
@response.stub
|
209
|
+
@response.stub(:=~).and_return(true)
|
210
210
|
@script.write_spec("spec/core/tcejbo/inspect_spec.rb", "Object#inspect", true).should == nil
|
211
211
|
end
|
212
212
|
|
213
213
|
it "does not print the spec file name if it exists and contains a spec for the method" do
|
214
|
-
@response.stub
|
214
|
+
@response.stub(:=~).and_return(true)
|
215
215
|
@script.should_not_receive(:puts)
|
216
216
|
@script.write_spec("spec/core/tcejbo/inspect_spec.rb", "Object#inspect", true)
|
217
217
|
end
|
@@ -262,10 +262,10 @@ end
|
|
262
262
|
describe MkSpec, "#create_file" do
|
263
263
|
before :each do
|
264
264
|
@script = MkSpec.new
|
265
|
-
@script.stub
|
266
|
-
@script.stub
|
265
|
+
@script.stub(:write_requires)
|
266
|
+
@script.stub(:write_spec)
|
267
267
|
|
268
|
-
File.stub
|
268
|
+
File.stub(:exist?).and_return(false)
|
269
269
|
end
|
270
270
|
|
271
271
|
it "generates a file name based on the directory, class/module, and method" do
|
@@ -297,19 +297,19 @@ end
|
|
297
297
|
describe MkSpec, "#run" do
|
298
298
|
before :each do
|
299
299
|
@options = MSpecOptions.new
|
300
|
-
MSpecOptions.stub
|
300
|
+
MSpecOptions.stub(:new).and_return(@options)
|
301
301
|
|
302
302
|
@map = NameMap.new
|
303
|
-
NameMap.stub
|
303
|
+
NameMap.stub(:new).and_return(@map)
|
304
304
|
|
305
305
|
@script = MkSpec.new
|
306
|
-
@script.stub
|
307
|
-
@script.stub
|
306
|
+
@script.stub(:create_directory).and_return("spec/mkspec")
|
307
|
+
@script.stub(:create_file)
|
308
308
|
@script.config[:constants] = [MkSpec]
|
309
309
|
end
|
310
310
|
|
311
311
|
it "loads files in the requires list" do
|
312
|
-
@script.stub
|
312
|
+
@script.stub(:require)
|
313
313
|
@script.should_receive(:require).with("alib")
|
314
314
|
@script.should_receive(:require).with("blib")
|
315
315
|
@script.config[:requires] = ["alib", "blib"]
|
@@ -336,8 +336,8 @@ end
|
|
336
336
|
|
337
337
|
describe MkSpec, ".main" do
|
338
338
|
before :each do
|
339
|
-
@script =
|
340
|
-
MkSpec.stub
|
339
|
+
@script = double("MkSpec").as_null_object
|
340
|
+
MkSpec.stub(:new).and_return(@script)
|
341
341
|
end
|
342
342
|
|
343
343
|
it "sets MSPEC_RUNNER = '1' in the environment" do
|
@@ -6,11 +6,11 @@ require 'mspec/commands/mspec-ci'
|
|
6
6
|
describe MSpecCI, "#options" do
|
7
7
|
before :each do
|
8
8
|
@options, @config = new_option
|
9
|
-
MSpecOptions.stub
|
9
|
+
MSpecOptions.stub(:new).and_return(@options)
|
10
10
|
|
11
11
|
@script = MSpecCI.new
|
12
|
-
@script.stub
|
13
|
-
@script.stub
|
12
|
+
@script.stub(:config).and_return(@config)
|
13
|
+
@script.stub(:files).and_return([])
|
14
14
|
end
|
15
15
|
|
16
16
|
it "enables the chdir option" do
|
@@ -96,19 +96,19 @@ end
|
|
96
96
|
|
97
97
|
describe MSpecCI, "#run" do
|
98
98
|
before :each do
|
99
|
-
MSpec.stub
|
99
|
+
MSpec.stub(:process)
|
100
100
|
|
101
|
-
@filter =
|
102
|
-
TagFilter.stub
|
103
|
-
@filter.stub
|
101
|
+
@filter = double("TagFilter")
|
102
|
+
TagFilter.stub(:new).and_return(@filter)
|
103
|
+
@filter.stub(:register)
|
104
104
|
|
105
105
|
@tags = ["fails", "critical", "unstable", "incomplete", "unsupported"]
|
106
106
|
|
107
107
|
@config = { :ci_files => ["one", "two"] }
|
108
108
|
@script = MSpecCI.new
|
109
|
-
@script.stub
|
110
|
-
@script.stub
|
111
|
-
@script.stub
|
109
|
+
@script.stub(:exit)
|
110
|
+
@script.stub(:config).and_return(@config)
|
111
|
+
@script.stub(:files).and_return(["one", "two"])
|
112
112
|
@script.options
|
113
113
|
end
|
114
114
|
|
@@ -124,7 +124,7 @@ describe MSpecCI, "#run" do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
it "registers a tag filter for 'fails', 'unstable', 'incomplete', 'critical', 'unsupported'" do
|
127
|
-
filter =
|
127
|
+
filter = double("fails filter")
|
128
128
|
TagFilter.should_receive(:new).with(:exclude, *@tags).and_return(filter)
|
129
129
|
filter.should_receive(:register)
|
130
130
|
@script.run
|
@@ -132,7 +132,7 @@ describe MSpecCI, "#run" do
|
|
132
132
|
|
133
133
|
it "registers an additional exclude tag specified by :ci_xtags" do
|
134
134
|
@config[:ci_xtags] = "windows"
|
135
|
-
filter =
|
135
|
+
filter = double("fails filter")
|
136
136
|
TagFilter.should_receive(:new).with(:exclude, *(@tags + ["windows"])).and_return(filter)
|
137
137
|
filter.should_receive(:register)
|
138
138
|
@script.run
|
@@ -140,7 +140,7 @@ describe MSpecCI, "#run" do
|
|
140
140
|
|
141
141
|
it "registers additional exclude tags specified by a :ci_xtags array" do
|
142
142
|
@config[:ci_xtags] = ["windows", "windoze"]
|
143
|
-
filter =
|
143
|
+
filter = double("fails filter")
|
144
144
|
TagFilter.should_receive(:new).with(:exclude,
|
145
145
|
*(@tags + ["windows", "windoze"])).and_return(filter)
|
146
146
|
filter.should_receive(:register)
|
@@ -153,7 +153,7 @@ describe MSpecCI, "#run" do
|
|
153
153
|
end
|
154
154
|
|
155
155
|
it "exits with the exit code registered with MSpec" do
|
156
|
-
MSpec.stub
|
156
|
+
MSpec.stub(:exit_code).and_return(7)
|
157
157
|
@script.should_receive(:exit).with(7)
|
158
158
|
@script.run
|
159
159
|
end
|