rspec 0.7.5.1 → 0.8.0
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/CHANGES +60 -1
- data/EXAMPLES.rd +38 -19
- data/MIT-LICENSE +1 -1
- data/README +24 -17
- data/RELEASE-PLAN +117 -0
- data/Rakefile +24 -18
- data/TODO.0.8.0 +5 -0
- data/examples/auto_spec_name_generation_example.rb +18 -0
- data/examples/custom_expectation_matchers.rb +53 -0
- data/examples/dynamic_spec.rb +9 -0
- data/examples/io_processor_spec.rb +2 -2
- data/examples/mocking_example.rb +4 -4
- data/examples/partial_mock_example.rb +2 -2
- data/examples/predicate_example.rb +2 -2
- data/examples/stack_spec.rb +32 -36
- data/examples/stubbing_example.rb +19 -19
- data/examples/test_case_spec.rb +6 -6
- data/lib/spec.rb +3 -0
- data/lib/spec/callback.rb +8 -0
- data/lib/spec/callback/extensions/object.rb +4 -0
- data/lib/spec/deprecated.rb +3 -0
- data/lib/spec/expectations.rb +44 -17
- data/lib/spec/expectations/extensions.rb +1 -2
- data/lib/spec/expectations/extensions/object.rb +78 -130
- data/lib/spec/expectations/extensions/string_and_symbol.rb +17 -0
- data/lib/spec/expectations/handler.rb +47 -0
- data/lib/spec/expectations/should/base.rb +32 -29
- data/lib/spec/expectations/should/change.rb +1 -1
- data/lib/spec/expectations/should/have.rb +9 -17
- data/lib/spec/expectations/should/not.rb +54 -56
- data/lib/spec/expectations/should/should.rb +59 -65
- data/lib/spec/expectations/sugar.rb +27 -4
- data/lib/spec/matchers.rb +160 -0
- data/lib/spec/matchers/be.rb +161 -0
- data/lib/spec/matchers/be_close.rb +37 -0
- data/lib/spec/matchers/change.rb +120 -0
- data/lib/spec/matchers/eql.rb +43 -0
- data/lib/spec/matchers/equal.rb +43 -0
- data/lib/spec/matchers/has.rb +44 -0
- data/lib/spec/matchers/have.rb +140 -0
- data/lib/spec/matchers/include.rb +50 -0
- data/lib/spec/matchers/match.rb +41 -0
- data/lib/spec/matchers/raise_error.rb +100 -0
- data/lib/spec/matchers/respond_to.rb +35 -0
- data/lib/spec/matchers/satisfy.rb +47 -0
- data/lib/spec/matchers/throw_symbol.rb +75 -0
- data/lib/spec/mocks.rb +224 -1
- data/lib/spec/mocks/argument_expectation.rb +16 -2
- data/lib/spec/mocks/error_generator.rb +5 -3
- data/lib/spec/mocks/errors.rb +2 -2
- data/lib/spec/mocks/extensions/object.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +29 -19
- data/lib/spec/mocks/{mock_methods.rb → methods.rb} +5 -5
- data/lib/spec/mocks/mock.rb +2 -2
- data/lib/spec/mocks/mock_handler.rb +81 -68
- data/lib/spec/rake/spectask.rb +7 -12
- data/lib/spec/rake/verify_rcov.rb +1 -1
- data/lib/spec/runner.rb +117 -0
- data/lib/spec/runner/command_line.rb +8 -5
- data/lib/spec/runner/context.rb +13 -37
- data/lib/spec/runner/context_eval.rb +4 -3
- data/lib/spec/runner/context_runner.rb +7 -4
- data/lib/spec/runner/drb_command_line.rb +1 -1
- data/lib/spec/runner/execution_context.rb +3 -11
- data/lib/spec/runner/extensions/kernel.rb +7 -5
- data/lib/spec/runner/extensions/object.rb +4 -1
- data/lib/spec/runner/formatter/base_text_formatter.rb +11 -3
- data/lib/spec/runner/formatter/html_formatter.rb +21 -10
- data/lib/spec/runner/heckle_runner.rb +24 -8
- data/lib/spec/runner/heckle_runner_win.rb +10 -0
- data/lib/spec/runner/option_parser.rb +58 -13
- data/lib/spec/runner/spec_matcher.rb +22 -29
- data/lib/spec/runner/spec_parser.rb +1 -0
- data/lib/spec/runner/specification.rb +36 -22
- data/lib/spec/translator.rb +87 -0
- data/lib/spec/version.rb +16 -7
- data/spec/spec/callback/callback_container_spec.rb +27 -0
- data/spec/spec/callback/module_spec.rb +37 -0
- data/spec/spec/callback/object_spec.rb +90 -0
- data/spec/spec/callback/object_with_class_callback_spec.rb +19 -0
- data/spec/spec/expectations/differs/default_spec.rb +107 -0
- data/spec/spec/expectations/extensions/object_spec.rb +46 -0
- data/spec/spec/expectations/fail_with_spec.rb +71 -0
- data/spec/spec/expectations/should/should_==_spec.rb +19 -0
- data/spec/spec/expectations/should/should_=~_spec.rb +13 -0
- data/spec/spec/expectations/should/should_be_a_kind_of_spec.rb +21 -0
- data/spec/spec/expectations/should/should_be_an_instance_of_spec.rb +30 -0
- data/spec/spec/expectations/should/should_be_arbitrary_predicate_spec.rb +81 -0
- data/spec/spec/expectations/should/should_be_close_spec.rb +18 -0
- data/spec/spec/expectations/should/should_be_comparison_operator_spec.rb +44 -0
- data/spec/spec/expectations/should/should_be_false_spec.rb +39 -0
- data/spec/spec/expectations/should/should_be_spec.rb +11 -0
- data/spec/spec/expectations/should/should_be_true_spec.rb +27 -0
- data/spec/spec/expectations/should/should_change_spec.rb +184 -0
- data/spec/spec/expectations/should/should_eql_spec.rb +11 -0
- data/spec/spec/expectations/should/should_equal_spec.rb +11 -0
- data/spec/spec/expectations/should/should_have_at_least_spec.rb +53 -0
- data/spec/spec/expectations/should/should_have_at_most_spec.rb +45 -0
- data/spec/spec/expectations/should/should_have_key_spec.rb +21 -0
- data/spec/spec/expectations/should/should_have_spec.rb +64 -0
- data/spec/spec/expectations/should/should_include_spec.rb +59 -0
- data/spec/spec/expectations/should/should_match_spec.rb +25 -0
- data/spec/spec/expectations/should/should_not_==_spec.rb +15 -0
- data/spec/spec/expectations/should/should_not_be_a_kind_of_spec.rb +21 -0
- data/spec/spec/expectations/should/should_not_be_an_instance_of_spec.rb +11 -0
- data/spec/spec/expectations/should/should_not_be_arbitrary_predicate_spec.rb +68 -0
- data/spec/spec/expectations/should/should_not_be_spec.rb +11 -0
- data/spec/spec/expectations/should/should_not_change_spec.rb +24 -0
- data/spec/spec/expectations/should/should_not_eql_spec.rb +11 -0
- data/spec/spec/expectations/should/should_not_equal_spec.rb +11 -0
- data/spec/spec/expectations/should/should_not_have_key_spec.rb +15 -0
- data/spec/spec/expectations/should/should_not_include_spec.rb +58 -0
- data/spec/spec/expectations/should/should_not_match_spec.rb +11 -0
- data/spec/spec/expectations/should/should_not_raise_spec.rb +75 -0
- data/spec/spec/expectations/should/should_not_respond_to_spec.rb +15 -0
- data/spec/spec/expectations/should/should_not_throw_spec.rb +35 -0
- data/spec/spec/expectations/should/should_raise_spec.rb +66 -0
- data/spec/spec/expectations/should/should_respond_to_spec.rb +15 -0
- data/spec/spec/expectations/should/should_satisfy_spec.rb +35 -0
- data/spec/spec/expectations/should/should_throw_spec.rb +27 -0
- data/spec/spec/matchers/be_close_spec.rb +33 -0
- data/spec/spec/matchers/be_spec.rb +182 -0
- data/spec/spec/matchers/change_spec.rb +232 -0
- data/spec/spec/matchers/description_generation_spec.rb +147 -0
- data/spec/spec/matchers/eql_spec.rb +41 -0
- data/spec/spec/matchers/equal_spec.rb +41 -0
- data/spec/spec/matchers/handler_spec.rb +75 -0
- data/spec/spec/matchers/has_spec.rb +37 -0
- data/spec/spec/matchers/have_spec.rb +259 -0
- data/spec/spec/matchers/include_spec.rb +33 -0
- data/spec/spec/matchers/match_spec.rb +37 -0
- data/spec/spec/matchers/matcher_methods_spec.rb +85 -0
- data/spec/spec/matchers/raise_error_spec.rb +147 -0
- data/spec/spec/matchers/respond_to_spec.rb +30 -0
- data/spec/spec/matchers/satisfy_spec.rb +36 -0
- data/spec/spec/matchers/throw_symbol_spec.rb +59 -0
- data/spec/spec/mocks/any_number_of_times_spec.rb +34 -0
- data/spec/spec/mocks/at_least_spec.rb +97 -0
- data/spec/spec/mocks/at_most_spec.rb +97 -0
- data/spec/spec/mocks/bug_report_7611_spec.rb +19 -0
- data/spec/spec/mocks/bug_report_7805_spec.rb +22 -0
- data/spec/spec/mocks/bug_report_8165_spec.rb +31 -0
- data/spec/spec/mocks/bug_report_8302_spec.rb +26 -0
- data/spec/spec/mocks/failing_mock_argument_constraints_spec.rb +74 -0
- data/spec/spec/mocks/mock_ordering_spec.rb +80 -0
- data/spec/spec/mocks/mock_spec.rb +407 -0
- data/spec/spec/mocks/multiple_return_value_spec.rb +113 -0
- data/spec/spec/mocks/null_object_mock_spec.rb +40 -0
- data/spec/spec/mocks/once_counts_spec.rb +56 -0
- data/spec/spec/mocks/options_hash_spec.rb +31 -0
- data/spec/spec/mocks/partial_mock_spec.rb +52 -0
- data/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +64 -0
- data/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +92 -0
- data/spec/spec/mocks/precise_counts_spec.rb +56 -0
- data/spec/spec/mocks/record_messages_spec.rb +26 -0
- data/spec/spec/mocks/stub_spec.rb +159 -0
- data/spec/spec/mocks/twice_counts_spec.rb +67 -0
- data/spec/spec/runner/command_line_spec.rb +32 -0
- data/spec/spec/runner/context_matching_spec.rb +28 -0
- data/spec/spec/runner/context_runner_spec.rb +100 -0
- data/spec/spec/runner/context_spec.rb +405 -0
- data/spec/spec/runner/drb_command_line_spec.rb +74 -0
- data/spec/spec/runner/execution_context_spec.rb +52 -0
- data/spec/spec/runner/formatter/html_formatter_spec.rb +40 -0
- data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +21 -0
- data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +36 -0
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +78 -0
- data/spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb +18 -0
- data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +41 -0
- data/spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb +21 -0
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +46 -0
- data/spec/spec/runner/heckle_runner_spec.rb +63 -0
- data/spec/spec/runner/heckler_spec.rb +14 -0
- data/spec/spec/runner/kernel_ext_spec.rb +16 -0
- data/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +45 -0
- data/spec/spec/runner/object_ext_spec.rb +11 -0
- data/spec/spec/runner/option_parser_spec.rb +269 -0
- data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +47 -0
- data/spec/spec/runner/reporter_spec.rb +126 -0
- data/spec/spec/runner/spec_matcher_spec.rb +107 -0
- data/spec/spec/runner/spec_name_generation_spec.rb +102 -0
- data/spec/spec/runner/spec_parser_spec.rb +37 -0
- data/spec/spec/runner/specification_class_spec.rb +72 -0
- data/spec/spec/runner/specification_instance_spec.rb +160 -0
- data/spec/spec/runner/specification_should_raise_spec.rb +136 -0
- data/spec/spec/spec_classes.rb +102 -0
- data/spec/spec/translator_spec.rb +79 -0
- data/spec/spec_helper.rb +35 -0
- metadata +141 -9
- data/bin/drbspec +0 -3
- data/lib/spec/expectations/diff.rb +0 -28
- data/lib/spec/expectations/extensions/numeric.rb +0 -19
- data/lib/spec/expectations/extensions/string.rb +0 -22
- data/lib/spec/expectations/message_builder.rb +0 -13
data/CHANGES
CHANGED
@@ -1,11 +1,70 @@
|
|
1
1
|
= RSpec Changelog
|
2
2
|
|
3
|
+
== Version 0.8.0
|
4
|
+
|
5
|
+
This release introduces a new approach to handling expectations using Expression Matchers.
|
6
|
+
|
7
|
+
See Upgrade[http://rspec.rubyforge.org/upgrade.html], Spec::Expectations, Spec::Matchers and RELEASE-PLAN for more info.
|
8
|
+
|
9
|
+
This release also improves the spec command line by adding DRb support and making it possible to
|
10
|
+
store command line options in a file. This means a more flexible RSpec experience with Rails,
|
11
|
+
Rake and editor plugins like TextMate.
|
12
|
+
|
13
|
+
It also sports myriad new features, bug fixes, patches and general goodness:
|
14
|
+
|
15
|
+
* Fixed [#8928] rspec_on_rails 0.8.0-RC1 controller tests make double call to setup_with_fixtures
|
16
|
+
* Fixed [#8925] Documentation bug in 0.8.0RC1 rspec website
|
17
|
+
* Applied [#8132] [PATCH] RSpec breaks "rake db:sessions:create" in a rails project that has the rspec_on_rails plugin (Patch from Erik Kastner)
|
18
|
+
* Fixed [#8789] --line and --spec not working when the context has parenhesis in the name
|
19
|
+
* Added [#8783] auto generate spec names from last expectation
|
20
|
+
* --heckle now fails if the heckled class or module is not found.
|
21
|
+
* Fixed [#8771] Spec::Mocks::BaseExpectation#with converts hash params to array of arrays with #collect
|
22
|
+
* Fixed [#8750] should[_not]_include backwards compatibility between 0.8.0-RC1 and 0.7.5.1 broken
|
23
|
+
* Fixed [#8646] Context Runner does not report on Non standard exceptions and return a 0 return code
|
24
|
+
* RSpec on Rails' spec_helper.rb will only force RAILS_ENV to test if it was not specified on the command line.
|
25
|
+
* Fixed [#5485] proc#should_raise and proc#should_not_raise output
|
26
|
+
* Added [#8484] should_receive with blocks
|
27
|
+
* Applied [#8218] heckle_runner.rb doesn't work with heckle >= 1.2.0 (Patch from Michal Kwiatkowski)
|
28
|
+
* Fixed [#8240] Cryptic error message when no controller_name
|
29
|
+
* Applied [#7461] [PATCH] Contexts don't call Module::included when they include a module
|
30
|
+
* Removed unintended block of test/unit assertions in rspec_on_rails - they should all, in theory, now be accessible
|
31
|
+
* Added mock_model method to RSpec on Rails, which stubs common methods. Based on http://metaclass.org/2006/12/22/making-a-mockery-of-activerecord
|
32
|
+
* Fixed [#8165] Partial Mock Errors when respond_to? is true but the method is not in the object
|
33
|
+
* Fixed [#7611] Partial Mocks override Subclass methods
|
34
|
+
* Fixed [#8302] Strange side effect when mocking a class method
|
35
|
+
* Applied [#8316] to_param should return a stringified key in resource generator's controller spec (Patch from Chris Anderson)
|
36
|
+
* Applied [#8216] shortcut for creating object stub
|
37
|
+
* Applied [#8008] Correct generated specs for view when calling resource generator (Patch from Jonathan Tron)
|
38
|
+
* Fixed [#7754] Command-R fails to run spec in TextMate (added instruction from Luke Redpath to the website)
|
39
|
+
* Fixed [#7826] RSpect.tmbundle web page out of date.
|
40
|
+
* RSpec on Rails specs are now running against RoR 1.2.1 and 1.2.2
|
41
|
+
* rspec_resource now generates specs for views (TODO: make them use the new assert_select, when it's documented)
|
42
|
+
* In a Rails app, RSpec core is only loaded when RAILS_ENV==test (init.rb)
|
43
|
+
* Added support for target.should arbitrary_expectation_handler and target.should_not arbitrary_expectation_handler
|
44
|
+
* Fixed [#7533] Spec suite fails and the process exits with a code 0
|
45
|
+
* Fixed [#7565] Subsequent stub! calls for method fail to override the first call to method
|
46
|
+
* Applied [#7524] Incorrect Documentation for 'pattern' in Rake task (patch from Stephen Duncan)
|
47
|
+
* Fixed [#7409] default fixtures do not appear to run.
|
48
|
+
* Fixed [#7507] "render..and return" doesn't return
|
49
|
+
* Fixed [#7509] rcov/rspec incorrectly includes boot.rb (Patch from Courtenay)
|
50
|
+
* Fixed [#7506] unnecessary complex output on failure of response.should_be_redirect
|
51
|
+
* Applied [#6098] Make scaffold_resource generator. Based on code from Pat Maddox.
|
52
|
+
* The drbspec command is gone. Use spec --drb instead.
|
53
|
+
* The drb option is gone from the Rake task. Pass --drb to spec_opts instead.
|
54
|
+
* New -X/--drb option for running specs against a server like spec/rails' script/rails_spec_server
|
55
|
+
* New -O/--options and -G/--generate flags for file-based options (handy for spec/rails)
|
56
|
+
* Applied [#7339] Turn off caching in HTML reports
|
57
|
+
* Applied [#7419] "c option for colorizing output does not work with rails_spec" (Patch from Shintaro Kakutani)
|
58
|
+
* Applied [#7406] [PATCH] 0.7.5 rspec_on_rails loads fixtures into development database (Patch from Wilson Bilkovich)
|
59
|
+
* Applied [#7387] Allow stubs to return consecutive values (Patch from Pat Maddox)
|
60
|
+
* Applied [#7393] Fix for rake task (Patch from Pat Maddox)
|
61
|
+
* Reinstated support for response.should_render (in addition to controller.should_render)
|
62
|
+
|
3
63
|
== Version 0.7.5.1
|
4
64
|
|
5
65
|
Bug fix release to allow downloads of rspec gem using rubygems 0.9.1.
|
6
66
|
|
7
67
|
== Version 0.7.5
|
8
|
-
|
9
68
|
This release adds support for Heckle - Seattle'rb's code mutation tool.
|
10
69
|
There are also several bug fixes to the RSpec core and the RSpec on Rails plugin.
|
11
70
|
|
data/EXAMPLES.rd
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
# specs with no names
|
2
|
+
# * NAME NOT GENERATED
|
3
|
+
# * NAME NOT GENERATED
|
4
|
+
# * NAME NOT GENERATED
|
5
|
+
# * NAME NOT GENERATED
|
6
|
+
# A mouse
|
7
|
+
# * should eat cheese
|
8
|
+
# * should not eat cat
|
9
|
+
# The month march
|
10
|
+
# * The root of 1 square should be 1
|
11
|
+
# * The root of 2 square should be 2
|
12
|
+
# * The root of 3 square should be 3
|
13
|
+
# * The root of 4 square should be 4
|
14
|
+
# * The root of 5 square should be 5
|
15
|
+
# * The root of 6 square should be 6
|
16
|
+
# * The root of 7 square should be 7
|
17
|
+
# * The root of 8 square should be 8
|
18
|
+
# * The root of 9 square should be 9
|
19
|
+
# * The root of 10 square should be 10
|
1
20
|
# A FileAccessor
|
2
21
|
# * should open a file and pass it to the processor's process method
|
3
22
|
# Greeter
|
@@ -23,29 +42,29 @@
|
|
23
42
|
# State created in context_setup
|
24
43
|
# * should be accessible from spec
|
25
44
|
# * should not have sideffects
|
26
|
-
# A
|
27
|
-
# * should add to the top when sent
|
28
|
-
# * should return the top item when sent
|
29
|
-
# * should NOT remove the top item when sent
|
30
|
-
# * should return the top item when sent
|
31
|
-
# * should remove the top item when sent
|
45
|
+
# A Stack
|
46
|
+
# * should add to the top when sent #push
|
47
|
+
# * should return the top item when sent #peek
|
48
|
+
# * should NOT remove the top item when sent #peek
|
49
|
+
# * should return the top item when sent #pop
|
50
|
+
# * should remove the top item when sent #pop
|
32
51
|
# An empty stack
|
33
|
-
# *
|
34
|
-
# * should no longer be empty after
|
35
|
-
# * should complain when sent
|
36
|
-
# * should complain when sent
|
52
|
+
# * NAME NOT GENERATED
|
53
|
+
# * should no longer be empty after #push
|
54
|
+
# * should complain when sent #peek
|
55
|
+
# * should complain when sent #pop
|
37
56
|
# An almost empty stack (with one item)
|
38
|
-
# *
|
39
|
-
# * should remain not empty after
|
40
|
-
# * should become empty after
|
57
|
+
# * NAME NOT GENERATED
|
58
|
+
# * should remain not empty after #peek
|
59
|
+
# * should become empty after #pop
|
41
60
|
# An almost full stack (with one item less than capacity)
|
42
|
-
# *
|
43
|
-
# * should become full when sent
|
61
|
+
# * NAME NOT GENERATED
|
62
|
+
# * should become full when sent #push
|
44
63
|
# A full stack
|
45
|
-
# *
|
46
|
-
# * should remain full after
|
47
|
-
# * should no longer be full after
|
48
|
-
# * should complain on
|
64
|
+
# * NAME NOT GENERATED
|
65
|
+
# * should remain full after #peek
|
66
|
+
# * should no longer be full after #pop
|
67
|
+
# * should complain on #push
|
49
68
|
# A consumer of a stub
|
50
69
|
# * should be able to stub methods on any Object
|
51
70
|
# A stubbed method on a class
|
data/MIT-LICENSE
CHANGED
data/README
CHANGED
@@ -1,30 +1,38 @@
|
|
1
1
|
== RSpec
|
2
2
|
|
3
|
-
RSpec is a
|
3
|
+
RSpec is a Behaviour Definition Framework intended for use in Behaviour
|
4
|
+
Driven Development. RSpec plays the same role that a unit testing framework
|
5
|
+
would play in a Test Driven Development environment, but does so using
|
6
|
+
words and structures that better support BDD.
|
4
7
|
|
5
|
-
|
8
|
+
RSpec ships with four modules:
|
6
9
|
|
7
|
-
|
8
|
-
|
10
|
+
Spec::Matchers provides Expression Matchers for use with Spec::Expectations
|
11
|
+
and Spec::Mocks.
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
@message.should == "some message"
|
13
|
-
</code>
|
13
|
+
Spec::Expectations supports setting expectations on your objects so you
|
14
|
+
can do things like:
|
14
15
|
|
15
|
-
|
16
|
+
result.should equal(expected_result)
|
17
|
+
|
18
|
+
Spec::Mocks supports creating Mock Objects, Stubs, and adding Mock/Stub
|
19
|
+
behaviour to your existing objects.
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
</code>
|
21
|
+
Spec::Runner provides a very small but powerful DSL for writing executable
|
22
|
+
specifications.
|
20
23
|
|
21
|
-
|
24
|
+
== Installation
|
22
25
|
|
23
|
-
|
26
|
+
The simplest approach is to install the gem:
|
27
|
+
|
28
|
+
gem install -r rspec #mac users must sudo
|
24
29
|
|
25
30
|
== Building the RSpec gem
|
26
|
-
|
27
|
-
|
31
|
+
If you prefer to build the gem locally, check out source from svn://rubyforge.org/var/svn/rspec/trunk. Then
|
32
|
+
do the following:
|
33
|
+
|
34
|
+
rake gem
|
35
|
+
gem install pkg/rspec-0.x.x.gem (you may have to sudo)
|
28
36
|
|
29
37
|
== Running the specs ==
|
30
38
|
In order to run RSpec's full suite of specs (rake pre_commit) you must install the following gems:
|
@@ -45,6 +53,5 @@ and stdlib - with a few exceptions:
|
|
45
53
|
* The spec command line uses diff-lcs when --diff is specified.
|
46
54
|
* The spec command line uses heckle when --heckle is specified.
|
47
55
|
* The Spec::Rake::SpecTask needs RCov if RCov is enabled in the task.
|
48
|
-
* RSpec on Rails needs the ZenTest gem to be installed (and Rails and its dependencies of course)
|
49
56
|
|
50
57
|
See http://rspec.rubyforge.org for further documentation.
|
data/RELEASE-PLAN
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
Beginning with 0.8.0, RSpec is moving towards a new syntax using Expression Matchers
|
2
|
+
instead of adding expectations directly to Object. We'll still be adding a few methods
|
3
|
+
to Object, but it will be much less invasive, and will eliminate conflicts with
|
4
|
+
other tools and frameworks that utilize method_missing to perform magic.
|
5
|
+
|
6
|
+
For more information on Expression Matchers, see the rdoc for Spec::Matchers
|
7
|
+
|
8
|
+
Our plan is as follows:
|
9
|
+
|
10
|
+
* release 0.8.0 with:
|
11
|
+
- full support for Expression Matchers
|
12
|
+
- a translation tool that will convert the majority of your specs from the old syntax to the new syntax
|
13
|
+
- deprecation warnings for all of the old methods that will be removed
|
14
|
+
* release 0.9.0 with all of the old methods removed
|
15
|
+
|
16
|
+
Everything that is listed below is already supported and usable right now.
|
17
|
+
|
18
|
+
== General: should_xyz
|
19
|
+
|
20
|
+
#before
|
21
|
+
actual.should_xyz expected
|
22
|
+
actual.should_not_xyz expected
|
23
|
+
|
24
|
+
#after
|
25
|
+
actual.should xyz(expected)
|
26
|
+
actual.should_not xyz(expected)
|
27
|
+
|
28
|
+
This change applies to all of these as well:
|
29
|
+
|
30
|
+
should_equal
|
31
|
+
should_eql
|
32
|
+
should_be_close
|
33
|
+
should_include
|
34
|
+
should_match
|
35
|
+
should_satisfy
|
36
|
+
|
37
|
+
== should_be
|
38
|
+
|
39
|
+
#before
|
40
|
+
result.should_be true
|
41
|
+
result.should_be false
|
42
|
+
result.should_be nil
|
43
|
+
result.should_not_be nil
|
44
|
+
|
45
|
+
#after
|
46
|
+
result.should be(true)
|
47
|
+
result.should be(false)
|
48
|
+
result.should be(nil)
|
49
|
+
result.should_not be(true)
|
50
|
+
|
51
|
+
== should_be with arbitrary predicates
|
52
|
+
|
53
|
+
#before
|
54
|
+
true.should_be_arbitrary_predicate
|
55
|
+
true.should_be_a_arbitrary_predicate
|
56
|
+
true.should_be_an_arbitrary_predicate
|
57
|
+
|
58
|
+
#after
|
59
|
+
true.should be_arbitrary_predicate
|
60
|
+
true.should be_a_arbitrary_predicate
|
61
|
+
true.should be_an_arbitrary_predicate
|
62
|
+
|
63
|
+
== should_be with comparison operators
|
64
|
+
|
65
|
+
#before
|
66
|
+
5.should_be > 3
|
67
|
+
4.should_be >= 4
|
68
|
+
4.should_be <= 4
|
69
|
+
4.should_be < 4
|
70
|
+
|
71
|
+
#before
|
72
|
+
5.should be > 3
|
73
|
+
4.should be >= 4
|
74
|
+
4.should be <= 4
|
75
|
+
4.should be < 4
|
76
|
+
|
77
|
+
== should ==
|
78
|
+
|
79
|
+
#before
|
80
|
+
actual.should == expected
|
81
|
+
actual.should_not == expected
|
82
|
+
|
83
|
+
#after - exactly the same
|
84
|
+
actual.should == expected
|
85
|
+
actual.should_not == expected
|
86
|
+
|
87
|
+
== should =~
|
88
|
+
|
89
|
+
#before
|
90
|
+
actual.should =~ regexp
|
91
|
+
actual.should_not =~ regexp
|
92
|
+
|
93
|
+
#after - exactly the same
|
94
|
+
actual.should =~ regexp
|
95
|
+
actual.should_not =~ regexp
|
96
|
+
|
97
|
+
== should_have
|
98
|
+
|
99
|
+
#before
|
100
|
+
team.should_have(3).players
|
101
|
+
hash.should_have_key(:a)
|
102
|
+
|
103
|
+
#after
|
104
|
+
team.should have(3).players
|
105
|
+
hash.should have_key(:a)
|
106
|
+
|
107
|
+
== should_change
|
108
|
+
|
109
|
+
#before
|
110
|
+
proc.should_change(:target, message)
|
111
|
+
proc.should_change(:target, message).by(1)
|
112
|
+
proc.should_change(:target, message).from("a").to("b")
|
113
|
+
|
114
|
+
proc.should change(:target, message)
|
115
|
+
proc.should change(:target, message).by(1)
|
116
|
+
proc.should change(:target, message).from("a").to("b")
|
117
|
+
|
data/Rakefile
CHANGED
@@ -7,11 +7,11 @@ require 'rake/rdoctask'
|
|
7
7
|
require 'spec/version'
|
8
8
|
|
9
9
|
# Some of the tasks are in separate files since they are also part of the website documentation
|
10
|
-
load File.dirname(__FILE__) + '/
|
11
|
-
load File.dirname(__FILE__) + '/
|
12
|
-
load File.dirname(__FILE__) + '/
|
13
|
-
load File.dirname(__FILE__) + '/
|
14
|
-
load File.dirname(__FILE__) + '/
|
10
|
+
load File.dirname(__FILE__) + '/rake_tasks/examples.rake'
|
11
|
+
load File.dirname(__FILE__) + '/rake_tasks/examples_specdoc.rake'
|
12
|
+
load File.dirname(__FILE__) + '/rake_tasks/examples_with_rcov.rake'
|
13
|
+
load File.dirname(__FILE__) + '/rake_tasks/failing_examples_with_html.rake'
|
14
|
+
load File.dirname(__FILE__) + '/rake_tasks/verify_rcov.rake'
|
15
15
|
|
16
16
|
PKG_NAME = "rspec"
|
17
17
|
PKG_VERSION = Spec::VERSION::STRING
|
@@ -19,28 +19,25 @@ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
|
19
19
|
PKG_FILES = FileList[
|
20
20
|
'[A-Z]*',
|
21
21
|
'lib/**/*.rb',
|
22
|
-
'
|
23
|
-
'examples/**/*'
|
24
|
-
File.dirname(__FILE__) + '../web_spec/**/*.rb',
|
25
|
-
File.dirname(__FILE__) + '../web_spec/**/*.txt',
|
26
|
-
File.dirname(__FILE__) + '../web_spec/**/*.patch'
|
22
|
+
'spec/**/*.rb',
|
23
|
+
'examples/**/*'
|
27
24
|
]
|
28
25
|
|
29
26
|
task :default => [:spec, :verify_rcov]
|
30
27
|
|
31
28
|
desc "Run all specs"
|
32
29
|
Spec::Rake::SpecTask.new do |t|
|
33
|
-
t.spec_files = FileList['spec/**/*_spec.rb', '
|
30
|
+
t.spec_files = FileList['spec/**/*_spec.rb', '../RSpec.tmbundle/Support/spec/*_spec.rb']
|
34
31
|
t.spec_opts = ['--color','--backtrace']
|
35
32
|
t.rcov = true
|
36
33
|
t.rcov_dir = '../doc/output/coverage'
|
37
|
-
t.rcov_opts = ['--exclude', 'spec\/spec,bin\/spec,
|
34
|
+
t.rcov_opts = ['--exclude', 'spec\/spec,bin\/spec,examples']
|
38
35
|
end
|
39
36
|
|
40
37
|
desc "Run all specs and store html output in doc/output/report.html"
|
41
38
|
Spec::Rake::SpecTask.new('spec_html') do |t|
|
42
39
|
t.spec_files = FileList['spec/**/*_spec.rb', 'vendor/RSpec.tmbundle/Support/spec/*_spec.rb']
|
43
|
-
t.spec_opts = ['--
|
40
|
+
t.spec_opts = ['--format html','--backtrace','--out ../doc/output/report.html']
|
44
41
|
end
|
45
42
|
|
46
43
|
desc "Run all failing examples"
|
@@ -65,15 +62,16 @@ task :webgen do
|
|
65
62
|
end
|
66
63
|
raise "ERROR while running webgen: #{output}" if output =~ /ERROR/n || $? != 0
|
67
64
|
end
|
68
|
-
spec_page = File.
|
69
|
-
|
65
|
+
spec_page = File.expand_path(File.dirname(__FILE__) + '/../doc/output/tools/spec.html')
|
66
|
+
spec_page_content = File.open(spec_page).read
|
67
|
+
raise "#{'!'*400}\nIt seems like the output in the generated documentation is broken (no dots: ......)\n. Look in #{spec_page}" unless spec_page_content =~/\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\./m
|
70
68
|
end
|
71
69
|
|
72
70
|
desc 'Generate RDoc'
|
73
71
|
rd = Rake::RDocTask.new do |rdoc|
|
74
72
|
rdoc.rdoc_dir = '../doc/output/rdoc'
|
75
73
|
rdoc.options << '--title' << 'RSpec' << '--line-numbers' << '--inline-source' << '--main' << 'README'
|
76
|
-
rdoc.rdoc_files.include('README', 'CHANGES', 'MIT-LICENSE', 'EXAMPLES.rd', 'lib/**/*.rb')
|
74
|
+
rdoc.rdoc_files.include('README', 'CHANGES', 'MIT-LICENSE', 'EXAMPLES.rd', 'RELEASE-PLAN', 'lib/**/*.rb')
|
77
75
|
end
|
78
76
|
task :rdoc => :examples_specdoc # We generate EXAMPLES.rd
|
79
77
|
|
@@ -97,7 +95,7 @@ spec = Gem::Specification.new do |s|
|
|
97
95
|
|
98
96
|
s.autorequire = 'spec'
|
99
97
|
s.bindir = 'bin'
|
100
|
-
s.executables = ['spec'
|
98
|
+
s.executables = ['spec']
|
101
99
|
s.default_executable = 'spec'
|
102
100
|
s.author = ["RSpec Development Team"]
|
103
101
|
s.email = "rspec-devel@rubyforge.org"
|
@@ -131,6 +129,7 @@ end
|
|
131
129
|
|
132
130
|
task :clobber do
|
133
131
|
rm_rf '../doc/output'
|
132
|
+
rm_rf 'translated_specs'
|
134
133
|
end
|
135
134
|
|
136
135
|
task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_website, :publish_news]
|
@@ -160,7 +159,14 @@ task :pre_commit => [
|
|
160
159
|
]
|
161
160
|
|
162
161
|
desc "Build the website, but do not publish it"
|
163
|
-
task :website => [:clobber, :verify_rcov, :spec_html, :webgen, :failing_examples_with_html, :examples_specdoc, :rdoc]
|
162
|
+
task :website => [:clobber, :verify_rcov, :spec_html, :webgen, :failing_examples_with_html, :examples_specdoc, :rdoc, :rdoc_rails]
|
163
|
+
|
164
|
+
task :rdoc_rails do
|
165
|
+
Dir.chdir '../rspec_on_rails/vendor/plugins/rspec_on_rails' do
|
166
|
+
rake = (PLATFORM == "i386-mswin32") ? "rake.cmd" : "rake"
|
167
|
+
`#{rake} rdoc`
|
168
|
+
end
|
169
|
+
end
|
164
170
|
|
165
171
|
task :verify_user do
|
166
172
|
raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
|
data/TODO.0.8.0
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
# Run spec w/ -fs to see the output of this file
|
4
|
+
|
5
|
+
context "specs with no names" do
|
6
|
+
|
7
|
+
# spec name is auto-generated as "should equal(5)"
|
8
|
+
specify do
|
9
|
+
3.should equal(3)
|
10
|
+
5.should equal(5)
|
11
|
+
end
|
12
|
+
|
13
|
+
specify { 3.should be < 5 }
|
14
|
+
|
15
|
+
specify { ["a"].should include("a") }
|
16
|
+
|
17
|
+
specify { [1,2,3].should respond_to(:size) }
|
18
|
+
end
|