rspec 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +90 -1
- data/EXAMPLES.rd +28 -6
- data/MIT-LICENSE +20 -0
- data/README +18 -12
- data/Rakefile +60 -54
- data/examples/custom_formatter.rb +4 -4
- data/examples/helper_method_example.rb +11 -0
- data/examples/mocking_example.rb +19 -2
- data/examples/partial_mock_example.rb +28 -0
- data/examples/stack_spec.rb +8 -8
- data/examples/stubbing_example.rb +50 -9
- data/examples/test_case_spec.rb +6 -6
- data/lib/spec.rb +1 -2
- data/lib/spec/callback.rb +0 -0
- data/lib/spec/expectations.rb +3 -6
- data/lib/spec/expectations/diff.rb +23 -47
- data/lib/spec/expectations/differs/default.rb +62 -0
- data/lib/spec/expectations/{exceptions.rb → errors.rb} +0 -0
- data/lib/spec/expectations/extensions.rb +4 -0
- data/lib/spec/expectations/extensions/inspect_for_expectation_not_met_error.rb +14 -0
- data/lib/spec/expectations/extensions/numeric.rb +5 -0
- data/lib/spec/expectations/{expectations.rb → extensions/object.rb} +3 -6
- data/lib/spec/expectations/extensions/symbol.rb +5 -0
- data/lib/spec/expectations/should.rb +4 -0
- data/lib/spec/expectations/should/base.rb +42 -0
- data/lib/spec/expectations/should/have.rb +79 -0
- data/lib/spec/expectations/should/not.rb +72 -0
- data/lib/spec/expectations/should/should.rb +83 -0
- data/lib/spec/expectations/sugar.rb +6 -25
- data/lib/spec/mocks.rb +5 -1
- data/lib/spec/mocks/argument_expectation.rb +15 -1
- data/lib/spec/mocks/error_generator.rb +72 -0
- data/lib/spec/mocks/{exceptions.rb → errors.rb} +0 -0
- data/lib/spec/mocks/extensions/object.rb +3 -0
- data/lib/spec/mocks/message_expectation.rb +80 -73
- data/lib/spec/mocks/mock.rb +4 -69
- data/lib/spec/mocks/mock_handler.rb +158 -0
- data/lib/spec/mocks/mock_methods.rb +44 -0
- data/lib/spec/mocks/order_group.rb +10 -2
- data/lib/spec/rake/spectask.rb +20 -18
- data/lib/spec/rake/{rcov_verify.rb → verify_rcov.rb} +2 -2
- data/lib/spec/runner.rb +3 -1
- data/lib/spec/runner/backtrace_tweaker.rb +2 -1
- data/lib/spec/runner/context.rb +10 -16
- data/lib/spec/runner/context_eval.rb +40 -40
- data/lib/spec/runner/execution_context.rb +1 -12
- data/lib/spec/runner/{kernel_ext.rb → extensions/kernel.rb} +2 -2
- data/lib/spec/runner/{instance_exec.rb → extensions/object.rb} +0 -0
- data/lib/spec/runner/formatter/base_text_formatter.rb +25 -18
- data/lib/spec/runner/formatter/html_formatter.rb +81 -101
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +9 -9
- data/lib/spec/runner/formatter/rdoc_formatter.rb +6 -6
- data/lib/spec/runner/formatter/specdoc_formatter.rb +7 -6
- data/lib/spec/runner/option_parser.rb +41 -5
- data/lib/spec/runner/reporter.rb +3 -15
- data/lib/spec/runner/spec_should_raise_handler.rb +74 -0
- data/lib/spec/runner/specification.rb +33 -14
- data/lib/spec/version.rb +6 -3
- data/vendor/watir/README.txt +1 -1
- metadata +34 -68
- data/bin/test2spec +0 -112
- data/examples/helper_method_spec.rb +0 -12
- data/lib/spec/expectations/have_helper.rb +0 -41
- data/lib/spec/expectations/helper.rb +0 -4
- data/lib/spec/expectations/should_base.rb +0 -52
- data/lib/spec/expectations/should_helper.rb +0 -93
- data/lib/spec/expectations/should_negator.rb +0 -71
- data/lib/spec/test_to_spec/ruby2ruby.rb +0 -492
- data/lib/spec/test_to_spec/sexp_transformer.rb +0 -196
- data/lib/spec/test_to_spec/test_case_ext.rb +0 -22
- data/lib/spec/test_to_spec/translation_test_runner.rb +0 -147
- data/test/spec/expectations/arbitrary_operator_test.rb +0 -55
- data/test/spec/expectations/arbitrary_predicate_test.rb +0 -163
- data/test/spec/expectations/containment_test.rb +0 -129
- data/test/spec/expectations/diff_test.rb +0 -62
- data/test/spec/expectations/identity_test.rb +0 -75
- data/test/spec/expectations/object_equality_test.rb +0 -65
- data/test/spec/expectations/raising_test.rb +0 -106
- data/test/spec/expectations/regex_matching_test.rb +0 -36
- data/test/spec/expectations/should_have_test.rb +0 -169
- data/test/spec/expectations/should_satisfy_test.rb +0 -37
- data/test/spec/expectations/sugar_test.rb +0 -93
- data/test/spec/expectations/supported_symbols_test.rb +0 -33
- data/test/spec/expectations/throwing_test.rb +0 -55
- data/test/spec/expectations/true_false_special_case_test.rb +0 -85
- data/test/spec/expectations/typing_test.rb +0 -108
- data/test/spec/mocks/mock_arg_constraints_test.rb +0 -113
- data/test/spec/mocks/mock_counts_test.rb +0 -431
- data/test/spec/mocks/mock_ordering_test.rb +0 -109
- data/test/spec/mocks/mock_test.rb +0 -220
- data/test/spec/mocks/null_object_test.rb +0 -37
- data/test/spec/runner/backtrace_tweaker_test.rb +0 -90
- data/test/spec/runner/context_matching_test.rb +0 -35
- data/test/spec/runner/context_runner_test.rb +0 -62
- data/test/spec/runner/context_test.rb +0 -191
- data/test/spec/runner/execution_context_test.rb +0 -45
- data/test/spec/runner/formatter/failure_dump_test.rb +0 -94
- data/test/spec/runner/formatter/html_formatter_test.rb +0 -48
- data/test/spec/runner/formatter/progress_bar_formatter_test.rb +0 -56
- data/test/spec/runner/formatter/rdoc_formatter_test.rb +0 -51
- data/test/spec/runner/formatter/specdoc_formatter_test.rb +0 -57
- data/test/spec/runner/kernel_ext_test.rb +0 -13
- data/test/spec/runner/option_parser_test.rb +0 -141
- data/test/spec/runner/reporter_test.rb +0 -128
- data/test/spec/runner/spec_matcher_test.rb +0 -47
- data/test/spec/runner/specification_test.rb +0 -121
- data/test/spec/test_to_spec/ruby_to_ruby_test.rb +0 -79
- data/test/spec/test_to_spec/sexp_transformer_assertion_test.rb +0 -207
- data/test/spec/test_to_spec/sexp_transformer_test.rb +0 -303
- data/test/spec/test_to_spec/test_case_ext_test.rb +0 -25
- data/test/spec/test_to_spec/testfiles/test_unit_api_spec.rb +0 -75
- data/test/spec/test_to_spec/testfiles/test_unit_api_test.rb +0 -70
- data/test/test_classes.rb +0 -102
- data/test/test_helper.rb +0 -32
data/test/test_classes.rb
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
# This file contains various classes used by the tests.
|
2
|
-
# They are kept in a separate file so that they can also
|
3
|
-
# be accessed by the test2spec-translated specs
|
4
|
-
module Spec
|
5
|
-
module Expectations
|
6
|
-
class Person
|
7
|
-
attr_reader :name
|
8
|
-
def initialize name
|
9
|
-
@name = name
|
10
|
-
end
|
11
|
-
def == other
|
12
|
-
return @name == other.name
|
13
|
-
end
|
14
|
-
end
|
15
|
-
class ClassWithMultiWordPredicate
|
16
|
-
def multi_word_predicate?
|
17
|
-
true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
module Helper
|
22
|
-
class CollectionWithSizeMethod
|
23
|
-
def initialize; @list = []; end
|
24
|
-
def size; @list.size; end
|
25
|
-
def push(item); @list.push(item); end
|
26
|
-
end
|
27
|
-
|
28
|
-
class CollectionWithLengthMethod
|
29
|
-
def initialize; @list = []; end
|
30
|
-
def length; @list.size; end
|
31
|
-
def push(item); @list.push(item); end
|
32
|
-
end
|
33
|
-
|
34
|
-
class CollectionOwner
|
35
|
-
attr_reader :items_in_collection_with_size_method, :items_in_collection_with_length_method
|
36
|
-
|
37
|
-
def initialize
|
38
|
-
@items_in_collection_with_size_method = CollectionWithSizeMethod.new
|
39
|
-
@items_in_collection_with_length_method = CollectionWithLengthMethod.new
|
40
|
-
end
|
41
|
-
|
42
|
-
def add_to_collection_with_size_method(item)
|
43
|
-
@items_in_collection_with_size_method.push(item)
|
44
|
-
end
|
45
|
-
|
46
|
-
def add_to_collection_with_length_method(item)
|
47
|
-
@items_in_collection_with_length_method.push(item)
|
48
|
-
end
|
49
|
-
|
50
|
-
def items_for(arg)
|
51
|
-
return [1, 2, 3] if arg == 'a'
|
52
|
-
[1]
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
class HandCodedMock
|
58
|
-
def initialize(return_val)
|
59
|
-
@return_val = return_val
|
60
|
-
@funny_called = false
|
61
|
-
end
|
62
|
-
|
63
|
-
def funny?
|
64
|
-
@funny_called = true
|
65
|
-
@return_val
|
66
|
-
end
|
67
|
-
|
68
|
-
def hungry?(a, b, c)
|
69
|
-
a.should_be 1
|
70
|
-
b.should_be 2
|
71
|
-
c.should_be 3
|
72
|
-
@funny_called = true
|
73
|
-
@return_val
|
74
|
-
end
|
75
|
-
|
76
|
-
def exists?
|
77
|
-
@return_val
|
78
|
-
end
|
79
|
-
|
80
|
-
def multi_word_predicate?
|
81
|
-
@return_val
|
82
|
-
end
|
83
|
-
|
84
|
-
def __verify
|
85
|
-
@funny_called.should_be true
|
86
|
-
end
|
87
|
-
end
|
88
|
-
class ClassWithUnqueriedPredicate
|
89
|
-
attr_accessor :foo
|
90
|
-
def initialize(foo)
|
91
|
-
@foo = foo
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
module Custom
|
99
|
-
class Formatter
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
data/test/test_helper.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'stringio'
|
3
|
-
$LOAD_PATH.push File.dirname(__FILE__) + '/../lib'
|
4
|
-
$LOAD_PATH.push File.dirname(__FILE__) + '/../test'
|
5
|
-
require 'spec'
|
6
|
-
require 'test_classes'
|
7
|
-
RSPEC_TESTING = true unless defined? RSPEC_TESTING # This causes the diff extension to not be loaded
|
8
|
-
require 'spec/expectations/diff'
|
9
|
-
$context_runner = ::Spec::Runner::OptionParser.create_context_runner(['test'], false, STDERR, STDOUT)
|
10
|
-
|
11
|
-
# helpers for test_to_spec tests
|
12
|
-
|
13
|
-
require 'pp'
|
14
|
-
require 'stringio'
|
15
|
-
|
16
|
-
def verify_sexp_equal(expected, actual)
|
17
|
-
unless expected == actual
|
18
|
-
raise "expected translation:\n" << my_pp(expected) << "actual translation:\n" << my_pp(actual)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def my_pp(*args)
|
23
|
-
old_out = $stdout
|
24
|
-
begin
|
25
|
-
s=StringIO.new
|
26
|
-
$stdout=s
|
27
|
-
pp(*args)
|
28
|
-
ensure
|
29
|
-
$stdout=old_out
|
30
|
-
end
|
31
|
-
s.string
|
32
|
-
end
|