mspec 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mspec/guards/block_device.rb +1 -1
- data/lib/mspec/helpers/environment.rb +23 -8
- data/lib/mspec/helpers/io.rb +31 -1
- data/lib/mspec/helpers/numeric.rb +1 -1
- data/lib/mspec/helpers/ruby_exe.rb +3 -1
- data/lib/mspec/helpers/tmp.rb +1 -1
- data/lib/mspec/matchers/output.rb +6 -6
- data/lib/mspec/mocks/mock.rb +4 -4
- data/lib/mspec/runner/exception.rb +2 -2
- data/lib/mspec/utils/options.rb +6 -2
- data/lib/mspec/version.rb +1 -1
- metadata +14 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db64f3a62d63a1638a20baa6df40cebc68b02ec2
|
4
|
+
data.tar.gz: 65f01cb75ab6f4decb63e7fdb4989dd171645259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 066466880beebed65251d5f8f167b3ecc61739b982ababa3c97021ef1421f40391c4ba8d24cff9fba50ba400f4ad7a911fee467ac3f2872f1827cd44654589ac
|
7
|
+
data.tar.gz: 10d37dbe04a31f6fe9fa0ceeb3c46abc5ca7e2013852dd29cc4d5500148ba382bfb3dcdc130ae0d19c687b27d93e62918ae2f6231ddd18b98e094c073259673f
|
@@ -2,26 +2,38 @@ require 'mspec/guards/guard'
|
|
2
2
|
|
3
3
|
class Object
|
4
4
|
def env
|
5
|
-
|
6
|
-
if PlatformGuard.windows?
|
7
|
-
env = Hash[*`cmd.exe /C set`.split("\n").map { |e| e.split("=", 2) }.flatten]
|
8
|
-
else
|
5
|
+
platform_is_not :opal, :windows do
|
9
6
|
env = Hash[*`env`.split("\n").map { |e| e.split("=", 2) }.flatten]
|
10
7
|
end
|
8
|
+
|
9
|
+
platform_is :windows do
|
10
|
+
env = Hash[*`cmd.exe /C set`.split("\n").map { |e| e.split("=", 2) }.flatten]
|
11
|
+
end
|
12
|
+
|
13
|
+
platform_is :opal do
|
14
|
+
env = {}
|
15
|
+
end
|
16
|
+
|
11
17
|
env
|
12
18
|
end
|
13
19
|
|
14
20
|
def windows_env_echo(var)
|
15
|
-
|
21
|
+
platform_is_not :opal do
|
22
|
+
`cmd.exe /C ECHO %#{var}%`.strip
|
23
|
+
end
|
16
24
|
end
|
17
25
|
|
18
26
|
def username
|
19
27
|
user = ""
|
20
|
-
|
28
|
+
|
29
|
+
platform_is :windows do
|
21
30
|
user = windows_env_echo('USERNAME')
|
22
|
-
|
31
|
+
end
|
32
|
+
|
33
|
+
platform_is_not :opal do
|
23
34
|
user = `whoami`.strip
|
24
35
|
end
|
36
|
+
|
25
37
|
user
|
26
38
|
end
|
27
39
|
|
@@ -41,7 +53,10 @@ class Object
|
|
41
53
|
def hostname
|
42
54
|
commands = ['hostname', 'uname -n']
|
43
55
|
commands.each do |command|
|
44
|
-
name =
|
56
|
+
name = ''
|
57
|
+
platform_is_not :opal do
|
58
|
+
name = `#{command}`
|
59
|
+
end
|
45
60
|
return name.strip if $?.success?
|
46
61
|
end
|
47
62
|
raise Exception, "hostname: unable to find a working command"
|
data/lib/mspec/helpers/io.rb
CHANGED
@@ -1,14 +1,36 @@
|
|
1
1
|
require 'mspec/guards/feature'
|
2
2
|
|
3
|
-
class IOStub
|
3
|
+
class IOStub
|
4
|
+
def initialize
|
5
|
+
@buffer = []
|
6
|
+
@output = ''
|
7
|
+
end
|
8
|
+
|
4
9
|
def write(*str)
|
5
10
|
self << str.join
|
6
11
|
end
|
7
12
|
|
13
|
+
def << str
|
14
|
+
@buffer << str
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
8
18
|
def print(*str)
|
9
19
|
write(str.join + $\.to_s)
|
10
20
|
end
|
11
21
|
|
22
|
+
def method_missing(name, *args, &block)
|
23
|
+
to_s.send(name, *args, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
def == other
|
27
|
+
to_s == other
|
28
|
+
end
|
29
|
+
|
30
|
+
def =~ other
|
31
|
+
to_s =~ other
|
32
|
+
end
|
33
|
+
|
12
34
|
def puts(*str)
|
13
35
|
if str.empty?
|
14
36
|
write "\n"
|
@@ -22,8 +44,16 @@ class IOStub < String
|
|
22
44
|
end
|
23
45
|
|
24
46
|
def flush
|
47
|
+
@output += @buffer.join('')
|
48
|
+
@buffer.clear
|
25
49
|
self
|
26
50
|
end
|
51
|
+
|
52
|
+
def to_s
|
53
|
+
flush
|
54
|
+
@output
|
55
|
+
end
|
56
|
+
alias to_str to_s
|
27
57
|
end
|
28
58
|
|
29
59
|
class Object
|
data/lib/mspec/helpers/tmp.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# should clean up any temporary files created so that the temp
|
4
4
|
# directory is empty when the process exits.
|
5
5
|
|
6
|
-
SPEC_TEMP_DIR = "#{File.expand_path(Dir.pwd)}/rubyspec_temp"
|
6
|
+
SPEC_TEMP_DIR = ENV["SPEC_TEMP_DIR"] || "#{File.expand_path(Dir.pwd)}/rubyspec_temp"
|
7
7
|
|
8
8
|
SPEC_TEMP_UNIQUIFIER = "0"
|
9
9
|
|
@@ -42,20 +42,20 @@ class OutputMatcher
|
|
42
42
|
expected_out = "\n"
|
43
43
|
actual_out = "\n"
|
44
44
|
unless @out.nil?
|
45
|
-
expected_out
|
46
|
-
actual_out
|
45
|
+
expected_out += " $stdout: #{@out.inspect}\n"
|
46
|
+
actual_out += " $stdout: #{@stdout.inspect}\n"
|
47
47
|
end
|
48
48
|
unless @err.nil?
|
49
|
-
expected_out
|
50
|
-
actual_out
|
49
|
+
expected_out += " $stderr: #{@err.inspect}\n"
|
50
|
+
actual_out += " $stderr: #{@stderr.inspect}\n"
|
51
51
|
end
|
52
52
|
["Expected:#{expected_out}", " got:#{actual_out}"]
|
53
53
|
end
|
54
54
|
|
55
55
|
def negative_failure_message
|
56
56
|
out = ""
|
57
|
-
out
|
58
|
-
out
|
57
|
+
out += " $stdout: #{@stdout.chomp.dump}\n" unless @out.nil?
|
58
|
+
out += " $stderr: #{@stderr.chomp.dump}\n" unless @err.nil?
|
59
59
|
["Expected output not to be:\n", out]
|
60
60
|
end
|
61
61
|
end
|
data/lib/mspec/mocks/mock.rb
CHANGED
@@ -62,11 +62,11 @@ module Mock
|
|
62
62
|
meta.__send__ :alias_method, key.first, sym
|
63
63
|
end
|
64
64
|
|
65
|
-
meta.class_eval
|
66
|
-
|
67
|
-
Mock.verify_call self,
|
65
|
+
meta.class_eval {
|
66
|
+
define_method(sym) do |*args, &block|
|
67
|
+
Mock.verify_call self, sym, *args, &block
|
68
68
|
end
|
69
|
-
|
69
|
+
}
|
70
70
|
|
71
71
|
proxy = MockProxy.new type
|
72
72
|
|
@@ -6,8 +6,8 @@ class ExceptionState
|
|
6
6
|
|
7
7
|
@description = location ? "An exception occurred during: #{location}" : ""
|
8
8
|
if state
|
9
|
-
@description
|
10
|
-
@description
|
9
|
+
@description += "\n" unless @description.empty?
|
10
|
+
@description += state.description
|
11
11
|
@describe = state.describe
|
12
12
|
@it = state.it
|
13
13
|
else
|
data/lib/mspec/utils/options.rb
CHANGED
@@ -81,7 +81,7 @@ class MSpecOptions
|
|
81
81
|
# instance to the list of registered options.
|
82
82
|
def add(short, long, arg, description, block)
|
83
83
|
s = short ? short.dup : " "
|
84
|
-
s
|
84
|
+
s += (short ? ", " : " ") if long
|
85
85
|
doc " #{s}#{long} #{arg}".ljust(@width-1) + " #{description}"
|
86
86
|
@options << MSpecOption.new(short, long, arg, description, block)
|
87
87
|
end
|
@@ -231,6 +231,9 @@ class MSpecOptions
|
|
231
231
|
config[:target] = 'maglev-ruby'
|
232
232
|
when 't','topaz'
|
233
233
|
config[:target] = 'topaz'
|
234
|
+
when 'o','opal'
|
235
|
+
mspec_lib = File.expand_path('../../../', __FILE__)
|
236
|
+
config[:target] = "./bin/opal -syaml -siconv -sfileutils -rnodejs -rnodejs/require -rnodejs/yaml -rprocess -Derror -I#{mspec_lib} -I./lib/ -I. "
|
234
237
|
else
|
235
238
|
config[:target] = t
|
236
239
|
end
|
@@ -247,7 +250,8 @@ class MSpecOptions
|
|
247
250
|
doc " j or jruby invokes jruby in PATH"
|
248
251
|
doc " i or ironruby invokes ir in PATH"
|
249
252
|
doc " m or maglev invokes maglev-ruby in PATH"
|
250
|
-
doc " t or topaz
|
253
|
+
doc " t or topaz invokes topaz in PATH"
|
254
|
+
doc " o or opal invokes ./bin/opal with options"
|
251
255
|
doc " full path to EXE invokes EXE directly\n"
|
252
256
|
|
253
257
|
on("-T", "--target-opt", "OPT",
|
data/lib/mspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,45 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
15
|
-
|
14
|
+
type: :development
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '10.0'
|
20
|
-
|
20
|
+
name: rake
|
21
21
|
prerelease: false
|
22
|
-
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '10.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
|
29
|
-
|
28
|
+
type: :development
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.8'
|
34
|
-
|
34
|
+
name: rspec
|
35
35
|
prerelease: false
|
36
|
-
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.8'
|
41
|
-
description:
|
42
|
-
|
41
|
+
description: 'MSpec is a specialized framework for RubySpec.
|
42
|
+
|
43
|
+
'
|
43
44
|
email:
|
44
45
|
- bshirai@engineyard.com
|
45
46
|
executables:
|
@@ -358,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
358
359
|
version: '0'
|
359
360
|
requirements: []
|
360
361
|
rubyforge_project: http://rubyforge.org/projects/mspec
|
361
|
-
rubygems_version: 2.
|
362
|
+
rubygems_version: 2.4.5
|
362
363
|
signing_key:
|
363
364
|
specification_version: 4
|
364
365
|
summary: MSpec is a specialized framework that is syntax-compatible with RSpec for
|