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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dea78f04d5f7dd8d900b3a9de1462448b14a71db
4
- data.tar.gz: a978b407496a528fbaf345bdf3188c52be68a8ad
3
+ metadata.gz: db64f3a62d63a1638a20baa6df40cebc68b02ec2
4
+ data.tar.gz: 65f01cb75ab6f4decb63e7fdb4989dd171645259
5
5
  SHA512:
6
- metadata.gz: 1fd3e10ba43ac914f0191b93cd687c8d5bd299194f7a0b6c95d4dff4f52542a38e362c67ba5d13d74ec9a4c0842bbcff58d69be995404c7da79f0396166f66d3
7
- data.tar.gz: 457f6c7dda4d73809de319c0c13a3d0047801f5f8e9927a7a681612cc290f27979e3d218ebb0166de34fe70caf013b2dc68fb69d97b559837d22da772d443da9
6
+ metadata.gz: 066466880beebed65251d5f8f167b3ecc61739b982ababa3c97021ef1421f40391c4ba8d24cff9fba50ba400f4ad7a911fee467ac3f2872f1827cd44654589ac
7
+ data.tar.gz: 10d37dbe04a31f6fe9fa0ceeb3c46abc5ca7e2013852dd29cc4d5500148ba382bfb3dcdc130ae0d19c687b27d93e62918ae2f6231ddd18b98e094c073259673f
@@ -2,7 +2,7 @@ require 'mspec/guards/guard'
2
2
 
3
3
  class BlockDeviceGuard < SpecGuard
4
4
  def match?
5
- platform_is_not :freebsd, :windows do
5
+ platform_is_not :freebsd, :windows, :opal do
6
6
  block = `find /dev /devices -type b 2> /dev/null`
7
7
  return !(block.nil? || block.empty?)
8
8
  end
@@ -2,26 +2,38 @@ require 'mspec/guards/guard'
2
2
 
3
3
  class Object
4
4
  def env
5
- env = ""
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
- `cmd.exe /C ECHO %#{var}%`.strip
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
- if PlatformGuard.windows?
28
+
29
+ platform_is :windows do
21
30
  user = windows_env_echo('USERNAME')
22
- else
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 = `#{command}`
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"
@@ -1,14 +1,36 @@
1
1
  require 'mspec/guards/feature'
2
2
 
3
- class IOStub < String
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
@@ -18,7 +18,7 @@ class Object
18
18
  # values.
19
19
  guard = SpecGuard.new
20
20
 
21
- if guard.standard? or guard.implementation? :topaz
21
+ if guard.standard? or guard.implementation? :topaz or guard.implementation? :opal
22
22
  if guard.wordsize? 32
23
23
  def fixnum_max()
24
24
  (2**30) - 1
@@ -128,7 +128,9 @@ class Object
128
128
  end
129
129
 
130
130
  begin
131
- `#{ruby_cmd(code, opts)}`
131
+ platform_is_not :opal do
132
+ `#{ruby_cmd(code, opts)}`
133
+ end
132
134
  ensure
133
135
  saved_env.each { |key, value| ENV[key] = value }
134
136
  env.keys.each do |key|
@@ -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 << " $stdout: #{@out.inspect}\n"
46
- actual_out << " $stdout: #{@stdout.chomp.inspect}\n"
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 << " $stderr: #{@err.inspect}\n"
50
- actual_out << " $stderr: #{@stderr.chomp.inspect}\n"
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 << " $stdout: #{@stdout.chomp.dump}\n" unless @out.nil?
58
- out << " $stderr: #{@stderr.chomp.dump}\n" unless @err.nil?
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
@@ -62,11 +62,11 @@ module Mock
62
62
  meta.__send__ :alias_method, key.first, sym
63
63
  end
64
64
 
65
- meta.class_eval <<-END
66
- def #{sym}(*args, &block)
67
- Mock.verify_call self, :#{sym}, *args, &block
65
+ meta.class_eval {
66
+ define_method(sym) do |*args, &block|
67
+ Mock.verify_call self, sym, *args, &block
68
68
  end
69
- END
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 << "\n" unless @description.empty?
10
- @description << state.description
9
+ @description += "\n" unless @description.empty?
10
+ @description += state.description
11
11
  @describe = state.describe
12
12
  @it = state.it
13
13
  else
@@ -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 << (short ? ", " : " ") if long
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 invokes topaz in PATH"
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",
@@ -1,5 +1,5 @@
1
1
  require 'mspec/utils/version'
2
2
 
3
3
  module MSpec
4
- VERSION = SpecVersion.new "1.6.0"
4
+ VERSION = SpecVersion.new "1.7.0"
5
5
  end
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.6.0
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: 2014-12-21 00:00:00.000000000 Z
11
+ date: 2015-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
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
- type: :development
20
+ name: rake
21
21
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
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
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
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
- type: :development
34
+ name: rspec
35
35
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
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
- MSpec is a specialized framework for RubySpec.
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.2.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