mspec 1.5.20 → 1.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/mspec/commands/mspec.rb +3 -1
- data/lib/mspec/guards/guard.rb +2 -0
- data/lib/mspec/guards/version.rb +8 -6
- data/lib/mspec/helpers.rb +0 -1
- data/lib/mspec/helpers/fs.rb +2 -2
- data/lib/mspec/helpers/io.rb +5 -1
- data/lib/mspec/helpers/ruby_exe.rb +2 -2
- data/lib/mspec/helpers/tmp.rb +1 -1
- data/lib/mspec/matchers.rb +1 -0
- data/lib/mspec/matchers/raise_exception.rb +51 -0
- data/lib/mspec/runner/mspec.rb +1 -1
- data/lib/mspec/utils/options.rb +1 -0
- data/lib/mspec/version.rb +1 -1
- data/spec/helpers/fs_spec.rb +16 -16
- data/spec/helpers/io_spec.rb +5 -0
- data/spec/helpers/ruby_exe_spec.rb +8 -8
- data/spec/matchers/equal_spec.rb +0 -1
- data/spec/matchers/raise_exception_spec.rb +82 -0
- data/spec/runner/mspec_spec.rb +1 -1
- metadata +21 -28
- data/lib/mspec/helpers/language_version.rb +0 -30
- data/spec/helpers/language_version_spec.rb +0 -40
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bb7091a131017258473190549823fa8239557f71
|
4
|
+
data.tar.gz: 4a4d9b0877a059409eca4427e03bca0dbfc3def2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c4f7467fd468001a2e09990bfadb1e6a1b1ab0a10e74b937af980ea81c6ef8b6821a46515e18d5f680819bb9c07b9bb00b25dfc39a6a31fc8b80492aa48f491
|
7
|
+
data.tar.gz: 60e2c53be8e1d584fa9f4bc26e880196c3239d79fd4031de3fea7e5e248ce37e99af497116d493d98ce3366b8b8bfa416673e700921cd28f187d29ac1019d850
|
data/lib/mspec/commands/mspec.rb
CHANGED
@@ -161,7 +161,9 @@ class MSpecMain < MSpecScript
|
|
161
161
|
multi_exec argv
|
162
162
|
else
|
163
163
|
if config[:use_valgrind]
|
164
|
-
more = ["--
|
164
|
+
more = ["--child-silent-after-fork=yes",
|
165
|
+
"--db-attach=#{config[:use_gdb] ? 'yes' : 'no'}",
|
166
|
+
config[:target]] + argv
|
165
167
|
exec "valgrind", *more
|
166
168
|
elsif config[:use_gdb]
|
167
169
|
more = ["--args", config[:target]] + argv
|
data/lib/mspec/guards/guard.rb
CHANGED
data/lib/mspec/guards/version.rb
CHANGED
@@ -7,8 +7,8 @@ class VersionGuard < SpecGuard
|
|
7
7
|
when String
|
8
8
|
@version = SpecVersion.new version
|
9
9
|
when Range
|
10
|
-
a = SpecVersion.new version.
|
11
|
-
b = SpecVersion.new version.
|
10
|
+
a = SpecVersion.new version.begin
|
11
|
+
b = SpecVersion.new version.end
|
12
12
|
@version = version.exclude_end? ? a...b : a..b
|
13
13
|
end
|
14
14
|
self.parameters = [version]
|
@@ -30,9 +30,11 @@ end
|
|
30
30
|
class Object
|
31
31
|
def ruby_version_is(*args)
|
32
32
|
g = VersionGuard.new(*args)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
begin
|
34
|
+
g.name = :ruby_version_is
|
35
|
+
yield if g.yield?
|
36
|
+
ensure
|
37
|
+
g.unregister
|
38
|
+
end
|
37
39
|
end
|
38
40
|
end
|
data/lib/mspec/helpers.rb
CHANGED
@@ -10,7 +10,6 @@ require 'mspec/helpers/flunk'
|
|
10
10
|
require 'mspec/helpers/fs'
|
11
11
|
require 'mspec/helpers/hash'
|
12
12
|
require 'mspec/helpers/io'
|
13
|
-
require 'mspec/helpers/language_version'
|
14
13
|
require 'mspec/helpers/mock_to_path'
|
15
14
|
require 'mspec/helpers/numeric'
|
16
15
|
require 'mspec/helpers/pack'
|
data/lib/mspec/helpers/fs.rb
CHANGED
@@ -38,13 +38,13 @@ class Object
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# File.symlink? needs to be checked first as
|
41
|
-
# File.
|
41
|
+
# File.exist? returns false for dangling symlinks
|
42
42
|
if File.symlink? path
|
43
43
|
File.unlink path
|
44
44
|
elsif File.directory? path
|
45
45
|
Dir.entries(path).each { |x| rm_r "#{path}/#{x}" unless x =~ /^\.\.?$/ }
|
46
46
|
Dir.rmdir path
|
47
|
-
elsif File.
|
47
|
+
elsif File.exist? path
|
48
48
|
File.delete path
|
49
49
|
end
|
50
50
|
end
|
data/lib/mspec/helpers/io.rb
CHANGED
@@ -10,7 +10,11 @@ class IOStub < String
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def puts(*str)
|
13
|
-
|
13
|
+
if str.empty?
|
14
|
+
write "\n"
|
15
|
+
else
|
16
|
+
write(str.collect { |s| s.to_s.chomp }.concat([nil]).join("\n"))
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
def printf(format, *args)
|
@@ -109,7 +109,7 @@ class Object
|
|
109
109
|
# It has been reported that File.executable is not reliable
|
110
110
|
# on Windows platforms (see commit 56bc555c). So, we check the
|
111
111
|
# platform.
|
112
|
-
if File.
|
112
|
+
if File.exist?(exe) and (PlatformGuard.windows? or File.executable?(exe))
|
113
113
|
return [File.expand_path(exe), *rest].join(" ")
|
114
114
|
end
|
115
115
|
end
|
@@ -142,7 +142,7 @@ class Object
|
|
142
142
|
def ruby_cmd(code, opts = {})
|
143
143
|
body = code
|
144
144
|
|
145
|
-
if code and not File.
|
145
|
+
if code and not File.exist?(code)
|
146
146
|
if opts[:escape]
|
147
147
|
code = "'#{code}'"
|
148
148
|
else
|
data/lib/mspec/helpers/tmp.rb
CHANGED
data/lib/mspec/matchers.rb
CHANGED
@@ -31,6 +31,7 @@ require 'mspec/matchers/include'
|
|
31
31
|
require 'mspec/matchers/infinity'
|
32
32
|
require 'mspec/matchers/match_yaml'
|
33
33
|
require 'mspec/matchers/raise_error'
|
34
|
+
require 'mspec/matchers/raise_exception'
|
34
35
|
require 'mspec/matchers/output'
|
35
36
|
require 'mspec/matchers/output_to_fd'
|
36
37
|
require 'mspec/matchers/respond_to'
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class RaiseExceptionMatcher
|
2
|
+
def initialize(exception, message, &block)
|
3
|
+
@exception = exception
|
4
|
+
@message = message
|
5
|
+
@block = block
|
6
|
+
end
|
7
|
+
|
8
|
+
def matches?(proc)
|
9
|
+
@result = proc.call
|
10
|
+
return false
|
11
|
+
rescue Object => @actual
|
12
|
+
return false unless @actual.instance_of? @exception
|
13
|
+
if @message then
|
14
|
+
case @message
|
15
|
+
when String then
|
16
|
+
return false if @message != @actual.message
|
17
|
+
when Regexp then
|
18
|
+
return false if @message !~ @actual.message
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
@block[@actual] if @block
|
23
|
+
|
24
|
+
return true
|
25
|
+
end
|
26
|
+
|
27
|
+
def failure_message
|
28
|
+
message = ["Expected #{@exception}#{%[ (#{@message})] if @message}"]
|
29
|
+
|
30
|
+
if @actual then
|
31
|
+
message << "but got #{@actual.class}#{%[ (#{@actual.message})] if @actual.message}"
|
32
|
+
else
|
33
|
+
message << "but no exception was raised (#@result was returned)"
|
34
|
+
end
|
35
|
+
|
36
|
+
message
|
37
|
+
end
|
38
|
+
|
39
|
+
def negative_failure_message
|
40
|
+
message = ["Expected to not get #{@exception}#{%[ (#{@message})] if @message}", ""]
|
41
|
+
message[1] = "but got #{@actual.class}#{%[ (#{@actual.message})] if @actual.message}" unless @actual.class == @exception
|
42
|
+
message
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Object
|
47
|
+
def raise_exception(exception=Exception, message=nil, &block)
|
48
|
+
RaiseExceptionMatcher.new(exception, message, &block)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
data/lib/mspec/runner/mspec.rb
CHANGED
data/lib/mspec/utils/options.rb
CHANGED
data/lib/mspec/version.rb
CHANGED
data/spec/helpers/fs_spec.rb
CHANGED
@@ -12,8 +12,8 @@ describe Object, "#cp" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
after :each do
|
15
|
-
File.delete @source if File.
|
16
|
-
File.delete @copy if File.
|
15
|
+
File.delete @source if File.exist? @source
|
16
|
+
File.delete @copy if File.exist? @copy
|
17
17
|
end
|
18
18
|
|
19
19
|
it "copies a file" do
|
@@ -30,17 +30,17 @@ describe Object, "#touch" do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
after :each do
|
33
|
-
File.delete @name if File.
|
33
|
+
File.delete @name if File.exist? @name
|
34
34
|
end
|
35
35
|
|
36
36
|
it "creates a file" do
|
37
37
|
touch @name
|
38
|
-
File.
|
38
|
+
File.exist?(@name).should be_true
|
39
39
|
end
|
40
40
|
|
41
41
|
it "accepts an optional mode argument" do
|
42
42
|
touch @name, "wb"
|
43
|
-
File.
|
43
|
+
File.exist?(@name).should be_true
|
44
44
|
end
|
45
45
|
|
46
46
|
it "overwrites an existing file" do
|
@@ -68,7 +68,7 @@ describe Object, "#touch" do
|
|
68
68
|
|
69
69
|
it "creates all the directories in the path to the file" do
|
70
70
|
touch @name
|
71
|
-
File.
|
71
|
+
File.exist?(@name).should be_true
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -113,10 +113,10 @@ describe Object, "#rm_r" do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
after :each do
|
116
|
-
File.delete @link if File.
|
117
|
-
File.delete @socket if File.
|
118
|
-
File.delete @subfile if File.
|
119
|
-
File.delete @topfile if File.
|
116
|
+
File.delete @link if File.exist? @link or File.symlink? @link
|
117
|
+
File.delete @socket if File.exist? @socket
|
118
|
+
File.delete @subfile if File.exist? @subfile
|
119
|
+
File.delete @topfile if File.exist? @topfile
|
120
120
|
|
121
121
|
Dir.rmdir @subdir2 if File.directory? @subdir2
|
122
122
|
Dir.rmdir @subdir1 if File.directory? @subdir1
|
@@ -129,20 +129,20 @@ describe Object, "#rm_r" do
|
|
129
129
|
|
130
130
|
it "removes a single file" do
|
131
131
|
rm_r @subfile
|
132
|
-
File.
|
132
|
+
File.exist?(@subfile).should be_false
|
133
133
|
end
|
134
134
|
|
135
135
|
it "removes multiple files" do
|
136
136
|
rm_r @topfile, @subfile
|
137
|
-
File.
|
138
|
-
File.
|
137
|
+
File.exist?(@topfile).should be_false
|
138
|
+
File.exist?(@subfile).should be_false
|
139
139
|
end
|
140
140
|
|
141
141
|
platform_is_not :windows do
|
142
142
|
it "removes a symlink to a file" do
|
143
143
|
File.symlink @topfile, @link
|
144
144
|
rm_r @link
|
145
|
-
File.
|
145
|
+
File.exist?(@link).should be_false
|
146
146
|
end
|
147
147
|
|
148
148
|
it "removes a symlink to a directory" do
|
@@ -151,7 +151,7 @@ describe Object, "#rm_r" do
|
|
151
151
|
lambda do
|
152
152
|
File.lstat(@link)
|
153
153
|
end.should raise_error(Errno::ENOENT)
|
154
|
-
File.
|
154
|
+
File.exist?(@subdir1).should be_true
|
155
155
|
end
|
156
156
|
|
157
157
|
it "removes a dangling symlink" do
|
@@ -166,7 +166,7 @@ describe Object, "#rm_r" do
|
|
166
166
|
require 'socket'
|
167
167
|
UNIXServer.new(@socket).close
|
168
168
|
rm_r @socket
|
169
|
-
File.
|
169
|
+
File.exist?(@socket).should be_false
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
data/spec/helpers/io_spec.rb
CHANGED
@@ -34,6 +34,11 @@ describe IOStub do
|
|
34
34
|
@out.should == "hello\n1\n2\n3\n"
|
35
35
|
end
|
36
36
|
|
37
|
+
it "provides a puts method that appends separator if argument not given" do
|
38
|
+
@out.puts
|
39
|
+
@out.should == "\n"
|
40
|
+
end
|
41
|
+
|
37
42
|
it "provides a printf method" do
|
38
43
|
@out.printf "%-10s, %03d, %2.1f", "test", 42, 4.2
|
39
44
|
@out.should == "test , 042, 4.2"
|
@@ -108,7 +108,7 @@ describe "#resolve_ruby_exe" do
|
|
108
108
|
it "returns the value returned by #ruby_exe_options if it exists and is executable" do
|
109
109
|
PlatformGuard.stub!(:windows?).and_return(false)
|
110
110
|
@script.should_receive(:ruby_exe_options).and_return(@name)
|
111
|
-
File.should_receive(:
|
111
|
+
File.should_receive(:exist?).with(@name).and_return(true)
|
112
112
|
File.should_receive(:executable?).with(@name).and_return(true)
|
113
113
|
File.should_receive(:expand_path).with(@name).and_return(@name)
|
114
114
|
@script.resolve_ruby_exe.should == @name
|
@@ -117,7 +117,7 @@ describe "#resolve_ruby_exe" do
|
|
117
117
|
it "returns the value returned by #ruby_exe_options if it exists on Windows platforms" do
|
118
118
|
PlatformGuard.stub!(:windows?).and_return(true)
|
119
119
|
@script.should_receive(:ruby_exe_options).and_return(@name)
|
120
|
-
File.should_receive(:
|
120
|
+
File.should_receive(:exist?).with(@name).and_return(true)
|
121
121
|
File.should_not_receive(:executable?)
|
122
122
|
File.should_receive(:expand_path).with(@name).and_return(@name)
|
123
123
|
@script.resolve_ruby_exe.should == @name
|
@@ -126,14 +126,14 @@ describe "#resolve_ruby_exe" do
|
|
126
126
|
it "expands the path portion of the result of #ruby_exe_options" do
|
127
127
|
PlatformGuard.stub!(:windows?).and_return(false)
|
128
128
|
@script.should_receive(:ruby_exe_options).and_return("#{@name} -Xfoo")
|
129
|
-
File.should_receive(:
|
129
|
+
File.should_receive(:exist?).with(@name).and_return(true)
|
130
130
|
File.should_receive(:executable?).with(@name).and_return(true)
|
131
131
|
File.should_receive(:expand_path).with(@name).and_return("/usr/bin/#{@name}")
|
132
132
|
@script.resolve_ruby_exe.should == "/usr/bin/#{@name} -Xfoo"
|
133
133
|
end
|
134
134
|
|
135
135
|
it "returns nil if no exe is found" do
|
136
|
-
File.should_receive(:
|
136
|
+
File.should_receive(:exist?).at_least(:once).and_return(false)
|
137
137
|
@script.resolve_ruby_exe.should be_nil
|
138
138
|
end
|
139
139
|
end
|
@@ -162,23 +162,23 @@ describe Object, "#ruby_cmd" do
|
|
162
162
|
end
|
163
163
|
|
164
164
|
it "returns a command that runs the given file if it is a file that exists" do
|
165
|
-
File.should_receive(:
|
165
|
+
File.should_receive(:exist?).with(@file).and_return(true)
|
166
166
|
@script.ruby_cmd(@file).should == "ruby_spec_exe -w -Q some/ruby/file.rb"
|
167
167
|
end
|
168
168
|
|
169
169
|
it "includes the given options and arguments with a file" do
|
170
|
-
File.should_receive(:
|
170
|
+
File.should_receive(:exist?).with(@file).and_return(true)
|
171
171
|
@script.ruby_cmd(@file, :options => "-w -Cdir", :args => "< file.txt").should ==
|
172
172
|
"ruby_spec_exe -w -Q -w -Cdir some/ruby/file.rb < file.txt"
|
173
173
|
end
|
174
174
|
|
175
175
|
it "returns a command that runs code using -e" do
|
176
|
-
File.should_receive(:
|
176
|
+
File.should_receive(:exist?).with(@code).and_return(false)
|
177
177
|
@script.ruby_cmd(@code).should == %(ruby_spec_exe -w -Q -e "some \\"real\\" 'ruby' code")
|
178
178
|
end
|
179
179
|
|
180
180
|
it "includes the given options and arguments with -e" do
|
181
|
-
File.should_receive(:
|
181
|
+
File.should_receive(:exist?).with(@code).and_return(false)
|
182
182
|
@script.ruby_cmd(@code, :options => "-W0 -Cdir", :args => "< file.txt").should ==
|
183
183
|
%(ruby_spec_exe -w -Q -W0 -Cdir -e "some \\"real\\" 'ruby' code" < file.txt)
|
184
184
|
end
|
data/spec/matchers/equal_spec.rb
CHANGED
@@ -14,7 +14,6 @@ describe EqualMatcher do
|
|
14
14
|
|
15
15
|
it "does not match when actual is not a equal? to expected" do
|
16
16
|
EqualMatcher.new(1).matches?(1.0).should == false
|
17
|
-
EqualMatcher.new(1.5).matches?(1.5).should == false
|
18
17
|
EqualMatcher.new("blue").matches?("blue").should == false
|
19
18
|
EqualMatcher.new(Hash).matches?(Object).should == false
|
20
19
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'mspec/expectations/expectations'
|
3
|
+
require 'mspec/matchers'
|
4
|
+
|
5
|
+
class ExpectedException < Exception; end
|
6
|
+
class UnexpectedException < Exception; end
|
7
|
+
|
8
|
+
describe RaiseExceptionMatcher do
|
9
|
+
it "matches when the proc raises the expected exception" do
|
10
|
+
proc = Proc.new { raise ExpectedException }
|
11
|
+
RaiseErrorMatcher.new(ExpectedException, nil).matches?(proc).should == true
|
12
|
+
end
|
13
|
+
|
14
|
+
it "executes it's optional block if matched" do
|
15
|
+
run = false
|
16
|
+
proc = Proc.new { raise ExpectedException }
|
17
|
+
matcher = RaiseErrorMatcher.new(ExpectedException, nil) { |error|
|
18
|
+
run = true
|
19
|
+
error.class.should == ExpectedException
|
20
|
+
}
|
21
|
+
|
22
|
+
matcher.matches?(proc).should == true
|
23
|
+
run.should == true
|
24
|
+
end
|
25
|
+
|
26
|
+
it "matches when the proc raises the expected exception with the expected message" do
|
27
|
+
proc = Proc.new { raise ExpectedException, "message" }
|
28
|
+
RaiseErrorMatcher.new(ExpectedException, "message").matches?(proc).should == true
|
29
|
+
end
|
30
|
+
|
31
|
+
it "does not match when the proc does not raise the expected exception" do
|
32
|
+
proc = Proc.new { raise UnexpectedException }
|
33
|
+
RaiseErrorMatcher.new(ExpectedException, nil).matches?(proc).should == false
|
34
|
+
end
|
35
|
+
|
36
|
+
it "does not match when the proc raises the expected exception with an unexpected message" do
|
37
|
+
proc = Proc.new { raise ExpectedException, "unexpected" }
|
38
|
+
RaiseErrorMatcher.new(ExpectedException, "expected").matches?(proc).should == false
|
39
|
+
end
|
40
|
+
|
41
|
+
it "does not match when the proc does not raise an exception" do
|
42
|
+
proc = Proc.new {}
|
43
|
+
RaiseErrorMatcher.new(ExpectedException, "expected").matches?(proc).should == false
|
44
|
+
end
|
45
|
+
|
46
|
+
it "does not match when the raised exception is not an instance of the expected exception" do
|
47
|
+
proc = Proc.new { raise Exception }
|
48
|
+
RaiseErrorMatcher.new(ExpectedException, nil).matches?(proc).should == false
|
49
|
+
end
|
50
|
+
|
51
|
+
it "provides a useful failure message" do
|
52
|
+
proc = Proc.new { raise UnexpectedException, "unexpected" }
|
53
|
+
matcher = RaiseErrorMatcher.new(ExpectedException, "expected")
|
54
|
+
matcher.matches?(proc)
|
55
|
+
matcher.failure_message.should ==
|
56
|
+
["Expected ExpectedException (expected)", "but got UnexpectedException (unexpected)"]
|
57
|
+
end
|
58
|
+
|
59
|
+
it "provides a useful failure message when no exception is raised" do
|
60
|
+
proc = Proc.new { 120 }
|
61
|
+
matcher = RaiseErrorMatcher.new(ExpectedException, "expected")
|
62
|
+
matcher.matches?(proc)
|
63
|
+
matcher.failure_message.should ==
|
64
|
+
["Expected ExpectedException (expected)", "but no exception was raised (120 was returned)"]
|
65
|
+
end
|
66
|
+
|
67
|
+
it "provides a useful negative failure message" do
|
68
|
+
proc = Proc.new { raise ExpectedException, "expected" }
|
69
|
+
matcher = RaiseErrorMatcher.new(ExpectedException, "expected")
|
70
|
+
matcher.matches?(proc)
|
71
|
+
matcher.negative_failure_message.should ==
|
72
|
+
["Expected to not get ExpectedException (expected)", ""]
|
73
|
+
end
|
74
|
+
|
75
|
+
it "provides a useful negative failure message for strict subclasses of the matched exception class" do
|
76
|
+
proc = Proc.new { raise UnexpectedException, "unexpected" }
|
77
|
+
matcher = RaiseErrorMatcher.new(Exception, nil)
|
78
|
+
matcher.matches?(proc)
|
79
|
+
matcher.negative_failure_message.should ==
|
80
|
+
["Expected to not get Exception", "but got UnexpectedException (unexpected)"]
|
81
|
+
end
|
82
|
+
end
|
data/spec/runner/mspec_spec.rb
CHANGED
metadata
CHANGED
@@ -1,51 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
5
|
-
prerelease:
|
4
|
+
version: 1.5.21
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brian Shirai
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '10.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '10.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '2.8'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '2.8'
|
46
|
-
description:
|
47
|
-
|
48
|
-
'
|
41
|
+
description: |
|
42
|
+
MSpec is a specialized framework for RubySpec.
|
49
43
|
email:
|
50
44
|
- bshirai@engineyard.com
|
51
45
|
executables:
|
@@ -59,8 +53,8 @@ extra_rdoc_files:
|
|
59
53
|
- README
|
60
54
|
- LICENSE
|
61
55
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .travis.yml
|
56
|
+
- ".gitignore"
|
57
|
+
- ".travis.yml"
|
64
58
|
- Gemfile
|
65
59
|
- LICENSE
|
66
60
|
- README
|
@@ -117,7 +111,6 @@ files:
|
|
117
111
|
- lib/mspec/helpers/fs.rb
|
118
112
|
- lib/mspec/helpers/hash.rb
|
119
113
|
- lib/mspec/helpers/io.rb
|
120
|
-
- lib/mspec/helpers/language_version.rb
|
121
114
|
- lib/mspec/helpers/mock_to_path.rb
|
122
115
|
- lib/mspec/helpers/numeric.rb
|
123
116
|
- lib/mspec/helpers/pack.rb
|
@@ -163,6 +156,7 @@ files:
|
|
163
156
|
- lib/mspec/matchers/output.rb
|
164
157
|
- lib/mspec/matchers/output_to_fd.rb
|
165
158
|
- lib/mspec/matchers/raise_error.rb
|
159
|
+
- lib/mspec/matchers/raise_exception.rb
|
166
160
|
- lib/mspec/matchers/respond_to.rb
|
167
161
|
- lib/mspec/matchers/signed_zero.rb
|
168
162
|
- lib/mspec/matchers/stringsymboladapter.rb
|
@@ -256,7 +250,6 @@ files:
|
|
256
250
|
- spec/helpers/fs_spec.rb
|
257
251
|
- spec/helpers/hash_spec.rb
|
258
252
|
- spec/helpers/io_spec.rb
|
259
|
-
- spec/helpers/language_version_spec.rb
|
260
253
|
- spec/helpers/mock_to_path_spec.rb
|
261
254
|
- spec/helpers/numeric_spec.rb
|
262
255
|
- spec/helpers/ruby_exe_spec.rb
|
@@ -298,6 +291,7 @@ files:
|
|
298
291
|
- spec/matchers/output_spec.rb
|
299
292
|
- spec/matchers/output_to_fd_spec.rb
|
300
293
|
- spec/matchers/raise_error_spec.rb
|
294
|
+
- spec/matchers/raise_exception_spec.rb
|
301
295
|
- spec/matchers/respond_to_spec.rb
|
302
296
|
- spec/matchers/signed_zero_spec.rb
|
303
297
|
- spec/matchers/stringsymboladapter_spec.rb
|
@@ -341,32 +335,31 @@ files:
|
|
341
335
|
- spec/utils/version_spec.rb
|
342
336
|
homepage: http://rubyspec.org
|
343
337
|
licenses: []
|
338
|
+
metadata: {}
|
344
339
|
post_install_message:
|
345
340
|
rdoc_options:
|
346
|
-
- --title
|
341
|
+
- "--title"
|
347
342
|
- MSpec Gem
|
348
|
-
- --main
|
343
|
+
- "--main"
|
349
344
|
- README
|
350
|
-
- --line-numbers
|
345
|
+
- "--line-numbers"
|
351
346
|
require_paths:
|
352
347
|
- lib
|
353
348
|
required_ruby_version: !ruby/object:Gem::Requirement
|
354
|
-
none: false
|
355
349
|
requirements:
|
356
|
-
- -
|
350
|
+
- - ">="
|
357
351
|
- !ruby/object:Gem::Version
|
358
352
|
version: '0'
|
359
353
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
360
|
-
none: false
|
361
354
|
requirements:
|
362
|
-
- -
|
355
|
+
- - ">="
|
363
356
|
- !ruby/object:Gem::Version
|
364
357
|
version: '0'
|
365
358
|
requirements: []
|
366
359
|
rubyforge_project: http://rubyforge.org/projects/mspec
|
367
|
-
rubygems_version:
|
360
|
+
rubygems_version: 2.2.1
|
368
361
|
signing_key:
|
369
|
-
specification_version:
|
362
|
+
specification_version: 4
|
370
363
|
summary: MSpec is a specialized framework that is syntax-compatible with RSpec for
|
371
364
|
basic things like describe, it blocks and before, after actions. MSpec contains
|
372
365
|
additional features that assist in writing the RubySpecs used by multiple Ruby implementations.
|
@@ -417,7 +410,6 @@ test_files:
|
|
417
410
|
- spec/helpers/fs_spec.rb
|
418
411
|
- spec/helpers/hash_spec.rb
|
419
412
|
- spec/helpers/io_spec.rb
|
420
|
-
- spec/helpers/language_version_spec.rb
|
421
413
|
- spec/helpers/mock_to_path_spec.rb
|
422
414
|
- spec/helpers/numeric_spec.rb
|
423
415
|
- spec/helpers/ruby_exe_spec.rb
|
@@ -459,6 +451,7 @@ test_files:
|
|
459
451
|
- spec/matchers/output_spec.rb
|
460
452
|
- spec/matchers/output_to_fd_spec.rb
|
461
453
|
- spec/matchers/raise_error_spec.rb
|
454
|
+
- spec/matchers/raise_exception_spec.rb
|
462
455
|
- spec/matchers/respond_to_spec.rb
|
463
456
|
- spec/matchers/signed_zero_spec.rb
|
464
457
|
- spec/matchers/stringsymboladapter_spec.rb
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'mspec/guards/guard'
|
2
|
-
|
3
|
-
class Object
|
4
|
-
# Helper for syntax-sensitive specs. The specs should be placed in a file in
|
5
|
-
# the +versions+ subdirectory. For example, suppose language/method_spec.rb
|
6
|
-
# contains specs whose syntax depends on the Ruby version. In the
|
7
|
-
# language/method_spec.rb use the helper as follows:
|
8
|
-
#
|
9
|
-
# language_version __FILE__, "method"
|
10
|
-
#
|
11
|
-
# Then add a file "language/versions/method_1.8.rb" for the specs that are
|
12
|
-
# syntax-compatible with Ruby 1.8.x.
|
13
|
-
#
|
14
|
-
# The most version-specific file will be loaded. If the version is 1.8.6,
|
15
|
-
# "method_1.8.6.rb" will be loaded if it exists, otherwise "method_1.8.rb"
|
16
|
-
# will be loaded if it exists.
|
17
|
-
def language_version(dir, name)
|
18
|
-
path = File.dirname(File.expand_path(dir))
|
19
|
-
|
20
|
-
[SpecGuard.ruby_version(:tiny), SpecGuard.ruby_version].each do |version|
|
21
|
-
file = File.join path, "versions", "#{name}_#{version}.rb"
|
22
|
-
if File.exists? file
|
23
|
-
require file
|
24
|
-
break
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'mspec/guards'
|
3
|
-
require 'mspec/helpers'
|
4
|
-
|
5
|
-
describe Object, "#language_version" do
|
6
|
-
before :all do
|
7
|
-
@ruby_version = Object.const_get :RUBY_VERSION
|
8
|
-
|
9
|
-
Object.const_set :RUBY_VERSION, "8.2.3"
|
10
|
-
|
11
|
-
dir = "#{File.expand_path('../', __FILE__)}/versions"
|
12
|
-
@method82 = "#{dir}/method_8.2.rb"
|
13
|
-
@method823 = "#{dir}/method_8.2.3.rb"
|
14
|
-
end
|
15
|
-
|
16
|
-
after :all do
|
17
|
-
Object.const_set :RUBY_VERSION, @ruby_version
|
18
|
-
end
|
19
|
-
|
20
|
-
it "loads the most version-specific file if it exists" do
|
21
|
-
File.should_receive(:exists?).with(@method823).and_return(true)
|
22
|
-
should_receive(:require).with(@method823)
|
23
|
-
language_version __FILE__, "method"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "loads a less version-specific file if it exists" do
|
27
|
-
File.should_receive(:exists?).with(@method823).and_return(false)
|
28
|
-
File.should_receive(:exists?).with(@method82).and_return(true)
|
29
|
-
should_receive(:require).with(@method82)
|
30
|
-
language_version __FILE__, "method"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "does not load the file if it does not exist" do
|
34
|
-
File.should_receive(:exists?).with(@method82).and_return(false)
|
35
|
-
File.should_receive(:exists?).with(@method823).and_return(false)
|
36
|
-
should_not_receive(:require).with(@method82)
|
37
|
-
should_not_receive(:require).with(@method823)
|
38
|
-
language_version __FILE__, "method"
|
39
|
-
end
|
40
|
-
end
|