rspec 1.2.2 → 1.2.3
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.
- data/History.rdoc +31 -1
- data/Manifest.txt +14 -12
- data/Rakefile +1 -1
- data/Upgrade.rdoc +43 -3
- data/examples/failing/failing_implicit_docstrings_example.rb +5 -5
- data/examples/passing/implicit_docstrings_example.rb +3 -3
- data/features/before_and_after_blocks/before_and_after_blocks.feature +20 -21
- data/features/example_groups/example_group_with_should_methods.feature +20 -8
- data/features/example_groups/implicit_docstrings.feature +36 -20
- data/features/example_groups/nested_groups.feature +25 -10
- data/features/extensions/custom_example_group.feature +19 -0
- data/features/formatters/custom_formatter.feature +30 -0
- data/features/heckle/heckle.feature +7 -7
- data/features/interop/examples_and_tests_together.feature +63 -14
- data/features/interop/rspec_output.feature +25 -0
- data/features/interop/test_but_not_test_unit.feature +19 -7
- data/features/interop/test_case_with_should_methods.feature +37 -8
- data/features/matchers/{create_matcher.feature → define_matcher.feature} +54 -30
- data/features/matchers/{create_matcher_outside_rspec.feature → define_matcher_outside_rspec.feature} +7 -7
- data/features/mock_framework_integration/use_flexmock.feature +3 -3
- data/features/mock_framework_integration/use_mocha.feature +3 -3
- data/features/mock_framework_integration/use_rr.feature +3 -3
- data/features/mocks/mix_stubs_and_mocks.feature +4 -4
- data/features/pending/pending_examples.feature +18 -18
- data/features/runner/specify_line_number.feature +32 -0
- data/features/step_definitions/running_rspec_steps.rb +41 -0
- data/features/subject/explicit_subject.feature +4 -4
- data/features/subject/implicit_subject.feature +4 -4
- data/features/support/env.rb +64 -11
- data/features/support/matchers/smart_match.rb +10 -35
- data/lib/spec.rb +1 -0
- data/lib/spec/deprecation.rb +40 -0
- data/lib/spec/dsl/main.rb +10 -5
- data/lib/spec/example.rb +1 -27
- data/lib/spec/example/args_and_options.rb +27 -0
- data/lib/spec/example/before_and_after_hooks.rb +30 -21
- data/lib/spec/example/errors.rb +8 -18
- data/lib/spec/example/example_group_factory.rb +0 -4
- data/lib/spec/example/example_group_methods.rb +27 -41
- data/lib/spec/example/example_group_proxy.rb +12 -22
- data/lib/spec/example/example_methods.rb +8 -18
- data/lib/spec/example/example_proxy.rb +4 -4
- data/lib/spec/example/pending.rb +3 -4
- data/lib/spec/example/predicate_matchers.rb +1 -1
- data/lib/spec/example/subject.rb +2 -0
- data/lib/spec/expectations.rb +1 -26
- data/lib/spec/expectations/extensions.rb +1 -1
- data/lib/spec/expectations/extensions/kernel.rb +52 -0
- data/lib/spec/expectations/handler.rb +21 -10
- data/lib/spec/matchers/be.rb +3 -3
- data/lib/spec/matchers/be_close.rb +17 -21
- data/lib/spec/matchers/be_instance_of.rb +7 -26
- data/lib/spec/matchers/be_kind_of.rb +7 -26
- data/lib/spec/matchers/dsl.rb +9 -4
- data/lib/spec/matchers/eql.rb +24 -25
- data/lib/spec/matchers/equal.rb +25 -25
- data/lib/spec/matchers/exist.rb +5 -21
- data/lib/spec/matchers/include.rb +22 -44
- data/lib/spec/matchers/match.rb +5 -25
- data/lib/spec/matchers/match_array.rb +8 -4
- data/lib/spec/matchers/matcher.rb +13 -2
- data/lib/spec/matchers/pretty.rb +1 -0
- data/lib/spec/matchers/simple_matcher.rb +2 -2
- data/lib/spec/mocks/mock.rb +10 -10
- data/lib/spec/mocks/spec_methods.rb +1 -1
- data/lib/spec/runner/configuration.rb +53 -42
- data/lib/spec/{expectations → runner}/differs/default.rb +0 -0
- data/lib/spec/{expectations → runner}/differs/load-diff-lcs.rb +0 -0
- data/lib/spec/runner/drb_command_line.rb +1 -1
- data/lib/spec/runner/example_group_runner.rb +0 -12
- data/lib/spec/runner/formatter/base_formatter.rb +77 -30
- data/lib/spec/runner/formatter/base_text_formatter.rb +19 -24
- data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +1 -1
- data/lib/spec/runner/formatter/html_formatter.rb +4 -6
- data/lib/spec/runner/formatter/nested_text_formatter.rb +2 -2
- data/lib/spec/runner/formatter/no_op_method_missing.rb +21 -0
- data/lib/spec/runner/formatter/profile_formatter.rb +0 -4
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +4 -5
- data/lib/spec/runner/formatter/silent_formatter.rb +10 -0
- data/lib/spec/runner/formatter/specdoc_formatter.rb +2 -2
- data/lib/spec/runner/option_parser.rb +14 -7
- data/lib/spec/runner/options.rb +17 -7
- data/lib/spec/runner/reporter.rb +69 -64
- data/lib/spec/version.rb +1 -1
- data/spec/spec/dsl/main_spec.rb +7 -0
- data/spec/spec/example/example_group_methods_spec.rb +16 -32
- data/spec/spec/example/example_group_proxy_spec.rb +25 -5
- data/spec/spec/example/example_group_spec.rb +2 -2
- data/spec/spec/example/example_methods_spec.rb +19 -24
- data/spec/spec/example/example_proxy_spec.rb +11 -1
- data/spec/spec/example/pending_module_spec.rb +2 -108
- data/spec/spec/example/predicate_matcher_spec.rb +23 -3
- data/spec/spec/expectations/extensions/object_spec.rb +9 -9
- data/spec/spec/expectations/fail_with_spec.rb +13 -13
- data/spec/spec/expectations/handler_spec.rb +44 -15
- data/spec/spec/matchers/be_close_spec.rb +9 -0
- data/spec/spec/matchers/be_instance_of_spec.rb +6 -4
- data/spec/spec/matchers/be_kind_of_spec.rb +5 -3
- data/spec/spec/matchers/be_spec.rb +1 -5
- data/spec/spec/matchers/compatibility_spec.rb +1 -1
- data/spec/spec/matchers/dsl_spec.rb +10 -1
- data/spec/spec/matchers/eql_spec.rb +8 -4
- data/spec/spec/matchers/equal_spec.rb +8 -4
- data/spec/spec/matchers/exist_spec.rb +1 -1
- data/spec/spec/matchers/include_spec.rb +1 -1
- data/spec/spec/matchers/match_array_spec.rb +26 -1
- data/spec/spec/matchers/match_spec.rb +2 -2
- data/spec/spec/matchers/matcher_methods_spec.rb +0 -3
- data/spec/spec/matchers/matcher_spec.rb +53 -0
- data/spec/spec/matchers/operator_matcher_spec.rb +1 -1
- data/spec/spec/mocks/mock_spec.rb +6 -0
- data/spec/spec/runner/configuration_spec.rb +11 -1
- data/spec/spec/runner/drb_command_line_spec.rb +13 -1
- data/spec/spec/runner/example_group_runner_spec.rb +0 -7
- data/spec/spec/runner/formatter/base_formatter_spec.rb +19 -12
- data/spec/spec/runner/formatter/base_text_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +4 -4
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +31 -34
- data/spec/spec/runner/formatter/html_formatter_spec.rb +20 -0
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +20 -20
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +22 -3
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +24 -3
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +6 -6
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +25 -28
- data/spec/spec/runner/formatter/text_mate_formatter_spec.rb +2 -2
- data/spec/spec/runner/option_parser_spec.rb +108 -40
- data/spec/spec/runner/reporter_spec.rb +16 -17
- data/spec/spec_helper.rb +4 -1
- metadata +20 -18
- data/features/example_groups/output.feature +0 -20
- data/features/step_definitions/running_rspec.rb +0 -69
- data/lib/spec/expectations/extensions/object.rb +0 -63
- data/resources/spec/example_group_with_should_methods.rb +0 -12
- data/resources/spec/simple_spec.rb +0 -8
- data/resources/test/spec_and_test_together.rb +0 -56
- data/resources/test/spec_including_test_but_not_unit.rb +0 -11
- data/resources/test/test_case_with_should_methods.rb +0 -29
data/spec/spec_helper.rb
CHANGED
@@ -9,7 +9,7 @@ require 'spec'
|
|
9
9
|
require 'spec/mocks'
|
10
10
|
spec_classes_path = File.expand_path("#{dir}/../spec/spec/spec_classes")
|
11
11
|
require spec_classes_path unless $LOAD_PATH.include?(spec_classes_path)
|
12
|
-
require File.dirname(__FILE__) + '/../lib/spec/
|
12
|
+
require File.dirname(__FILE__) + '/../lib/spec/runner/differs/default'
|
13
13
|
|
14
14
|
def jruby?
|
15
15
|
::RUBY_PLATFORM == 'java'
|
@@ -101,6 +101,9 @@ module Spec
|
|
101
101
|
def register_example_group(klass)
|
102
102
|
#ignore
|
103
103
|
end
|
104
|
+
def initialize(proxy=nil, &block)
|
105
|
+
super(proxy || ExampleProxy.new, &block)
|
106
|
+
end
|
104
107
|
end
|
105
108
|
end
|
106
109
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RSpec Development Team
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-13 00:00:00 -03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
23
|
+
version: 0.2.2
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.12.1
|
34
34
|
version:
|
35
35
|
description: Behaviour Driven Development for Ruby.
|
36
36
|
email:
|
@@ -108,19 +108,22 @@ files:
|
|
108
108
|
- features/example_groups/example_group_with_should_methods.feature
|
109
109
|
- features/example_groups/implicit_docstrings.feature
|
110
110
|
- features/example_groups/nested_groups.feature
|
111
|
-
- features/
|
111
|
+
- features/extensions/custom_example_group.feature
|
112
|
+
- features/formatters/custom_formatter.feature
|
112
113
|
- features/heckle/heckle.feature
|
113
114
|
- features/interop/examples_and_tests_together.feature
|
115
|
+
- features/interop/rspec_output.feature
|
114
116
|
- features/interop/test_but_not_test_unit.feature
|
115
117
|
- features/interop/test_case_with_should_methods.feature
|
116
|
-
- features/matchers/
|
117
|
-
- features/matchers/
|
118
|
+
- features/matchers/define_matcher.feature
|
119
|
+
- features/matchers/define_matcher_outside_rspec.feature
|
118
120
|
- features/mock_framework_integration/use_flexmock.feature
|
119
121
|
- features/mock_framework_integration/use_mocha.feature
|
120
122
|
- features/mock_framework_integration/use_rr.feature
|
121
123
|
- features/mocks/mix_stubs_and_mocks.feature
|
122
124
|
- features/pending/pending_examples.feature
|
123
|
-
- features/
|
125
|
+
- features/runner/specify_line_number.feature
|
126
|
+
- features/step_definitions/running_rspec_steps.rb
|
124
127
|
- features/subject/explicit_subject.feature
|
125
128
|
- features/subject/implicit_subject.feature
|
126
129
|
- features/support/env.rb
|
@@ -134,9 +137,11 @@ files:
|
|
134
137
|
- lib/spec/adapters/mock_frameworks/rr.rb
|
135
138
|
- lib/spec/adapters/mock_frameworks/rspec.rb
|
136
139
|
- lib/spec/autorun.rb
|
140
|
+
- lib/spec/deprecation.rb
|
137
141
|
- lib/spec/dsl.rb
|
138
142
|
- lib/spec/dsl/main.rb
|
139
143
|
- lib/spec/example.rb
|
144
|
+
- lib/spec/example/args_and_options.rb
|
140
145
|
- lib/spec/example/before_and_after_hooks.rb
|
141
146
|
- lib/spec/example/errors.rb
|
142
147
|
- lib/spec/example/example_group.rb
|
@@ -153,11 +158,9 @@ files:
|
|
153
158
|
- lib/spec/example/shared_example_group.rb
|
154
159
|
- lib/spec/example/subject.rb
|
155
160
|
- lib/spec/expectations.rb
|
156
|
-
- lib/spec/expectations/differs/default.rb
|
157
|
-
- lib/spec/expectations/differs/load-diff-lcs.rb
|
158
161
|
- lib/spec/expectations/errors.rb
|
159
162
|
- lib/spec/expectations/extensions.rb
|
160
|
-
- lib/spec/expectations/extensions/
|
163
|
+
- lib/spec/expectations/extensions/kernel.rb
|
161
164
|
- lib/spec/expectations/handler.rb
|
162
165
|
- lib/spec/interop/test.rb
|
163
166
|
- lib/spec/interop/test/unit/autorunner.rb
|
@@ -217,6 +220,8 @@ files:
|
|
217
220
|
- lib/spec/runner/class_and_arguments_parser.rb
|
218
221
|
- lib/spec/runner/command_line.rb
|
219
222
|
- lib/spec/runner/configuration.rb
|
223
|
+
- lib/spec/runner/differs/default.rb
|
224
|
+
- lib/spec/runner/differs/load-diff-lcs.rb
|
220
225
|
- lib/spec/runner/drb_command_line.rb
|
221
226
|
- lib/spec/runner/example_group_runner.rb
|
222
227
|
- lib/spec/runner/extensions/kernel.rb
|
@@ -226,8 +231,10 @@ files:
|
|
226
231
|
- lib/spec/runner/formatter/failing_examples_formatter.rb
|
227
232
|
- lib/spec/runner/formatter/html_formatter.rb
|
228
233
|
- lib/spec/runner/formatter/nested_text_formatter.rb
|
234
|
+
- lib/spec/runner/formatter/no_op_method_missing.rb
|
229
235
|
- lib/spec/runner/formatter/profile_formatter.rb
|
230
236
|
- lib/spec/runner/formatter/progress_bar_formatter.rb
|
237
|
+
- lib/spec/runner/formatter/silent_formatter.rb
|
231
238
|
- lib/spec/runner/formatter/snippet_extractor.rb
|
232
239
|
- lib/spec/runner/formatter/specdoc_formatter.rb
|
233
240
|
- lib/spec/runner/formatter/text_mate_formatter.rb
|
@@ -244,11 +251,6 @@ files:
|
|
244
251
|
- resources/rake/examples_with_rcov.rake
|
245
252
|
- resources/rake/failing_examples_with_html.rake
|
246
253
|
- resources/rake/verify_rcov.rake
|
247
|
-
- resources/spec/example_group_with_should_methods.rb
|
248
|
-
- resources/spec/simple_spec.rb
|
249
|
-
- resources/test/spec_and_test_together.rb
|
250
|
-
- resources/test/spec_including_test_but_not_unit.rb
|
251
|
-
- resources/test/test_case_with_should_methods.rb
|
252
254
|
- spec/README.jruby
|
253
255
|
- spec/autotest/autotest_helper.rb
|
254
256
|
- spec/autotest/autotest_matchers.rb
|
@@ -408,7 +410,7 @@ homepage: http://rspec.info
|
|
408
410
|
post_install_message: |
|
409
411
|
**************************************************
|
410
412
|
|
411
|
-
Thank you for installing rspec-1.2.
|
413
|
+
Thank you for installing rspec-1.2.3
|
412
414
|
|
413
415
|
Please be sure to read History.rdoc and Upgrade.rdoc
|
414
416
|
for useful information about this release.
|
@@ -438,6 +440,6 @@ rubyforge_project: rspec
|
|
438
440
|
rubygems_version: 1.3.1
|
439
441
|
signing_key:
|
440
442
|
specification_version: 2
|
441
|
-
summary: rspec 1.2.
|
443
|
+
summary: rspec 1.2.3
|
442
444
|
test_files: []
|
443
445
|
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: Getting correct output
|
2
|
-
|
3
|
-
As an RSpec user
|
4
|
-
I want to see output only once
|
5
|
-
So that I don't get confused
|
6
|
-
|
7
|
-
Scenario: Run with ruby
|
8
|
-
Given the file ../../resources/spec/simple_spec.rb
|
9
|
-
When I run it with the ruby interpreter
|
10
|
-
Then the exit code should be 0
|
11
|
-
And the stdout should not match /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/m
|
12
|
-
And the stdout should match "1 example, 0 failures"
|
13
|
-
|
14
|
-
Scenario: Run with CommandLine object
|
15
|
-
Given the file ../../resources/spec/simple_spec.rb
|
16
|
-
When I run it with the CommandLine object
|
17
|
-
Then the exit code should be 0
|
18
|
-
And the stdout should not match "Loaded suite"
|
19
|
-
And the stdout should not match /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/m
|
20
|
-
And the stdout should match "1 example, 0 failures"
|
@@ -1,69 +0,0 @@
|
|
1
|
-
Given /^the file (.*)$/ do |relative_path|
|
2
|
-
@path = File.expand_path(File.join(File.dirname(__FILE__), "..", "support", relative_path))
|
3
|
-
unless File.exist?(@path)
|
4
|
-
raise "could not find file at #{@path}"
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
Given /^the following spec:$/ do |spec|
|
9
|
-
dir = File.join(File.dirname(__FILE__), "/../../tmp")
|
10
|
-
FileUtils.mkdir(dir) unless test ?d, dir
|
11
|
-
@path = "#{dir}/current_example.rb"
|
12
|
-
File.open(@path, "w") do |f|
|
13
|
-
f.write %Q[$:.unshift File.join(File.dirname(__FILE__), "/../lib")]
|
14
|
-
f.write "\n"
|
15
|
-
f.write spec
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
Given /^a file named (.*) with:$/ do |filename, code|
|
20
|
-
dir = File.join(File.dirname(__FILE__), "/../../tmp")
|
21
|
-
FileUtils.mkdir(dir) unless test ?d, dir
|
22
|
-
@path = "#{dir}/#{filename}"
|
23
|
-
File.open(@path, "w") do |f|
|
24
|
-
f.write %Q[$:.unshift File.join(File.dirname(__FILE__), "/../lib")]
|
25
|
-
f.write "\n"
|
26
|
-
f.write code
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
When /^I run it with the (.*)$/ do |interpreter|
|
31
|
-
stderr_file = Tempfile.new('rspec')
|
32
|
-
stderr_file.close
|
33
|
-
@stdout = case(interpreter)
|
34
|
-
when /^ruby interpreter/
|
35
|
-
args = interpreter.gsub('ruby interpreter','')
|
36
|
-
ruby("#{@path}#{args}", stderr_file.path)
|
37
|
-
when /^spec command/
|
38
|
-
args = interpreter.gsub('spec command','')
|
39
|
-
spec("#{@path}#{args}", stderr_file.path)
|
40
|
-
when 'CommandLine object' then cmdline(@path, stderr_file.path)
|
41
|
-
else raise "Unknown interpreter: #{interpreter}"
|
42
|
-
end
|
43
|
-
@stderr = IO.read(stderr_file.path)
|
44
|
-
@exit_code = $?.to_i
|
45
|
-
end
|
46
|
-
|
47
|
-
Then /^the (.*) should match (.*)$/ do |stream, string_or_regex|
|
48
|
-
written = case(stream)
|
49
|
-
when 'stdout' then @stdout
|
50
|
-
when 'stderr' then @stderr
|
51
|
-
else raise "Unknown stream: #{stream}"
|
52
|
-
end
|
53
|
-
written.should smart_match(string_or_regex)
|
54
|
-
end
|
55
|
-
|
56
|
-
Then /^the (.*) should not match (.*)$/ do |stream, string_or_regex|
|
57
|
-
written = case(stream)
|
58
|
-
when 'stdout' then @stdout
|
59
|
-
when 'stderr' then @stderr
|
60
|
-
else raise "Unknown stream: #{stream}"
|
61
|
-
end
|
62
|
-
written.should_not smart_match(string_or_regex)
|
63
|
-
end
|
64
|
-
|
65
|
-
Then /^the exit code should be (\d+)$/ do |exit_code|
|
66
|
-
if @exit_code != exit_code.to_i
|
67
|
-
raise "Did not exit with #{exit_code}, but with #{@exit_code}. Standard error:\n#{@stderr}"
|
68
|
-
end
|
69
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
module Spec
|
2
|
-
module Expectations
|
3
|
-
# rspec adds #should and #should_not to every Object (and,
|
4
|
-
# implicitly, every Class).
|
5
|
-
module ObjectExpectations
|
6
|
-
# :call-seq:
|
7
|
-
# should(matcher)
|
8
|
-
# should == expected
|
9
|
-
# should === expected
|
10
|
-
# should =~ expected
|
11
|
-
#
|
12
|
-
# receiver.should(matcher)
|
13
|
-
# => Passes if matcher.matches?(receiver)
|
14
|
-
#
|
15
|
-
# receiver.should == expected #any value
|
16
|
-
# => Passes if (receiver == expected)
|
17
|
-
#
|
18
|
-
# receiver.should === expected #any value
|
19
|
-
# => Passes if (receiver === expected)
|
20
|
-
#
|
21
|
-
# receiver.should =~ regexp
|
22
|
-
# => Passes if (receiver =~ regexp)
|
23
|
-
#
|
24
|
-
# See Spec::Matchers for more information about matchers
|
25
|
-
#
|
26
|
-
# == Warning
|
27
|
-
#
|
28
|
-
# NOTE that this does NOT support receiver.should != expected.
|
29
|
-
# Instead, use receiver.should_not == expected
|
30
|
-
def should(matcher=nil, &block)
|
31
|
-
ExpectationMatcherHandler.handle_matcher(self, matcher, &block)
|
32
|
-
end
|
33
|
-
|
34
|
-
# :call-seq:
|
35
|
-
# should_not(matcher)
|
36
|
-
# should_not == expected
|
37
|
-
# should_not === expected
|
38
|
-
# should_not =~ expected
|
39
|
-
#
|
40
|
-
# receiver.should_not(matcher)
|
41
|
-
# => Passes unless matcher.matches?(receiver)
|
42
|
-
#
|
43
|
-
# receiver.should_not == expected
|
44
|
-
# => Passes unless (receiver == expected)
|
45
|
-
#
|
46
|
-
# receiver.should_not === expected
|
47
|
-
# => Passes unless (receiver === expected)
|
48
|
-
#
|
49
|
-
# receiver.should_not =~ regexp
|
50
|
-
# => Passes unless (receiver =~ regexp)
|
51
|
-
#
|
52
|
-
# See Spec::Matchers for more information about matchers
|
53
|
-
def should_not(matcher=nil, &block)
|
54
|
-
NegativeExpectationMatcherHandler.handle_matcher(self, matcher, &block)
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
class Object
|
62
|
-
include Spec::Expectations::ObjectExpectations
|
63
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
$:.push File.join(File.dirname(__FILE__), *%w[.. .. lib])
|
2
|
-
require 'spec/autorun'
|
3
|
-
require 'spec/test/unit'
|
4
|
-
|
5
|
-
describe "An Example" do
|
6
|
-
it "should pass with assert" do
|
7
|
-
assert true
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should fail with assert" do
|
11
|
-
assert false
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should pass with should" do
|
15
|
-
1.should == 1
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should fail with should" do
|
19
|
-
1.should == 2
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class ATest < Test::Unit::TestCase
|
24
|
-
def test_should_pass_with_assert
|
25
|
-
assert true
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_should_fail_with_assert
|
29
|
-
assert false
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_should_pass_with_should
|
33
|
-
1.should == 1
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_should_fail_with_should
|
37
|
-
1.should == 2
|
38
|
-
end
|
39
|
-
|
40
|
-
def setup
|
41
|
-
@from_setup ||= 3
|
42
|
-
@from_setup += 1
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_should_fail_with_setup_method_variable
|
46
|
-
@from_setup.should == 40
|
47
|
-
end
|
48
|
-
|
49
|
-
before do
|
50
|
-
@from_before = @from_setup + 1
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_should_fail_with_before_block_variable
|
54
|
-
@from_before.should == 50
|
55
|
-
end
|
56
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
$:.push File.join(File.dirname(__FILE__), *%w[.. .. lib])
|
2
|
-
require 'spec/autorun'
|
3
|
-
require 'spec/test/unit'
|
4
|
-
|
5
|
-
class MyTest < Test::Unit::TestCase
|
6
|
-
def should_pass_with_should
|
7
|
-
1.should == 1
|
8
|
-
end
|
9
|
-
|
10
|
-
def should_fail_with_should
|
11
|
-
1.should == 2
|
12
|
-
end
|
13
|
-
|
14
|
-
def should_pass_with_assert
|
15
|
-
assert true
|
16
|
-
end
|
17
|
-
|
18
|
-
def should_fail_with_assert
|
19
|
-
assert false
|
20
|
-
end
|
21
|
-
|
22
|
-
def test
|
23
|
-
raise "This is not a real test"
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_ify
|
27
|
-
raise "This is a real test"
|
28
|
-
end
|
29
|
-
end
|