spicycode-micronaut 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +23 -10
- data/examples/example_helper.rb +3 -3
- data/examples/lib/micronaut/behaviour_group_example.rb +175 -0
- data/examples/lib/micronaut/expectations/differs/default_example.rb +1 -2
- data/examples/lib/micronaut/expectations/extensions/object_example.rb +15 -8
- data/examples/lib/micronaut/expectations/fail_with_example.rb +2 -2
- data/examples/lib/micronaut/matchers/be_close_example.rb +42 -0
- data/examples/lib/micronaut/matchers/be_example.rb +257 -0
- data/examples/lib/micronaut/matchers/change_example.rb +329 -0
- data/examples/lib/micronaut/matchers/description_generation_example.rb +167 -0
- data/examples/lib/micronaut/matchers/eql_example.rb +29 -0
- data/examples/lib/micronaut/matchers/equal_example.rb +29 -0
- data/examples/lib/micronaut/matchers/exist_example.rb +69 -0
- data/examples/lib/micronaut/matchers/handler_example.rb +146 -0
- data/examples/lib/micronaut/matchers/has_example.rb +63 -0
- data/examples/lib/micronaut/matchers/have_example.rb +575 -0
- data/examples/lib/micronaut/matchers/include_example.rb +88 -0
- data/examples/lib/micronaut/matchers/match_example.rb +41 -0
- data/examples/lib/micronaut/matchers/matcher_methods_example.rb +66 -0
- data/examples/lib/micronaut/matchers/operator_matcher_example.rb +191 -0
- data/examples/lib/micronaut/matchers/raise_error_example.rb +315 -0
- data/examples/lib/micronaut/matchers/respond_to_example.rb +54 -0
- data/examples/lib/micronaut/matchers/satisfy_example.rb +36 -0
- data/examples/lib/micronaut/matchers/simple_matcher_example.rb +93 -0
- data/examples/lib/micronaut/matchers/throw_symbol_example.rb +96 -0
- data/examples/resources/example_classes.rb +67 -0
- data/lib/autotest/micronaut.rb +9 -4
- data/lib/micronaut/behaviour_group.rb +43 -0
- data/lib/micronaut/behaviour_group_class_methods.rb +134 -0
- data/lib/micronaut/example_runner.rb +7 -9
- data/lib/micronaut/example_world.rb +11 -7
- data/lib/micronaut/expectations/differs/default.rb +6 -15
- data/lib/micronaut/expectations/errors.rb +7 -0
- data/lib/micronaut/expectations/{object_extensions.rb → extensions/object.rb} +5 -4
- data/lib/micronaut/expectations/{string_and_symbol_extensions.rb → extensions/string_and_symbol.rb} +0 -0
- data/lib/micronaut/expectations/extensions.rb +2 -0
- data/lib/micronaut/expectations/wrap_expectation.rb +5 -0
- data/lib/micronaut/expectations.rb +5 -5
- data/lib/micronaut/extensions/kernel.rb +2 -4
- data/lib/micronaut/matchers/be_close.rb +6 -22
- data/lib/micronaut/matchers/eql.rb +7 -25
- data/lib/micronaut/matchers/equal.rb +6 -24
- data/lib/micronaut/matchers/exist.rb +8 -14
- data/lib/micronaut/matchers/has.rb +12 -28
- data/lib/micronaut/matchers/include.rb +12 -9
- data/lib/micronaut/matchers/match.rb +8 -27
- data/lib/micronaut/matchers/method_missing.rb +1 -1
- data/lib/micronaut/matchers/operator_matcher.rb +23 -46
- data/lib/micronaut/matchers/raise_error.rb +4 -8
- data/lib/micronaut/matchers/respond_to.rb +2 -1
- data/lib/micronaut/matchers/throw_symbol.rb +9 -3
- data/lib/micronaut/matchers.rb +10 -3
- data/lib/micronaut/mocking/with_mocha.rb +0 -1
- data/lib/micronaut.rb +3 -3
- metadata +31 -7
- data/examples/lib/micronaut/example_group_example.rb +0 -116
- data/lib/micronaut/example_group.rb +0 -100
- data/lib/micronaut/exceptions.rb +0 -7
@@ -1,37 +1,21 @@
|
|
1
1
|
module Micronaut
|
2
2
|
module Matchers
|
3
3
|
|
4
|
-
class BeClose #:nodoc:
|
5
|
-
def initialize(expected, delta)
|
6
|
-
@expected = expected
|
7
|
-
@delta = delta
|
8
|
-
end
|
9
|
-
|
10
|
-
def matches?(given)
|
11
|
-
@given = given
|
12
|
-
(@given - @expected).abs < @delta
|
13
|
-
end
|
14
|
-
|
15
|
-
def failure_message
|
16
|
-
"expected #{@expected} +/- (< #{@delta}), got #{@given}"
|
17
|
-
end
|
18
|
-
|
19
|
-
def description
|
20
|
-
"be close to #{@expected} (within +- #{@delta})"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
4
|
# :call-seq:
|
25
5
|
# should be_close(expected, delta)
|
26
6
|
# should_not be_close(expected, delta)
|
27
7
|
#
|
28
|
-
# Passes if
|
8
|
+
# Passes if actual == expected +/- delta
|
29
9
|
#
|
30
10
|
# == Example
|
31
11
|
#
|
32
12
|
# result.should be_close(3.0, 0.5)
|
33
13
|
def be_close(expected, delta)
|
34
|
-
|
14
|
+
simple_matcher do |actual, matcher|
|
15
|
+
matcher.failure_message = "expected #{expected} +/- (< #{delta}), got #{actual}"
|
16
|
+
matcher.description = "be close to #{expected} (within +- #{delta})"
|
17
|
+
(actual - expected).abs < delta
|
18
|
+
end
|
35
19
|
end
|
36
20
|
end
|
37
21
|
end
|
@@ -1,34 +1,11 @@
|
|
1
1
|
module Micronaut
|
2
2
|
module Matchers
|
3
3
|
|
4
|
-
class Eql #:nodoc:
|
5
|
-
def initialize(expected)
|
6
|
-
@expected = expected
|
7
|
-
end
|
8
|
-
|
9
|
-
def matches?(given)
|
10
|
-
@given = given
|
11
|
-
@given.eql?(@expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
def failure_message
|
15
|
-
return "expected #{@expected.inspect}, got #{@given.inspect} (using .eql?)", @expected, @given
|
16
|
-
end
|
17
|
-
|
18
|
-
def negative_failure_message
|
19
|
-
return "expected #{@given.inspect} not to equal #{@expected.inspect} (using .eql?)", @expected, @given
|
20
|
-
end
|
21
|
-
|
22
|
-
def description
|
23
|
-
"eql #{@expected.inspect}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
4
|
# :call-seq:
|
28
5
|
# should eql(expected)
|
29
6
|
# should_not eql(expected)
|
30
7
|
#
|
31
|
-
# Passes if
|
8
|
+
# Passes if actual and expected are of equal value, but not necessarily the same object.
|
32
9
|
#
|
33
10
|
# See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby.
|
34
11
|
#
|
@@ -37,7 +14,12 @@ module Micronaut
|
|
37
14
|
# 5.should eql(5)
|
38
15
|
# 5.should_not eql(3)
|
39
16
|
def eql(expected)
|
40
|
-
|
17
|
+
simple_matcher do |actual, matcher|
|
18
|
+
matcher.failure_message = "expected #{expected.inspect}, got #{actual.inspect} (using .eql?)", expected, actual
|
19
|
+
matcher.negative_failure_message = "expected #{actual.inspect} not to equal #{expected.inspect} (using .eql?)", expected, actual
|
20
|
+
matcher.description = "eql #{expected.inspect}"
|
21
|
+
actual.eql?(expected)
|
22
|
+
end
|
41
23
|
end
|
42
24
|
end
|
43
25
|
end
|
@@ -1,29 +1,6 @@
|
|
1
1
|
module Micronaut
|
2
2
|
module Matchers
|
3
3
|
|
4
|
-
class Equal #:nodoc:
|
5
|
-
def initialize(expected)
|
6
|
-
@expected = expected
|
7
|
-
end
|
8
|
-
|
9
|
-
def matches?(given)
|
10
|
-
@given = given
|
11
|
-
@given.equal?(@expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
def failure_message
|
15
|
-
return "expected #{@expected.inspect}, got #{@given.inspect} (using .equal?)", @expected, @given
|
16
|
-
end
|
17
|
-
|
18
|
-
def negative_failure_message
|
19
|
-
return "expected #{@given.inspect} not to equal #{@expected.inspect} (using .equal?)", @expected, @given
|
20
|
-
end
|
21
|
-
|
22
|
-
def description
|
23
|
-
"equal #{@expected.inspect}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
4
|
# :call-seq:
|
28
5
|
# should equal(expected)
|
29
6
|
# should_not equal(expected)
|
@@ -37,7 +14,12 @@ module Micronaut
|
|
37
14
|
# 5.should equal(5) #Fixnums are equal
|
38
15
|
# "5".should_not equal("5") #Strings that look the same are not the same object
|
39
16
|
def equal(expected)
|
40
|
-
|
17
|
+
simple_matcher do |actual, matcher|
|
18
|
+
matcher.failure_message = "expected #{expected.inspect}, got #{actual.inspect} (using .equal?)", expected, actual
|
19
|
+
matcher.negative_failure_message = "expected #{actual.inspect} not to equal #{expected.inspect} (using .equal?)", expected, actual
|
20
|
+
matcher.description = "equal #{expected.inspect}"
|
21
|
+
actual.equal?(expected)
|
22
|
+
end
|
41
23
|
end
|
42
24
|
end
|
43
25
|
end
|
@@ -1,22 +1,16 @@
|
|
1
1
|
module Micronaut
|
2
2
|
module Matchers
|
3
|
-
class Exist
|
4
|
-
def matches?(given)
|
5
|
-
@given = given
|
6
|
-
@given.exist?
|
7
|
-
end
|
8
|
-
def failure_message
|
9
|
-
"expected #{@given.inspect} to exist, but it doesn't."
|
10
|
-
end
|
11
|
-
def negative_failure_message
|
12
|
-
"expected #{@given.inspect} to not exist, but it does."
|
13
|
-
end
|
14
|
-
end
|
15
3
|
# :call-seq:
|
16
4
|
# should exist
|
17
5
|
# should_not exist
|
18
6
|
#
|
19
|
-
# Passes if
|
20
|
-
def exist
|
7
|
+
# Passes if actual.exist?
|
8
|
+
def exist
|
9
|
+
simple_matcher do |actual, matcher|
|
10
|
+
matcher.failure_message = "expected #{actual.inspect} to exist, but it doesn't."
|
11
|
+
matcher.negative_failure_message = "expected #{actual.inspect} to not exist, but it does."
|
12
|
+
actual.exist?
|
13
|
+
end
|
14
|
+
end
|
21
15
|
end
|
22
16
|
end
|
@@ -1,34 +1,18 @@
|
|
1
1
|
module Micronaut
|
2
2
|
module Matchers
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def matches?(given)
|
11
|
-
given.__send__(predicate, *@args)
|
12
|
-
end
|
13
|
-
|
14
|
-
def failure_message
|
15
|
-
"expected ##{predicate}(#{@args[0].inspect}) to return true, got false"
|
16
|
-
end
|
17
|
-
|
18
|
-
def negative_failure_message
|
19
|
-
"expected ##{predicate}(#{@args[0].inspect}) to return false, got true"
|
3
|
+
def has(sym, *args) # :nodoc:
|
4
|
+
simple_matcher do |actual, matcher|
|
5
|
+
matcher.failure_message = "expected ##{predicate(sym)}(#{args[0].inspect}) to return true, got false"
|
6
|
+
matcher.negative_failure_message = "expected ##{predicate(sym)}(#{args[0].inspect}) to return false, got true"
|
7
|
+
matcher.description = "have key #{args[0].inspect}"
|
8
|
+
actual.__send__(predicate(sym), *args)
|
20
9
|
end
|
21
|
-
|
22
|
-
def description
|
23
|
-
"have key #{@args[0].inspect}"
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
def predicate
|
28
|
-
"#{@sym.to_s.sub("have_","has_")}?".to_sym
|
29
|
-
end
|
30
|
-
|
31
10
|
end
|
32
|
-
|
11
|
+
|
12
|
+
private
|
13
|
+
def predicate(sym)
|
14
|
+
"#{sym.to_s.sub("have_","has_")}?".to_sym
|
15
|
+
end
|
16
|
+
|
33
17
|
end
|
34
18
|
end
|
@@ -7,16 +7,19 @@ module Micronaut
|
|
7
7
|
@expecteds = expecteds
|
8
8
|
end
|
9
9
|
|
10
|
-
def matches?(
|
11
|
-
@
|
10
|
+
def matches?(actual)
|
11
|
+
@actual = actual
|
12
12
|
@expecteds.each do |expected|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
if actual.is_a?(Hash)
|
14
|
+
if expected.is_a?(Hash)
|
15
|
+
expected.each_pair do |k,v|
|
16
|
+
return false unless actual[k] == v
|
17
|
+
end
|
18
|
+
else
|
19
|
+
return false unless actual.has_key?(expected)
|
17
20
|
end
|
18
21
|
else
|
19
|
-
return false unless
|
22
|
+
return false unless actual.include?(expected)
|
20
23
|
end
|
21
24
|
end
|
22
25
|
true
|
@@ -36,7 +39,7 @@ module Micronaut
|
|
36
39
|
|
37
40
|
private
|
38
41
|
def _message(maybe_not="")
|
39
|
-
"expected #{@
|
42
|
+
"expected #{@actual.inspect} #{maybe_not}to include #{_pretty_print(@expecteds)}"
|
40
43
|
end
|
41
44
|
|
42
45
|
def _pretty_print(array)
|
@@ -58,7 +61,7 @@ module Micronaut
|
|
58
61
|
# should include(expected)
|
59
62
|
# should_not include(expected)
|
60
63
|
#
|
61
|
-
# Passes if
|
64
|
+
# Passes if actual includes expected. This works for
|
62
65
|
# collections and Strings. You can also pass in multiple args
|
63
66
|
# and it will only pass if all args are found in collection.
|
64
67
|
#
|
@@ -1,41 +1,22 @@
|
|
1
1
|
module Micronaut
|
2
2
|
module Matchers
|
3
3
|
|
4
|
-
class Match #:nodoc:
|
5
|
-
def initialize(regexp)
|
6
|
-
@regexp = regexp
|
7
|
-
end
|
8
|
-
|
9
|
-
def matches?(given)
|
10
|
-
@given = given
|
11
|
-
return true if given =~ @regexp
|
12
|
-
return false
|
13
|
-
end
|
14
|
-
|
15
|
-
def failure_message
|
16
|
-
return "expected #{@given.inspect} to match #{@regexp.inspect}", @regexp, @given
|
17
|
-
end
|
18
|
-
|
19
|
-
def negative_failure_message
|
20
|
-
return "expected #{@given.inspect} not to match #{@regexp.inspect}", @regexp, @given
|
21
|
-
end
|
22
|
-
|
23
|
-
def description
|
24
|
-
"match #{@regexp.inspect}"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
4
|
# :call-seq:
|
29
5
|
# should match(regexp)
|
30
6
|
# should_not match(regexp)
|
31
7
|
#
|
32
|
-
# Given a Regexp, passes if
|
8
|
+
# Given a Regexp, passes if actual =~ regexp
|
33
9
|
#
|
34
10
|
# == Examples
|
35
11
|
#
|
36
|
-
# email.should match(/^([
|
12
|
+
# email.should match(/^([^\s]+)((?:[-a-z0-9]+\.)+[a-z]{2,})$/i)
|
37
13
|
def match(regexp)
|
38
|
-
|
14
|
+
simple_matcher do |actual, matcher|
|
15
|
+
matcher.failure_message = "expected #{actual.inspect} to match #{regexp.inspect}", regexp, actual
|
16
|
+
matcher.negative_failure_message = "expected #{actual.inspect} not to match #{regexp.inspect}", regexp, actual
|
17
|
+
matcher.description = "match #{regexp.inspect}"
|
18
|
+
actual =~ regexp
|
19
|
+
end
|
39
20
|
end
|
40
21
|
end
|
41
22
|
end
|
@@ -2,7 +2,7 @@ module Micronaut
|
|
2
2
|
module Matchers
|
3
3
|
def method_missing(sym, *args, &block) # :nodoc:
|
4
4
|
return Matchers::Be.new(sym, *args) if sym.starts_with?("be_")
|
5
|
-
return
|
5
|
+
return has(sym, *args) if sym.starts_with?("have_")
|
6
6
|
super
|
7
7
|
end
|
8
8
|
end
|
@@ -1,40 +1,20 @@
|
|
1
1
|
module Micronaut
|
2
2
|
module Matchers
|
3
|
-
class
|
4
|
-
def initialize(
|
5
|
-
@
|
3
|
+
class OperatorMatcher
|
4
|
+
def initialize(actual)
|
5
|
+
@actual = actual
|
6
6
|
end
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
def =~(expected)
|
17
|
-
__delegate_method_missing_to_given("=~", expected)
|
18
|
-
end
|
19
|
-
|
20
|
-
def >(expected)
|
21
|
-
__delegate_method_missing_to_given(">", expected)
|
22
|
-
end
|
23
|
-
|
24
|
-
def >=(expected)
|
25
|
-
__delegate_method_missing_to_given(">=", expected)
|
26
|
-
end
|
27
|
-
|
28
|
-
def <(expected)
|
29
|
-
__delegate_method_missing_to_given("<", expected)
|
30
|
-
end
|
31
|
-
|
32
|
-
def <=(expected)
|
33
|
-
__delegate_method_missing_to_given("<=", expected)
|
7
|
+
|
8
|
+
['==','===','<','<=','>=','>','=~'].each do |operator|
|
9
|
+
define_method operator do |expected|
|
10
|
+
::Micronaut::Matchers.last_matcher = self
|
11
|
+
@operator, @expected = operator, expected
|
12
|
+
__delegate_operator(@actual, operator, expected)
|
13
|
+
end
|
34
14
|
end
|
35
15
|
|
36
16
|
def fail_with_message(message)
|
37
|
-
Micronaut::Expectations.fail_with(message, @expected, @
|
17
|
+
Micronaut::Expectations.fail_with(message, @expected, @actual)
|
38
18
|
end
|
39
19
|
|
40
20
|
def description
|
@@ -43,27 +23,24 @@ module Micronaut
|
|
43
23
|
|
44
24
|
end
|
45
25
|
|
46
|
-
class PositiveOperatorMatcher <
|
26
|
+
class PositiveOperatorMatcher < OperatorMatcher #:nodoc:
|
47
27
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
28
|
+
def __delegate_operator(actual, operator, expected)
|
29
|
+
return true if actual.__send__(operator, expected)
|
30
|
+
if ['==','===', '=~'].include?(operator)
|
31
|
+
fail_with_message("expected: #{expected.inspect},\n got: #{actual.inspect} (using #{operator})")
|
32
|
+
else
|
33
|
+
fail_with_message("expected: #{operator} #{expected.inspect},\n got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
|
34
|
+
end
|
55
35
|
end
|
56
36
|
|
57
37
|
end
|
58
38
|
|
59
|
-
class NegativeOperatorMatcher <
|
39
|
+
class NegativeOperatorMatcher < OperatorMatcher #:nodoc:
|
60
40
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
::Micronaut::Matchers.last_matcher = self
|
65
|
-
return true unless @given.__send__(operator, expected)
|
66
|
-
return fail_with_message("expected not: #{operator} #{expected.inspect},\n got: #{operator.gsub(/./, ' ')} #{@given.inspect}")
|
41
|
+
def __delegate_operator(actual, operator, expected)
|
42
|
+
return true unless actual.__send__(operator, expected)
|
43
|
+
return fail_with_message("expected not: #{operator} #{expected.inspect},\n got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
|
67
44
|
end
|
68
45
|
|
69
46
|
end
|
@@ -47,20 +47,16 @@ module Micronaut
|
|
47
47
|
def verify_message
|
48
48
|
case @expected_message
|
49
49
|
when nil
|
50
|
-
|
50
|
+
true
|
51
51
|
when Regexp
|
52
|
-
|
52
|
+
@expected_message =~ @given_error.message
|
53
53
|
else
|
54
|
-
|
54
|
+
@expected_message == @given_error.message
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
def failure_message
|
59
|
-
|
60
|
-
return @given_error.message
|
61
|
-
else
|
62
|
-
return "expected #{expected_error}#{given_error}"
|
63
|
-
end
|
59
|
+
@eval_block ? @given_error.message : "expected #{expected_error}#{given_error}"
|
64
60
|
end
|
65
61
|
|
66
62
|
def negative_failure_message
|
@@ -21,9 +21,13 @@ module Micronaut
|
|
21
21
|
end
|
22
22
|
@caught_symbol = @expected_symbol unless @caught_arg == :nothing_thrown
|
23
23
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
|
25
|
+
# Ruby 1.8 uses NameError with `symbol'
|
26
|
+
# Ruby 1.9 uses ArgumentError with :symbol
|
27
|
+
rescue NameError, ArgumentError => e
|
28
|
+
raise e unless e.message =~ /uncaught throw (`|\:)([a-zA-Z0-9_]*)(')?/
|
29
|
+
@caught_symbol = $2.to_sym
|
30
|
+
|
27
31
|
ensure
|
28
32
|
if @expected_symbol.nil?
|
29
33
|
return !@caught_symbol.nil?
|
@@ -31,6 +35,8 @@ module Micronaut
|
|
31
35
|
if @expected_arg.nil?
|
32
36
|
return @caught_symbol == @expected_symbol
|
33
37
|
else
|
38
|
+
# puts [@caught_symbol, @expected_symbol].inspect
|
39
|
+
# puts [@caught_arg, @expected_arg].inspect
|
34
40
|
return @caught_symbol == @expected_symbol && @caught_arg == @expected_arg
|
35
41
|
end
|
36
42
|
end
|
data/lib/micronaut/matchers.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'micronaut/matchers/generated_descriptions'
|
2
2
|
require 'micronaut/matchers/errors'
|
3
|
-
require 'micronaut/matchers/method_missing'
|
4
3
|
require 'micronaut/matchers/simple_matcher'
|
5
4
|
require 'micronaut/matchers/be'
|
6
5
|
require 'micronaut/matchers/be_close'
|
@@ -20,7 +19,7 @@ require 'micronaut/matchers/operator_matcher'
|
|
20
19
|
|
21
20
|
module Micronaut
|
22
21
|
|
23
|
-
# We ship with a number of useful Expression Matchers. An Expression Matcher
|
22
|
+
# We ship (courtesy of OSS and RMicronaut) with a number of useful Expression Matchers. An Expression Matcher
|
24
23
|
# is any object that responds to the following methods:
|
25
24
|
#
|
26
25
|
# matches?(actual)
|
@@ -136,6 +135,14 @@ module Micronaut
|
|
136
135
|
# end
|
137
136
|
#
|
138
137
|
module Matchers
|
139
|
-
|
138
|
+
|
139
|
+
private
|
140
|
+
def method_missing(sym, *args, &block) # :nodoc:
|
141
|
+
return Matchers::Be.new(sym, *args) if sym.starts_with?("be_")
|
142
|
+
return has(sym, *args) if sym.starts_with?("have_")
|
143
|
+
super
|
144
|
+
end
|
145
|
+
|
140
146
|
end
|
147
|
+
|
141
148
|
end
|
data/lib/micronaut.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'micronaut/mocking/with_mocha'
|
2
|
-
require 'micronaut/exceptions'
|
3
2
|
require 'micronaut/matchers'
|
4
3
|
require 'micronaut/expectations'
|
5
4
|
require 'micronaut/example_world'
|
6
5
|
require 'micronaut/example_runner'
|
7
|
-
require 'micronaut/
|
6
|
+
require 'micronaut/behaviour_group_class_methods'
|
7
|
+
require 'micronaut/behaviour_group'
|
8
8
|
require 'micronaut/extensions/kernel'
|
9
9
|
|
10
10
|
module Micronaut
|
@@ -30,7 +30,7 @@ module Micronaut
|
|
30
30
|
|
31
31
|
new_backtrace = []
|
32
32
|
backtrace.each_with_index do |line, index|
|
33
|
-
break if line.rindex(MICRONAUT_DIR, 0)
|
33
|
+
break if line.rindex(MICRONAUT_DIR, 0)
|
34
34
|
new_backtrace << line
|
35
35
|
end
|
36
36
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spicycode-micronaut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Humphries
|
@@ -9,7 +9,7 @@ autorequire: micronaut
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-26 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -38,16 +38,19 @@ files:
|
|
38
38
|
- lib/autotest/discover.rb
|
39
39
|
- lib/autotest/micronaut.rb
|
40
40
|
- lib/micronaut
|
41
|
-
- lib/micronaut/
|
41
|
+
- lib/micronaut/behaviour_group.rb
|
42
|
+
- lib/micronaut/behaviour_group_class_methods.rb
|
42
43
|
- lib/micronaut/example_runner.rb
|
43
44
|
- lib/micronaut/example_world.rb
|
44
|
-
- lib/micronaut/exceptions.rb
|
45
45
|
- lib/micronaut/expectations
|
46
46
|
- lib/micronaut/expectations/differs
|
47
47
|
- lib/micronaut/expectations/differs/default.rb
|
48
|
+
- lib/micronaut/expectations/errors.rb
|
49
|
+
- lib/micronaut/expectations/extensions
|
50
|
+
- lib/micronaut/expectations/extensions/object.rb
|
51
|
+
- lib/micronaut/expectations/extensions/string_and_symbol.rb
|
52
|
+
- lib/micronaut/expectations/extensions.rb
|
48
53
|
- lib/micronaut/expectations/handler.rb
|
49
|
-
- lib/micronaut/expectations/object_extensions.rb
|
50
|
-
- lib/micronaut/expectations/string_and_symbol_extensions.rb
|
51
54
|
- lib/micronaut/expectations/wrap_expectation.rb
|
52
55
|
- lib/micronaut/expectations.rb
|
53
56
|
- lib/micronaut/extensions
|
@@ -79,7 +82,7 @@ files:
|
|
79
82
|
- examples/example_helper.rb
|
80
83
|
- examples/lib
|
81
84
|
- examples/lib/micronaut
|
82
|
-
- examples/lib/micronaut/
|
85
|
+
- examples/lib/micronaut/behaviour_group_example.rb
|
83
86
|
- examples/lib/micronaut/example_runner_example.rb
|
84
87
|
- examples/lib/micronaut/expectations
|
85
88
|
- examples/lib/micronaut/expectations/differs
|
@@ -89,7 +92,28 @@ files:
|
|
89
92
|
- examples/lib/micronaut/expectations/fail_with_example.rb
|
90
93
|
- examples/lib/micronaut/expectations/wrap_expectation_example.rb
|
91
94
|
- examples/lib/micronaut/matchers
|
95
|
+
- examples/lib/micronaut/matchers/be_close_example.rb
|
96
|
+
- examples/lib/micronaut/matchers/be_example.rb
|
97
|
+
- examples/lib/micronaut/matchers/change_example.rb
|
98
|
+
- examples/lib/micronaut/matchers/description_generation_example.rb
|
99
|
+
- examples/lib/micronaut/matchers/eql_example.rb
|
100
|
+
- examples/lib/micronaut/matchers/equal_example.rb
|
101
|
+
- examples/lib/micronaut/matchers/exist_example.rb
|
102
|
+
- examples/lib/micronaut/matchers/handler_example.rb
|
103
|
+
- examples/lib/micronaut/matchers/has_example.rb
|
104
|
+
- examples/lib/micronaut/matchers/have_example.rb
|
105
|
+
- examples/lib/micronaut/matchers/include_example.rb
|
106
|
+
- examples/lib/micronaut/matchers/match_example.rb
|
107
|
+
- examples/lib/micronaut/matchers/matcher_methods_example.rb
|
108
|
+
- examples/lib/micronaut/matchers/operator_matcher_example.rb
|
109
|
+
- examples/lib/micronaut/matchers/raise_error_example.rb
|
110
|
+
- examples/lib/micronaut/matchers/respond_to_example.rb
|
111
|
+
- examples/lib/micronaut/matchers/satisfy_example.rb
|
112
|
+
- examples/lib/micronaut/matchers/simple_matcher_example.rb
|
113
|
+
- examples/lib/micronaut/matchers/throw_symbol_example.rb
|
92
114
|
- examples/lib/micronaut_example.rb
|
115
|
+
- examples/resources
|
116
|
+
- examples/resources/example_classes.rb
|
93
117
|
has_rdoc: true
|
94
118
|
homepage: http://spicycode.com
|
95
119
|
post_install_message:
|