mspec 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README +101 -0
- data/Rakefile +44 -0
- data/bin/mkspec +7 -0
- data/bin/mspec +7 -0
- data/bin/mspec-ci +8 -0
- data/bin/mspec-run +8 -0
- data/bin/mspec-tag +8 -0
- data/lib/mspec.rb +6 -0
- data/lib/mspec/commands/mkspec.rb +147 -0
- data/lib/mspec/commands/mspec-ci.rb +71 -0
- data/lib/mspec/commands/mspec-run.rb +80 -0
- data/lib/mspec/commands/mspec-tag.rb +87 -0
- data/lib/mspec/commands/mspec.rb +143 -0
- data/lib/mspec/expectations.rb +2 -0
- data/lib/mspec/expectations/expectations.rb +12 -0
- data/lib/mspec/expectations/should.rb +23 -0
- data/lib/mspec/guards.rb +13 -0
- data/lib/mspec/guards/bug.rb +27 -0
- data/lib/mspec/guards/compliance.rb +18 -0
- data/lib/mspec/guards/conflict.rb +16 -0
- data/lib/mspec/guards/endian.rb +40 -0
- data/lib/mspec/guards/extensions.rb +12 -0
- data/lib/mspec/guards/guard.rb +120 -0
- data/lib/mspec/guards/noncompliance.rb +12 -0
- data/lib/mspec/guards/platform.rb +38 -0
- data/lib/mspec/guards/quarantine.rb +15 -0
- data/lib/mspec/guards/runner.rb +30 -0
- data/lib/mspec/guards/superuser.rb +15 -0
- data/lib/mspec/guards/support.rb +12 -0
- data/lib/mspec/guards/version.rb +40 -0
- data/lib/mspec/helpers.rb +6 -0
- data/lib/mspec/helpers/bignum.rb +5 -0
- data/lib/mspec/helpers/const_lookup.rb +5 -0
- data/lib/mspec/helpers/flunk.rb +5 -0
- data/lib/mspec/helpers/io.rb +13 -0
- data/lib/mspec/helpers/scratch.rb +17 -0
- data/lib/mspec/helpers/tmp.rb +32 -0
- data/lib/mspec/matchers.rb +16 -0
- data/lib/mspec/matchers/base.rb +95 -0
- data/lib/mspec/matchers/be_ancestor_of.rb +24 -0
- data/lib/mspec/matchers/be_close.rb +27 -0
- data/lib/mspec/matchers/be_empty.rb +20 -0
- data/lib/mspec/matchers/be_false.rb +20 -0
- data/lib/mspec/matchers/be_kind_of.rb +24 -0
- data/lib/mspec/matchers/be_nil.rb +20 -0
- data/lib/mspec/matchers/be_true.rb +20 -0
- data/lib/mspec/matchers/complain.rb +56 -0
- data/lib/mspec/matchers/eql.rb +26 -0
- data/lib/mspec/matchers/equal.rb +26 -0
- data/lib/mspec/matchers/equal_utf16.rb +34 -0
- data/lib/mspec/matchers/include.rb +32 -0
- data/lib/mspec/matchers/output.rb +67 -0
- data/lib/mspec/matchers/output_to_fd.rb +71 -0
- data/lib/mspec/matchers/raise_error.rb +48 -0
- data/lib/mspec/mocks.rb +3 -0
- data/lib/mspec/mocks/mock.rb +123 -0
- data/lib/mspec/mocks/object.rb +28 -0
- data/lib/mspec/mocks/proxy.rb +112 -0
- data/lib/mspec/runner.rb +13 -0
- data/lib/mspec/runner/actions.rb +6 -0
- data/lib/mspec/runner/actions/debug.rb +17 -0
- data/lib/mspec/runner/actions/filter.rb +40 -0
- data/lib/mspec/runner/actions/gdb.rb +17 -0
- data/lib/mspec/runner/actions/tag.rb +97 -0
- data/lib/mspec/runner/actions/tally.rb +80 -0
- data/lib/mspec/runner/actions/timer.rb +22 -0
- data/lib/mspec/runner/filters.rb +4 -0
- data/lib/mspec/runner/filters/match.rb +22 -0
- data/lib/mspec/runner/filters/profile.rb +54 -0
- data/lib/mspec/runner/filters/regexp.rb +7 -0
- data/lib/mspec/runner/filters/tag.rb +29 -0
- data/lib/mspec/runner/formatters.rb +7 -0
- data/lib/mspec/runner/formatters/dotted.rb +81 -0
- data/lib/mspec/runner/formatters/html.rb +87 -0
- data/lib/mspec/runner/formatters/specdoc.rb +27 -0
- data/lib/mspec/runner/formatters/spinner.rb +89 -0
- data/lib/mspec/runner/formatters/summary.rb +8 -0
- data/lib/mspec/runner/formatters/unit.rb +25 -0
- data/lib/mspec/runner/formatters/yaml.rb +43 -0
- data/lib/mspec/runner/mspec.rb +232 -0
- data/lib/mspec/runner/object.rb +20 -0
- data/lib/mspec/runner/shared.rb +12 -0
- data/lib/mspec/runner/state.rb +116 -0
- data/lib/mspec/runner/tag.rb +20 -0
- data/lib/mspec/utils/name_map.rb +130 -0
- data/lib/mspec/utils/options.rb +344 -0
- data/lib/mspec/utils/script.rb +77 -0
- data/lib/mspec/version.rb +3 -0
- data/spec/commands/mkspec_spec.rb +321 -0
- data/spec/commands/mspec_ci_spec.rb +139 -0
- data/spec/commands/mspec_run_spec.rb +146 -0
- data/spec/commands/mspec_spec.rb +359 -0
- data/spec/commands/mspec_tag_spec.rb +131 -0
- data/spec/expectations/expectations_spec.rb +16 -0
- data/spec/expectations/should_spec.rb +99 -0
- data/spec/guards/bug_spec.rb +137 -0
- data/spec/guards/compliance_spec.rb +70 -0
- data/spec/guards/conflict_spec.rb +20 -0
- data/spec/guards/endian_spec.rb +42 -0
- data/spec/guards/extensions_spec.rb +36 -0
- data/spec/guards/guard_spec.rb +355 -0
- data/spec/guards/noncompliance_spec.rb +36 -0
- data/spec/guards/platform_spec.rb +84 -0
- data/spec/guards/quarantine_spec.rb +19 -0
- data/spec/guards/runner_spec.rb +75 -0
- data/spec/guards/superuser_spec.rb +22 -0
- data/spec/guards/support_spec.rb +22 -0
- data/spec/guards/version_spec.rb +133 -0
- data/spec/helpers/bignum_spec.rb +11 -0
- data/spec/helpers/const_lookup_spec.rb +19 -0
- data/spec/helpers/flunk_spec.rb +15 -0
- data/spec/helpers/io_spec.rb +34 -0
- data/spec/helpers/scratch_spec.rb +22 -0
- data/spec/helpers/tmp_spec.rb +72 -0
- data/spec/matchers/base_spec.rb +180 -0
- data/spec/matchers/be_ancestor_of_spec.rb +28 -0
- data/spec/matchers/be_close_spec.rb +46 -0
- data/spec/matchers/be_empty_spec.rb +26 -0
- data/spec/matchers/be_false_spec.rb +28 -0
- data/spec/matchers/be_kind_of_spec.rb +29 -0
- data/spec/matchers/be_nil_spec.rb +27 -0
- data/spec/matchers/be_true_spec.rb +28 -0
- data/spec/matchers/complain_spec.rb +52 -0
- data/spec/matchers/eql_spec.rb +33 -0
- data/spec/matchers/equal_spec.rb +33 -0
- data/spec/matchers/equal_utf16_spec.rb +47 -0
- data/spec/matchers/include_spec.rb +37 -0
- data/spec/matchers/output_spec.rb +74 -0
- data/spec/matchers/output_to_fd_spec.rb +33 -0
- data/spec/matchers/raise_error_spec.rb +56 -0
- data/spec/mocks/mock_spec.rb +272 -0
- data/spec/mocks/proxy_spec.rb +259 -0
- data/spec/runner/actions/debug_spec.rb +61 -0
- data/spec/runner/actions/filter_spec.rb +84 -0
- data/spec/runner/actions/gdb_spec.rb +61 -0
- data/spec/runner/actions/tag_spec.rb +253 -0
- data/spec/runner/actions/tally_spec.rb +107 -0
- data/spec/runner/actions/timer_spec.rb +42 -0
- data/spec/runner/filters/a.yaml +4 -0
- data/spec/runner/filters/b.yaml +11 -0
- data/spec/runner/filters/match_spec.rb +44 -0
- data/spec/runner/filters/profile_spec.rb +117 -0
- data/spec/runner/filters/regexp_spec.rb +13 -0
- data/spec/runner/filters/tag_spec.rb +77 -0
- data/spec/runner/formatters/dotted_spec.rb +184 -0
- data/spec/runner/formatters/html_spec.rb +191 -0
- data/spec/runner/formatters/specdoc_spec.rb +57 -0
- data/spec/runner/formatters/spinner_spec.rb +78 -0
- data/spec/runner/formatters/summary_spec.rb +29 -0
- data/spec/runner/formatters/unit_spec.rb +71 -0
- data/spec/runner/formatters/yaml_spec.rb +123 -0
- data/spec/runner/mspec_spec.rb +393 -0
- data/spec/runner/shared_spec.rb +41 -0
- data/spec/runner/state_spec.rb +535 -0
- data/spec/runner/tag_spec.rb +93 -0
- data/spec/runner/tags.txt +3 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/utils/name_map_spec.rb +178 -0
- data/spec/utils/options_spec.rb +862 -0
- data/spec/utils/script_spec.rb +240 -0
- metadata +217 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'mspec/runner/mspec'
|
2
|
+
require 'mspec/runner/actions/tally'
|
3
|
+
|
4
|
+
unless defined?(RUBY_NAME) and RUBY_NAME
|
5
|
+
if defined?(RUBY_ENGINE) and RUBY_ENGINE
|
6
|
+
RUBY_NAME = RUBY_ENGINE
|
7
|
+
if defined?(ARG0)
|
8
|
+
RUBY_CLI = /rubinius|rbx/.match(ARG0) ? "shotgun/rubinius" : ARG0
|
9
|
+
else
|
10
|
+
RUBY_CLI = RUBY_NAME
|
11
|
+
end
|
12
|
+
else
|
13
|
+
require 'rbconfig'
|
14
|
+
RUBY_NAME = Config::CONFIG["RUBY_INSTALL_NAME"] || Config::CONFIG["ruby_install_name"]
|
15
|
+
RUBY_CLI = RUBY_NAME
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class SpecGuard
|
20
|
+
def self.register
|
21
|
+
unless @registered
|
22
|
+
@tally = TallyAction.new
|
23
|
+
@tally.register
|
24
|
+
MSpec.register :finish, self
|
25
|
+
@registered = true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.unregister
|
30
|
+
@tally.unregister if @tally
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.finish
|
34
|
+
print "\n#{self.class}\n#{@tally.format}\n"
|
35
|
+
end
|
36
|
+
|
37
|
+
def initialize(*args)
|
38
|
+
@args = args
|
39
|
+
end
|
40
|
+
|
41
|
+
def yield?(invert=false)
|
42
|
+
if MSpec.report_mode?
|
43
|
+
self.class.register
|
44
|
+
MSpec.register :before, self
|
45
|
+
return true
|
46
|
+
elsif MSpec.verify_mode?
|
47
|
+
self.class.register
|
48
|
+
MSpec.register :after, self
|
49
|
+
return true
|
50
|
+
end
|
51
|
+
return match? ^ invert
|
52
|
+
end
|
53
|
+
|
54
|
+
def ===(other)
|
55
|
+
true
|
56
|
+
end
|
57
|
+
|
58
|
+
def before(state)
|
59
|
+
end
|
60
|
+
|
61
|
+
def after(state)
|
62
|
+
end
|
63
|
+
|
64
|
+
def unregister
|
65
|
+
MSpec.unregister :before, self
|
66
|
+
MSpec.unregister :after, self
|
67
|
+
MSpec.unregister :exclude, self
|
68
|
+
self.class.unregister
|
69
|
+
end
|
70
|
+
|
71
|
+
def implementation?(*args)
|
72
|
+
args.any? do |name|
|
73
|
+
!!case name
|
74
|
+
when :rbx, :rubinius
|
75
|
+
RUBY_NAME =~ /^rbx/
|
76
|
+
when :ruby
|
77
|
+
RUBY_NAME =~ /^ruby/
|
78
|
+
when :ruby18
|
79
|
+
RUBY_NAME =~ /^ruby(1.8)?/ and RUBY_VERSION =~ /^1.8/
|
80
|
+
when :ruby19
|
81
|
+
RUBY_NAME =~ /^ruby(1.9)?/ and RUBY_VERSION =~ /^1.9/
|
82
|
+
when :jruby
|
83
|
+
RUBY_NAME =~ /^jruby/
|
84
|
+
else
|
85
|
+
false
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def windows?(sym, key)
|
91
|
+
sym == :windows && !!key.match(/(mswin|mingw)/)
|
92
|
+
end
|
93
|
+
|
94
|
+
def platform?(*args)
|
95
|
+
args.any? do |platform|
|
96
|
+
if platform != :java && RUBY_PLATFORM.match('java') && os?(platform)
|
97
|
+
true
|
98
|
+
else
|
99
|
+
RUBY_PLATFORM.match(platform.to_s) || windows?(platform, RUBY_PLATFORM)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def wordsize?(size)
|
105
|
+
size == 8 * 1.size
|
106
|
+
end
|
107
|
+
|
108
|
+
def os?(*oses)
|
109
|
+
require 'rbconfig'
|
110
|
+
oses.any? do |os|
|
111
|
+
host_os = Config::CONFIG['host_os'] || RUBY_PLATFORM
|
112
|
+
host_os.downcase!
|
113
|
+
host_os.match(os.to_s) || windows?(os, host_os)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def match?
|
118
|
+
implementation?(*@args) or platform?(*@args)
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'mspec/guards/guard'
|
2
|
+
|
3
|
+
class PlatformGuard < SpecGuard
|
4
|
+
def initialize(*args)
|
5
|
+
if args.last.is_a?(Hash)
|
6
|
+
@options, @platforms = args.last, args[0..-2]
|
7
|
+
else
|
8
|
+
@options, @platforms = {}, args
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def match?
|
13
|
+
match = @platforms.empty? ? true : platform?(*@platforms)
|
14
|
+
@options.each do |key, value|
|
15
|
+
case key
|
16
|
+
when :os
|
17
|
+
match &&= os?(*value)
|
18
|
+
when :wordsize
|
19
|
+
match &&= wordsize? value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
match
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Object
|
27
|
+
def platform_is(*args)
|
28
|
+
g = PlatformGuard.new(*args)
|
29
|
+
yield if g.yield?
|
30
|
+
g.unregister
|
31
|
+
end
|
32
|
+
|
33
|
+
def platform_is_not(*args)
|
34
|
+
g = PlatformGuard.new(*args)
|
35
|
+
yield if g.yield? true
|
36
|
+
g.unregister
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'mspec/guards/guard'
|
2
|
+
|
3
|
+
class RunnerGuard < SpecGuard
|
4
|
+
def match?
|
5
|
+
@args.any? do |runner|
|
6
|
+
case runner
|
7
|
+
when :mspec
|
8
|
+
ENV['MSPEC_RUNNER'] == '1'
|
9
|
+
when :rspec
|
10
|
+
ENV['RSPEC_RUNNER'] == '1' or Object.const_defined?(:Spec)
|
11
|
+
else
|
12
|
+
false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Object
|
19
|
+
def runner_is(*args)
|
20
|
+
g = RunnerGuard.new(*args)
|
21
|
+
yield if g.yield?
|
22
|
+
g.unregister
|
23
|
+
end
|
24
|
+
|
25
|
+
def runner_is_not(*args)
|
26
|
+
g = RunnerGuard.new(*args)
|
27
|
+
yield if g.yield? true
|
28
|
+
g.unregister
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'mspec/guards/guard'
|
2
|
+
|
3
|
+
class VersionGuard < SpecGuard
|
4
|
+
def initialize(version)
|
5
|
+
case version
|
6
|
+
when String
|
7
|
+
@version = to_v version
|
8
|
+
when Range
|
9
|
+
a = to_v version.first
|
10
|
+
b = to_v version.last
|
11
|
+
@version = version.exclude_end? ? a...b : a..b
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_v(str)
|
16
|
+
major, minor, tiny, patch = str.split "."
|
17
|
+
("1%02d%02d%02d%04d" % [major, minor, tiny, patch].map { |x| x.to_i }).to_i
|
18
|
+
end
|
19
|
+
|
20
|
+
def ruby_version
|
21
|
+
to_v("#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def match?
|
25
|
+
case @version
|
26
|
+
when Integer
|
27
|
+
ruby_version >= @version
|
28
|
+
when Range
|
29
|
+
@version.include? ruby_version
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Object
|
35
|
+
def ruby_version_is(*args)
|
36
|
+
g = VersionGuard.new(*args)
|
37
|
+
yield if g.yield?
|
38
|
+
g.unregister
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# The #tmp method provides a similar functionality
|
2
|
+
# to that of Dir.tmpdir. This helper can be overridden
|
3
|
+
# by different implementations to provide a more useful
|
4
|
+
# behavior if needed.
|
5
|
+
#
|
6
|
+
# Usage in a spec:
|
7
|
+
#
|
8
|
+
# File.open(tmp("tags.txt"), "w") { |f| f.puts "" }
|
9
|
+
#
|
10
|
+
# The order of directories below with "/private/tmp"
|
11
|
+
# preceding "/tmp" is significant. On OS X, the directory
|
12
|
+
# "/tmp" is a symlink to "private/tmp" with no leading
|
13
|
+
# "/". Rather than futzing with what constitutes an
|
14
|
+
# absolute path, we just look for "/private/tmp" first.
|
15
|
+
|
16
|
+
class Object
|
17
|
+
def tmp(name)
|
18
|
+
unless @spec_temp_directory
|
19
|
+
[ "/private/tmp", "/tmp", "/var/tmp", ENV["TMPDIR"], ENV["TMP"],
|
20
|
+
ENV["TEMP"], ENV["USERPROFILE"] ].each do |dir|
|
21
|
+
if dir and File.directory?(dir) and File.writable?(dir)
|
22
|
+
temp = File.expand_path dir
|
23
|
+
temp = File.readlink temp if File.symlink? temp
|
24
|
+
@spec_temp_directory = temp
|
25
|
+
break
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
File.join @spec_temp_directory, name
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'mspec/matchers/base'
|
2
|
+
require 'mspec/matchers/be_ancestor_of'
|
3
|
+
require 'mspec/matchers/be_close'
|
4
|
+
require 'mspec/matchers/be_empty'
|
5
|
+
require 'mspec/matchers/be_false'
|
6
|
+
require 'mspec/matchers/be_kind_of'
|
7
|
+
require 'mspec/matchers/be_nil'
|
8
|
+
require 'mspec/matchers/be_true'
|
9
|
+
require 'mspec/matchers/equal'
|
10
|
+
require 'mspec/matchers/eql'
|
11
|
+
require 'mspec/matchers/include'
|
12
|
+
require 'mspec/matchers/raise_error'
|
13
|
+
require 'mspec/matchers/output'
|
14
|
+
require 'mspec/matchers/output_to_fd'
|
15
|
+
require 'mspec/matchers/complain'
|
16
|
+
require 'mspec/matchers/equal_utf16'
|
@@ -0,0 +1,95 @@
|
|
1
|
+
class PositiveOperatorMatcher
|
2
|
+
def initialize(actual)
|
3
|
+
@actual = actual
|
4
|
+
end
|
5
|
+
|
6
|
+
def ==(expected)
|
7
|
+
unless @actual == expected
|
8
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
9
|
+
"to equal #{expected.pretty_inspect}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def <(expected)
|
14
|
+
unless @actual < expected
|
15
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
16
|
+
"to be less than #{expected.pretty_inspect}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def <=(expected)
|
21
|
+
unless @actual <= expected
|
22
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
23
|
+
"to be less than or equal to #{expected.pretty_inspect}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def >(expected)
|
28
|
+
unless @actual > expected
|
29
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
30
|
+
"to be greater than #{expected.pretty_inspect}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def >=(expected)
|
35
|
+
unless @actual >= expected
|
36
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
37
|
+
"to be greater than or equal to #{expected.pretty_inspect}")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def =~(expected)
|
42
|
+
unless @actual =~ expected
|
43
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
44
|
+
"to match #{expected.pretty_inspect}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class NegativeOperatorMatcher
|
50
|
+
def initialize(actual)
|
51
|
+
@actual = actual
|
52
|
+
end
|
53
|
+
|
54
|
+
def ==(expected)
|
55
|
+
if @actual == expected
|
56
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
57
|
+
"not to equal #{expected.pretty_inspect}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def <(expected)
|
62
|
+
if @actual < expected
|
63
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
64
|
+
"not to be less than #{expected.pretty_inspect}")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def <=(expected)
|
69
|
+
if @actual <= expected
|
70
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
71
|
+
"not to be less than or equal to #{expected.pretty_inspect}")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def >(expected)
|
76
|
+
if @actual > expected
|
77
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
78
|
+
"not to be greater than #{expected.pretty_inspect}")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def >=(expected)
|
83
|
+
if @actual >= expected
|
84
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
85
|
+
"not to be greater than or equal to #{expected.pretty_inspect}")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def =~(expected)
|
90
|
+
if @actual =~ expected
|
91
|
+
Expectation.fail_with("Expected #{@actual.pretty_inspect}",
|
92
|
+
"not to match #{expected.pretty_inspect}")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|