rspec 1.1.12 → 1.2.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/.autotest +2 -1
- data/.document +7 -0
- data/History.txt +58 -0
- data/License.txt +1 -1
- data/Manifest.txt +45 -82
- data/README.txt +3 -6
- data/Rakefile +33 -13
- data/Ruby1.9.markdown +32 -0
- data/TODO.txt +10 -4
- data/Upgrade.markdown +63 -0
- data/bin/spec +1 -1
- data/cucumber.yml +3 -0
- data/examples/failing/{failing_autogenerated_docstrings_example.rb → failing_implicit_docstrings_example.rb} +0 -0
- data/examples/failing/pending_example.rb +9 -0
- data/examples/failing/spec_helper.rb +1 -1
- data/examples/passing/{custom_expectation_matchers.rb → custom_matchers.rb} +0 -0
- data/examples/passing/filtered_formatter.rb +18 -0
- data/examples/passing/filtered_formatter_example.rb +31 -0
- data/examples/passing/implicit_docstrings_example.rb +18 -0
- data/examples/passing/spec_helper.rb +1 -1
- data/examples/ruby1.9.compatibility/access_to_constants_spec.rb +17 -18
- data/features/before_and_after_blocks/before_and_after_blocks.feature +4 -4
- data/features/example_groups/example_group_with_should_methods.feature +1 -1
- data/features/example_groups/{autogenerated_docstrings.feature → implicit_docstrings.feature} +7 -9
- data/features/example_groups/nested_groups.feature +1 -1
- data/features/heckle/heckle.feature +56 -0
- data/features/interop/examples_and_tests_together.feature +1 -1
- data/features/interop/test_but_not_test_unit.feature +1 -1
- data/features/interop/test_case_with_should_methods.feature +1 -1
- data/features/matchers/create_matcher.feature +115 -0
- data/features/mock_framework_integration/use_flexmock.feature +22 -4
- data/features/mock_framework_integration/use_mocha.feature +27 -0
- data/features/mock_framework_integration/use_rr.feature +27 -0
- data/features/mocks/mix_stubs_and_mocks.feature +22 -0
- data/features/pending/pending_examples.feature +81 -0
- data/features/step_definitions/running_rspec.rb +5 -3
- data/features/support/env.rb +1 -1
- data/features/support/matchers/smart_match.rb +2 -2
- data/lib/autotest/rspec.rb +1 -1
- data/lib/spec.rb +1 -1
- data/lib/{adapters → spec/adapters}/mock_frameworks/flexmock.rb +0 -0
- data/lib/{adapters → spec/adapters}/mock_frameworks/mocha.rb +0 -0
- data/lib/{adapters → spec/adapters}/mock_frameworks/rr.rb +0 -0
- data/lib/{adapters → spec/adapters}/mock_frameworks/rspec.rb +0 -1
- data/lib/spec/autorun.rb +3 -0
- data/lib/spec/dsl.rb +3 -1
- data/lib/spec/dsl/matchers.rb +13 -0
- data/lib/spec/example.rb +4 -0
- data/lib/spec/example/before_and_after_hooks.rb +5 -20
- data/lib/spec/example/errors.rb +3 -3
- data/lib/spec/example/example_description.rb +15 -0
- data/lib/spec/example/example_group.rb +0 -15
- data/lib/spec/example/example_group_factory.rb +34 -46
- data/lib/spec/example/example_group_hierarchy.rb +53 -0
- data/lib/spec/example/example_group_methods.rb +101 -211
- data/lib/spec/example/example_methods.rb +61 -81
- data/lib/spec/example/module_reopening_fix.rb +23 -1
- data/lib/spec/example/pending.rb +3 -2
- data/lib/spec/example/predicate_matchers.rb +47 -0
- data/lib/spec/example/subject.rb +91 -0
- data/lib/spec/expectations.rb +1 -1
- data/lib/spec/expectations/differs/default.rb +0 -1
- data/lib/spec/expectations/extensions.rb +0 -1
- data/lib/spec/expectations/handler.rb +13 -6
- data/lib/spec/interop/test.rb +5 -0
- data/lib/spec/interop/test/unit/testcase.rb +5 -22
- data/lib/spec/matchers.rb +22 -8
- data/lib/spec/matchers/be.rb +4 -9
- data/lib/spec/matchers/be_close.rb +20 -5
- data/lib/spec/matchers/be_instance_of.rb +45 -0
- data/lib/spec/matchers/be_kind_of.rb +45 -0
- data/lib/spec/matchers/change.rb +8 -6
- data/lib/spec/matchers/compatibility.rb +14 -0
- data/lib/spec/matchers/eql.rb +24 -6
- data/lib/spec/matchers/equal.rb +24 -6
- data/lib/spec/matchers/exist.rb +21 -5
- data/lib/spec/matchers/extensions/instance_exec.rb +25 -0
- data/lib/spec/matchers/generated_descriptions.rb +2 -2
- data/lib/spec/matchers/has.rb +28 -11
- data/lib/spec/matchers/have.rb +2 -2
- data/lib/spec/matchers/include.rb +2 -2
- data/lib/spec/matchers/match.rb +25 -7
- data/lib/spec/matchers/match_array.rb +3 -3
- data/lib/spec/matchers/matcher.rb +51 -0
- data/lib/spec/matchers/method_missing.rb +2 -2
- data/lib/spec/matchers/operator_matcher.rb +12 -5
- data/lib/spec/matchers/raise_error.rb +3 -3
- data/lib/spec/matchers/respond_to.rb +3 -3
- data/lib/spec/matchers/satisfy.rb +7 -7
- data/lib/spec/matchers/throw_symbol.rb +3 -5
- data/lib/spec/mocks.rb +3 -3
- data/lib/spec/mocks/argument_expectation.rb +15 -15
- data/lib/spec/mocks/{argument_constraints.rb → argument_matchers.rb} +19 -23
- data/lib/spec/mocks/error_generator.rb +5 -8
- data/lib/spec/mocks/framework.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +5 -13
- data/lib/spec/mocks/mock.rb +4 -5
- data/lib/spec/mocks/proxy.rb +9 -5
- data/lib/spec/mocks/spec_methods.rb +10 -1
- data/lib/spec/rake/spectask.rb +0 -1
- data/lib/spec/runner.rb +6 -28
- data/lib/spec/runner/configuration.rb +3 -3
- data/lib/spec/runner/drb_command_line.rb +2 -1
- data/lib/spec/runner/example_group_runner.rb +3 -2
- data/lib/spec/runner/formatter/base_text_formatter.rb +34 -19
- data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +3 -5
- data/lib/spec/runner/formatter/html_formatter.rb +2 -3
- data/lib/spec/runner/formatter/nested_text_formatter.rb +7 -25
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +1 -1
- data/lib/spec/runner/formatter/snippet_extractor.rb +1 -1
- data/lib/spec/runner/formatter/specdoc_formatter.rb +1 -7
- data/lib/spec/runner/heckle_runner.rb +3 -6
- data/lib/spec/runner/heckle_runner_unsupported.rb +1 -1
- data/lib/spec/runner/option_parser.rb +19 -21
- data/lib/spec/runner/options.rb +32 -27
- data/lib/spec/runner/reporter.rb +8 -9
- data/lib/spec/test/unit.rb +10 -0
- data/lib/spec/version.rb +2 -2
- data/{features/support → resources}/helpers/cmdline.rb +2 -2
- data/resources/rake/verify_rcov.rake +1 -1
- data/resources/spec/example_group_with_should_methods.rb +1 -1
- data/resources/spec/simple_spec.rb +1 -1
- data/resources/test/spec_and_test_together.rb +2 -3
- data/resources/test/spec_including_test_but_not_unit.rb +1 -1
- data/resources/test/test_case_with_should_methods.rb +2 -3
- data/spec/autotest/autotest_helper.rb +0 -1
- data/spec/autotest/rspec_spec.rb +95 -98
- data/spec/spec/dsl/main_spec.rb +3 -3
- data/spec/spec/dsl/matchers_spec.rb +25 -0
- data/spec/spec/example/example_group_class_definition_spec.rb +14 -15
- data/spec/spec/example/example_group_factory_spec.rb +31 -44
- data/spec/spec/example/example_group_methods_spec.rb +86 -52
- data/spec/spec/example/example_group_spec.rb +32 -79
- data/spec/spec/example/example_matcher_spec.rb +10 -10
- data/spec/spec/example/example_methods_spec.rb +108 -242
- data/spec/spec/example/nested_example_group_spec.rb +2 -2
- data/spec/spec/example/pending_module_spec.rb +66 -41
- data/spec/spec/example/shared_example_group_spec.rb +4 -4
- data/spec/spec/{matchers → expectations}/handler_spec.rb +52 -4
- data/spec/spec/interop/test/unit/resources/spec_that_fails.rb +2 -2
- data/spec/spec/interop/test/unit/resources/spec_that_passes.rb +2 -2
- data/spec/spec/interop/test/unit/resources/spec_with_errors.rb +2 -2
- data/spec/spec/interop/test/unit/resources/spec_with_options_hash.rb +2 -2
- data/spec/spec/interop/test/unit/resources/test_case_that_fails.rb +2 -2
- data/spec/spec/interop/test/unit/resources/test_case_that_passes.rb +2 -2
- data/spec/spec/interop/test/unit/resources/test_case_with_errors.rb +2 -2
- data/spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb +2 -2
- data/spec/spec/interop/test/unit/testcase_spec.rb +0 -4
- data/spec/spec/matchers/be_close_spec.rb +1 -1
- data/spec/spec/matchers/be_instance_of_spec.rb +29 -0
- data/spec/spec/matchers/be_kind_of_spec.rb +29 -0
- data/spec/spec/matchers/change_spec.rb +20 -0
- data/spec/spec/matchers/compatibility_spec.rb +34 -0
- data/spec/spec/matchers/description_generation_spec.rb +0 -12
- data/spec/spec/matchers/eql_spec.rb +2 -2
- data/spec/spec/matchers/equal_spec.rb +2 -2
- data/spec/spec/matchers/exist_spec.rb +8 -4
- data/spec/spec/matchers/have_spec.rb +4 -4
- data/spec/spec/matchers/match_spec.rb +2 -2
- data/spec/spec/matchers/matcher_methods_spec.rb +1 -1
- data/spec/spec/matchers/matcher_spec.rb +97 -0
- data/spec/spec/matchers/throw_symbol_spec.rb +8 -8
- data/spec/spec/mocks/{bug_report_496.rb → bug_report_496_spec.rb} +0 -0
- data/spec/spec/mocks/{failing_mock_argument_constraints_spec.rb → failing_argument_matchers_spec.rb} +2 -2
- data/spec/spec/mocks/hash_including_matcher_spec.rb +4 -4
- data/spec/spec/mocks/hash_not_including_matcher_spec.rb +3 -3
- data/spec/spec/mocks/mock_spec.rb +27 -2
- data/spec/spec/mocks/nil_expectation_warning_spec.rb +1 -1
- data/spec/spec/mocks/partial_mock_spec.rb +18 -3
- data/spec/spec/mocks/{passing_mock_argument_constraints_spec.rb → passing_argument_matchers_spec.rb} +6 -6
- data/spec/spec/mocks/stubbed_message_expectations_spec.rb +13 -1
- data/spec/spec/package/bin_spec_spec.rb +2 -2
- data/spec/spec/runner/configuration_spec.rb +12 -12
- data/spec/spec/runner/drb_command_line_spec.rb +71 -73
- data/spec/spec/runner/formatter/base_text_formatter_spec.rb +82 -1
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +8 -8
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +4 -4
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +8 -8
- data/spec/spec/runner/formatter/html_formatted-1.8.7.html +38 -26
- data/spec/spec/runner/formatter/html_formatted-1.9.1.html +61 -53
- data/spec/spec/runner/formatter/html_formatter_spec.rb +100 -48
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +20 -34
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +2 -1
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +9 -6
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +6 -6
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +20 -20
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +38 -26
- data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +55 -47
- data/spec/spec/runner/formatter/{spec_mate_formatter_spec.rb → text_mate_formatter_spec.rb} +11 -9
- data/spec/spec/runner/heckle_runner_spec.rb +1 -1
- data/spec/spec/runner/heckler_spec.rb +1 -1
- data/spec/spec/runner/option_parser_spec.rb +28 -11
- data/spec/spec/runner/options_spec.rb +34 -0
- data/spec/spec/runner/reporter_spec.rb +66 -62
- data/spec/spec/runner/resources/utf8_encoded.rb +1 -0
- data/spec/spec/runner/spec_drb.opts +1 -0
- data/spec/spec/runner_spec.rb +7 -5
- data/spec/spec_helper.rb +24 -2
- metadata +49 -90
- data/examples/passing/autogenerated_docstrings_example.rb +0 -25
- data/examples/passing/before_and_after_example.rb +0 -40
- data/examples/passing/behave_as_example.rb +0 -45
- data/examples/passing/legacy_spec.rb +0 -11
- data/examples/passing/priority.txt +0 -1
- data/features/support/helpers/story_helper.rb +0 -16
- data/lib/spec/expectations/extensions/string_and_symbol.rb +0 -17
- data/lib/spec/runner/formatter/story/html_formatter.rb +0 -174
- data/lib/spec/runner/formatter/story/plain_text_formatter.rb +0 -194
- data/lib/spec/runner/formatter/story/progress_bar_formatter.rb +0 -42
- data/lib/spec/story.rb +0 -10
- data/lib/spec/story/extensions.rb +0 -3
- data/lib/spec/story/extensions/main.rb +0 -86
- data/lib/spec/story/extensions/regexp.rb +0 -9
- data/lib/spec/story/extensions/string.rb +0 -9
- data/lib/spec/story/given_scenario.rb +0 -14
- data/lib/spec/story/runner.rb +0 -57
- data/lib/spec/story/runner/plain_text_story_runner.rb +0 -48
- data/lib/spec/story/runner/scenario_collector.rb +0 -18
- data/lib/spec/story/runner/scenario_runner.rb +0 -54
- data/lib/spec/story/runner/story_mediator.rb +0 -137
- data/lib/spec/story/runner/story_parser.rb +0 -247
- data/lib/spec/story/runner/story_runner.rb +0 -74
- data/lib/spec/story/scenario.rb +0 -14
- data/lib/spec/story/step.rb +0 -70
- data/lib/spec/story/step_group.rb +0 -89
- data/lib/spec/story/step_mother.rb +0 -38
- data/lib/spec/story/story.rb +0 -39
- data/lib/spec/story/world.rb +0 -124
- data/resources/spec/spec_with_flexmock.rb +0 -19
- data/rspec.gemspec +0 -32
- data/spec/spec/matchers/mock_constraint_matchers_spec.rb +0 -24
- data/spec/spec/runner/formatter/story/html_formatter_spec.rb +0 -135
- data/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +0 -600
- data/spec/spec/runner/formatter/story/progress_bar_formatter_spec.rb +0 -82
- data/spec/spec/spec_spec.rb +0 -21
- data/spec/spec/story/builders.rb +0 -46
- data/spec/spec/story/extensions/main_spec.rb +0 -161
- data/spec/spec/story/extensions_spec.rb +0 -14
- data/spec/spec/story/given_scenario_spec.rb +0 -27
- data/spec/spec/story/runner/plain_text_story_runner_spec.rb +0 -90
- data/spec/spec/story/runner/scenario_collector_spec.rb +0 -27
- data/spec/spec/story/runner/scenario_runner_spec.rb +0 -214
- data/spec/spec/story/runner/story_mediator_spec.rb +0 -143
- data/spec/spec/story/runner/story_parser_spec.rb +0 -401
- data/spec/spec/story/runner/story_runner_spec.rb +0 -294
- data/spec/spec/story/runner_spec.rb +0 -93
- data/spec/spec/story/scenario_spec.rb +0 -18
- data/spec/spec/story/step_group_spec.rb +0 -157
- data/spec/spec/story/step_mother_spec.rb +0 -84
- data/spec/spec/story/step_spec.rb +0 -272
- data/spec/spec/story/story_helper.rb +0 -2
- data/spec/spec/story/story_spec.rb +0 -84
- data/spec/spec/story/world_spec.rb +0 -423
- data/story_server/prototype/javascripts/builder.js +0 -136
- data/story_server/prototype/javascripts/controls.js +0 -972
- data/story_server/prototype/javascripts/dragdrop.js +0 -976
- data/story_server/prototype/javascripts/effects.js +0 -1117
- data/story_server/prototype/javascripts/prototype.js +0 -4140
- data/story_server/prototype/javascripts/rspec.js +0 -149
- data/story_server/prototype/javascripts/scriptaculous.js +0 -58
- data/story_server/prototype/javascripts/slider.js +0 -276
- data/story_server/prototype/javascripts/sound.js +0 -55
- data/story_server/prototype/javascripts/unittest.js +0 -568
- data/story_server/prototype/lib/server.rb +0 -24
- data/story_server/prototype/stories.html +0 -176
- data/story_server/prototype/stylesheets/rspec.css +0 -136
- data/story_server/prototype/stylesheets/test.css +0 -90
data/Ruby1.9.markdown
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# RSpec and Ruby 1.9
|
2
|
+
|
3
|
+
Currently, RSpec (core) is mostly compatible with Ruby 1.9.1. There are still
|
4
|
+
outstanding issues, some of which we plan to address and some we don't.
|
5
|
+
|
6
|
+
## Test::Unit
|
7
|
+
|
8
|
+
RSpec/Test::Unit interop will run with the test-unit-1.2.3 gem, but you must install it.
|
9
|
+
|
10
|
+
## Class Variables
|
11
|
+
|
12
|
+
Due to changes in scoping rules, class variables within example groups are not
|
13
|
+
supported in Ruby 1.9.
|
14
|
+
|
15
|
+
describe "a class variable" do
|
16
|
+
@@class_variable = "a class variable"
|
17
|
+
|
18
|
+
it "can access class variables in examples in Ruby 1.8" do
|
19
|
+
with_ruby 1.8 do
|
20
|
+
@@class_variable.should == "a class variable"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "can NOT access class variables in examples in Ruby 1.9" do
|
25
|
+
with_ruby 1.9 do
|
26
|
+
lambda do
|
27
|
+
@@class_variable.should == "a class variable"
|
28
|
+
end.should raise_error(NameError)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
data/TODO.txt
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
Refactoring for 1.2.0
|
4
4
|
|
5
|
-
* eliminate dependency from Spec::Example to Spec::Runner
|
6
5
|
** global predictate matchers should be stored in run_options
|
7
6
|
* eliminate dependency on global options and configuration
|
8
7
|
** the only place they should exist is in the Runner, which should manage them
|
@@ -10,9 +9,16 @@ Refactoring for 1.2.0
|
|
10
9
|
== Future
|
11
10
|
|
12
11
|
* do SOMETHING with the website
|
13
|
-
* extract spec/story to rspec-stories (new gem)
|
14
|
-
* rename top level namespace to Rspec and commands to 'rspec' and 'autorspec'
|
15
|
-
* continue to support Spec 'spec' and 'autospec' as aliases for a reasonable time
|
16
12
|
* separate the underlying framework from the DSL
|
17
13
|
* be able to do everything with classes and methods
|
18
14
|
* tweak raise_error rdoc to show only one arg
|
15
|
+
|
16
|
+
== Ruby 1.9.1
|
17
|
+
|
18
|
+
* one example remains failing
|
19
|
+
* cucumber isn't working yet
|
20
|
+
|
21
|
+
== rspec-2.0
|
22
|
+
|
23
|
+
* rename top level namespace to Rspec and commands to 'rspec' and 'autorspec'
|
24
|
+
* continue to support Spec 'spec' and 'autospec' as aliases for a reasonable time
|
data/Upgrade.markdown
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Upgrade to rspec-1.2.0
|
2
|
+
|
3
|
+
## What's Changed
|
4
|
+
|
5
|
+
### WARNINGS
|
6
|
+
|
7
|
+
* If you use the ruby command to run specs instead of the spec command, you'll
|
8
|
+
need to require 'spec/autorun' or they won't run. This won't affect you if
|
9
|
+
you use the spec command or the Spec::Rake::SpecTask that ships with RSpec.
|
10
|
+
|
11
|
+
* require 'spec/test/unit' to invoke test/unit interop if you're using
|
12
|
+
RSpec's core (this is handled implicitly with spec-rails)
|
13
|
+
|
14
|
+
* setup and teardown are gone - use before and after instead
|
15
|
+
|
16
|
+
* you can still use setup and teardown if you're using
|
17
|
+
Test::Unit::TestCase as the base ExampleGroup class (which is implicit
|
18
|
+
in rspec-rails)
|
19
|
+
|
20
|
+
* The matcher protocol has been improved. The old protocol is still supported,
|
21
|
+
but we added support for two new methods that speak a bit more clearly:
|
22
|
+
|
23
|
+
* ``failure_message => failure_message_for_should``
|
24
|
+
* ``negative_failure_message => failure_message_for_should_not``
|
25
|
+
|
26
|
+
* All references to rubygems have been removed from within rspec's code.
|
27
|
+
|
28
|
+
* See http://gist.github.com/54177 for rationale and suggestions on
|
29
|
+
alternative approaches to loading rubygems
|
30
|
+
|
31
|
+
## What's new
|
32
|
+
|
33
|
+
### Ruby 1.9
|
34
|
+
|
35
|
+
RSpec now works with Ruby 1.9.1. See
|
36
|
+
[http://wiki.github.com/dchelimsky/rspec/ruby-191](http://wiki.github.com/dchelimsky/rspec/ruby-191)
|
37
|
+
for useful information.
|
38
|
+
|
39
|
+
### Improved heckle integration
|
40
|
+
|
41
|
+
RSpec works with heckle again [1]! Gotta use heckle >= 1.4.2 for this to work
|
42
|
+
though, and it only works with ruby-1.8.6 and 1.8.7 (heckle doesn't support
|
43
|
+
1.9.1 yet).
|
44
|
+
|
45
|
+
[sudo] gem install heckle --version ">=1.4.2"
|
46
|
+
spec spec/game/mastermind.rb --heckle Game::Mastermind
|
47
|
+
|
48
|
+
### New Matcher DSL
|
49
|
+
|
50
|
+
We've added a new DSL for generating custom matchers very simply and cleanly.
|
51
|
+
We'll still support the simple_matcher method, so never fear if you're using
|
52
|
+
that, but we recommend that you start developing your new matchers with this
|
53
|
+
new syntax.
|
54
|
+
|
55
|
+
Spec::Matchers.create do :be_a_multiple_of |smaller|
|
56
|
+
match do |bigger|
|
57
|
+
bigger % smaller == 0
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
9.should be_a_multiple_of(3)
|
62
|
+
|
63
|
+
See ``features/matchers/create_matcher_.feature`` for more examples
|
data/bin/spec
CHANGED
data/cucumber.yml
ADDED
File without changes
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), "/../../lib")
|
2
|
+
require 'spec/runner/formatter/nested_text_formatter'
|
3
|
+
|
4
|
+
class FilteredFormatter < Spec::Runner::Formatter::NestedTextFormatter
|
5
|
+
def add_example_group(example_group)
|
6
|
+
if example_group.options[:show] == false
|
7
|
+
@showing = false
|
8
|
+
else
|
9
|
+
@showing = true
|
10
|
+
puts example_group.description
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def example_passed(example)
|
15
|
+
puts " " << example.description if @showing unless example.options[:show] == false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This demonstrates how you can write custom formatters to handle arbitrary
|
2
|
+
# options passed to the +describe+ and +it+ methods. To see it in action, stand
|
3
|
+
# in the project root and say:
|
4
|
+
#
|
5
|
+
# bin/spec -r examples/passing/filtered_formatter.rb examples/passing/filtered_formatter_example.rb -f FilteredFormatter
|
6
|
+
#
|
7
|
+
# You should only see the examples and groups below that are not explicitly
|
8
|
+
# marked :show => false
|
9
|
+
#
|
10
|
+
# group 1
|
11
|
+
# example 1 a
|
12
|
+
# group 3
|
13
|
+
# example 3
|
14
|
+
|
15
|
+
|
16
|
+
describe "group 1", :show => true do
|
17
|
+
it "example 1 a", :show => true do
|
18
|
+
end
|
19
|
+
it "example 1 b", :show => false do
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "group 2", :show => false do
|
24
|
+
it "example 2" do
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "group 3" do
|
29
|
+
it "example 3" do
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
# Run "spec implicit_docstrings_example.rb --format specdoc" to see the output of this file
|
4
|
+
|
5
|
+
describe "Examples with no docstrings generate their own:" do
|
6
|
+
|
7
|
+
specify { 3.should be < 5 }
|
8
|
+
|
9
|
+
specify { ["a"].should include("a") }
|
10
|
+
|
11
|
+
specify { [1,2,3].should respond_to(:size) }
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 1 do
|
16
|
+
it { should == 1 }
|
17
|
+
it { should be < 2}
|
18
|
+
end
|
@@ -12,33 +12,33 @@ module Foo
|
|
12
12
|
def method_in_enclosing_module;end
|
13
13
|
CONSTANT_IN_ENCLOSING_MODULE = 0
|
14
14
|
|
15
|
-
describe "Examples trying to access constants defined in an enclosing module" do
|
15
|
+
describe "Examples trying to access constants defined in an enclosing module" do
|
16
16
|
|
17
|
-
it "can access Modules" do
|
17
|
+
it "can access Modules" do
|
18
18
|
ModuleInEnclosingModule
|
19
19
|
end
|
20
|
-
it "can access Classes" do
|
20
|
+
it "can access Classes" do
|
21
21
|
ClassInEnclosingModule.new
|
22
22
|
end
|
23
|
-
it "can access CONSTANTS" do
|
23
|
+
it "can access CONSTANTS" do
|
24
24
|
CONSTANT_IN_ENCLOSING_MODULE
|
25
25
|
end
|
26
|
-
it "can NOT access methods" do
|
26
|
+
it "can NOT access methods" do
|
27
27
|
lambda {method_in_enclosing_module}.should raise_error(/undefined/)
|
28
28
|
end
|
29
29
|
|
30
|
-
describe "from a nested example group" do
|
30
|
+
describe "from a nested example group" do
|
31
31
|
|
32
|
-
it "can access Modules" do
|
32
|
+
it "can access Modules" do
|
33
33
|
ModuleInEnclosingModule
|
34
34
|
end
|
35
|
-
it "can access Classes" do
|
35
|
+
it "can access Classes" do
|
36
36
|
ClassInEnclosingModule.new
|
37
37
|
end
|
38
|
-
it "can access CONSTANTS" do
|
38
|
+
it "can access CONSTANTS" do
|
39
39
|
CONSTANT_IN_ENCLOSING_MODULE
|
40
40
|
end
|
41
|
-
it "can NOT access methods" do
|
41
|
+
it "can NOT access methods" do
|
42
42
|
lambda {method_in_enclosing_module}.should raise_error(/undefined/)
|
43
43
|
end
|
44
44
|
|
@@ -46,7 +46,7 @@ module Foo
|
|
46
46
|
|
47
47
|
end
|
48
48
|
|
49
|
-
describe "Examples trying to access constants defined in the example group" do
|
49
|
+
describe "Examples trying to access constants defined in the example group" do
|
50
50
|
|
51
51
|
module ModuleDefinedInGroup;end
|
52
52
|
class ClassDefinedInGroup; end
|
@@ -56,13 +56,13 @@ module Foo
|
|
56
56
|
it "can access Modules" do
|
57
57
|
ModuleDefinedInGroup
|
58
58
|
end
|
59
|
-
it "can access Classes" do
|
59
|
+
it "can access Classes" do
|
60
60
|
ClassDefinedInGroup.new
|
61
61
|
end
|
62
|
-
it "can access CONSTANTS" do
|
62
|
+
it "can access CONSTANTS" do
|
63
63
|
CONSTANT_DEFINED_IN_GROUP
|
64
64
|
end
|
65
|
-
it "can access methods" do
|
65
|
+
it "can access methods" do
|
66
66
|
method_defined_in_group
|
67
67
|
end
|
68
68
|
|
@@ -70,17 +70,16 @@ module Foo
|
|
70
70
|
it "can access Modules" do
|
71
71
|
ModuleDefinedInGroup
|
72
72
|
end
|
73
|
-
it "can access Classes" do
|
73
|
+
it "can access Classes" do
|
74
74
|
ClassDefinedInGroup.new
|
75
75
|
end
|
76
|
-
it "can access CONSTANTS" do
|
76
|
+
it "can access CONSTANTS" do
|
77
77
|
CONSTANT_DEFINED_IN_GROUP
|
78
78
|
end
|
79
|
-
it "can access methods" do
|
79
|
+
it "can access methods" do
|
80
80
|
method_defined_in_group
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
@@ -57,7 +57,7 @@ Feature: before and after blocks
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
"""
|
60
|
-
When I run it with the spec
|
60
|
+
When I run it with the spec command
|
61
61
|
Then the stdout should match "3 examples, 0 failures"
|
62
62
|
|
63
63
|
Scenario: define before(:all) block in example group
|
@@ -89,7 +89,7 @@ Feature: before and after blocks
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
"""
|
92
|
-
When I run it with the spec
|
92
|
+
When I run it with the spec command
|
93
93
|
Then the stdout should match "3 examples, 0 failures"
|
94
94
|
|
95
95
|
Scenario: define before and after blocks in configuration
|
@@ -125,7 +125,7 @@ Feature: before and after blocks
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
"""
|
128
|
-
When I run it with the spec
|
128
|
+
When I run it with the spec command
|
129
129
|
Then the stdout should match "3 examples, 0 failures"
|
130
130
|
|
131
131
|
Scenario: before/after blocks are run in order
|
@@ -163,6 +163,6 @@ Feature: before and after blocks
|
|
163
163
|
end
|
164
164
|
"""
|
165
165
|
|
166
|
-
When I run it with the spec
|
166
|
+
When I run it with the spec command
|
167
167
|
Then the stdout should match /before suite\nbefore all\nbefore each\nafter each\n\.after all\n.*after suite/m
|
168
168
|
|
@@ -12,6 +12,6 @@ Feature: Spec::ExampleGroup with should methods
|
|
12
12
|
|
13
13
|
Scenario: Run with spec
|
14
14
|
Given the file ../../resources/spec/example_group_with_should_methods.rb
|
15
|
-
When I run it with the spec
|
15
|
+
When I run it with the spec command
|
16
16
|
Then the exit code should be 256
|
17
17
|
And the stdout should match "2 examples, 1 failure"
|
data/features/example_groups/{autogenerated_docstrings.feature → implicit_docstrings.feature}
RENAMED
@@ -1,21 +1,20 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: implicit docstrings
|
2
2
|
|
3
3
|
As an RSpec user
|
4
4
|
I want examples to generate their own names
|
5
5
|
So that I can reduce duplication between example names and example code
|
6
6
|
|
7
7
|
Scenario: run passing examples with ruby
|
8
|
-
Given the file ../../examples/passing/
|
8
|
+
Given the file ../../examples/passing/implicit_docstrings_example.rb
|
9
9
|
|
10
10
|
When I run it with the ruby interpreter -fs
|
11
11
|
|
12
|
-
Then the stdout should match /should equal 5/
|
13
12
|
And the stdout should match /should be < 5/
|
14
13
|
And the stdout should match /should include "a"/
|
15
14
|
And the stdout should match /should respond to #size/
|
16
15
|
|
17
16
|
Scenario: run failing examples with ruby
|
18
|
-
Given the file ../../examples/failing/
|
17
|
+
Given the file ../../examples/failing/failing_implicit_docstrings_example.rb
|
19
18
|
|
20
19
|
When I run it with the ruby interpreter -fs
|
21
20
|
|
@@ -25,19 +24,18 @@ Feature: autogenerated docstrings
|
|
25
24
|
And the stdout should match /should not respond to #size/
|
26
25
|
|
27
26
|
Scenario: run passing examples with spec
|
28
|
-
Given the file ../../examples/passing/
|
27
|
+
Given the file ../../examples/passing/implicit_docstrings_example.rb
|
29
28
|
|
30
|
-
When I run it with the spec
|
29
|
+
When I run it with the spec command -fs
|
31
30
|
|
32
|
-
Then the stdout should match /should equal 5/
|
33
31
|
And the stdout should match /should be < 5/
|
34
32
|
And the stdout should match /should include "a"/
|
35
33
|
And the stdout should match /should respond to #size/
|
36
34
|
|
37
35
|
Scenario: run failing examples with spec
|
38
|
-
Given the file ../../examples/failing/
|
36
|
+
Given the file ../../examples/failing/failing_implicit_docstrings_example.rb
|
39
37
|
|
40
|
-
When I run it with the spec
|
38
|
+
When I run it with the spec command -fs
|
41
39
|
|
42
40
|
Then the stdout should match /should equal 2/
|
43
41
|
And the stdout should match /should be > 5/
|
@@ -12,6 +12,6 @@ Feature: Nested example groups
|
|
12
12
|
|
13
13
|
Scenario: Run with spec
|
14
14
|
Given the file ../../examples/passing/stack_spec_with_nested_example_groups.rb
|
15
|
-
When I run it with the spec
|
15
|
+
When I run it with the spec command -fs
|
16
16
|
Then the stdout should match /Stack \(empty\)/
|
17
17
|
And the stdout should match /Stack \(full\)/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Feature: heckle a class
|
2
|
+
|
3
|
+
As an RSpec user who wants to verify that
|
4
|
+
my specs cover what I think it covers
|
5
|
+
I want to heckle a class
|
6
|
+
|
7
|
+
Scenario: Heckle finds problems
|
8
|
+
Given the following spec:
|
9
|
+
"""
|
10
|
+
class Thing
|
11
|
+
def a_or_b
|
12
|
+
if true
|
13
|
+
"a"
|
14
|
+
else
|
15
|
+
"b"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Thing do
|
21
|
+
it "returns a for true" do
|
22
|
+
Thing.new.a_or_b.should == "a"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
"""
|
26
|
+
When I run it with the spec command --heckle Thing
|
27
|
+
Then the stdout should match "The following mutations didn't cause test failures:"
|
28
|
+
But the stdout should not match "FAILED"
|
29
|
+
|
30
|
+
Scenario: Heckle does not find a problem
|
31
|
+
Given the following spec:
|
32
|
+
"""
|
33
|
+
class Thing
|
34
|
+
def a_or_b(key)
|
35
|
+
if key
|
36
|
+
"a"
|
37
|
+
else
|
38
|
+
"b"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe Thing do
|
44
|
+
it "returns a for true" do
|
45
|
+
Thing.new.a_or_b(true).should == "a"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "returns b for false" do
|
49
|
+
Thing.new.a_or_b(false).should == "b"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
"""
|
53
|
+
When I run it with the spec command --heckle Thing
|
54
|
+
Then the stdout should match "No mutants survived"
|
55
|
+
But the stdout should not match "FAILED"
|
56
|
+
|