rspec-core 3.0.0.beta2 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.yardopts +1 -0
- data/Changelog.md +297 -57
- data/README.md +16 -13
- data/lib/rspec/core.rb +55 -84
- data/lib/rspec/core/backport_random.rb +35 -3
- data/lib/rspec/core/backtrace_formatter.rb +4 -13
- data/lib/rspec/core/configuration.rb +330 -114
- data/lib/rspec/core/configuration_options.rb +38 -22
- data/lib/rspec/core/drb.rb +111 -0
- data/lib/rspec/core/dsl.rb +8 -2
- data/lib/rspec/core/example.rb +203 -94
- data/lib/rspec/core/example_group.rb +344 -316
- data/lib/rspec/core/filter_manager.rb +135 -90
- data/lib/rspec/core/flat_map.rb +1 -0
- data/lib/rspec/core/formatters.rb +50 -14
- data/lib/rspec/core/formatters/base_formatter.rb +32 -138
- data/lib/rspec/core/formatters/base_text_formatter.rb +32 -253
- data/lib/rspec/core/formatters/console_codes.rb +65 -0
- data/lib/rspec/core/formatters/deprecation_formatter.rb +24 -15
- data/lib/rspec/core/formatters/documentation_formatter.rb +7 -10
- data/lib/rspec/core/formatters/helpers.rb +15 -9
- data/lib/rspec/core/formatters/html_formatter.rb +17 -16
- data/lib/rspec/core/formatters/html_printer.rb +1 -0
- data/lib/rspec/core/formatters/json_formatter.rb +18 -20
- data/lib/rspec/core/formatters/profile_formatter.rb +67 -0
- data/lib/rspec/core/formatters/progress_formatter.rb +6 -7
- data/lib/rspec/core/formatters/snippet_extractor.rb +8 -6
- data/lib/rspec/core/hooks.rb +131 -125
- data/lib/rspec/core/memoized_helpers.rb +31 -26
- data/lib/rspec/core/metadata.rb +277 -184
- data/lib/rspec/core/metadata_filter.rb +86 -0
- data/lib/rspec/core/minitest_assertions_adapter.rb +28 -0
- data/lib/rspec/core/mocking_adapters/flexmock.rb +1 -1
- data/lib/rspec/core/mocking_adapters/mocha.rb +1 -1
- data/lib/rspec/core/mocking_adapters/null.rb +1 -1
- data/lib/rspec/core/mocking_adapters/rr.rb +2 -1
- data/lib/rspec/core/mocking_adapters/rspec.rb +1 -1
- data/lib/rspec/core/notifications.rb +435 -24
- data/lib/rspec/core/option_parser.rb +16 -25
- data/lib/rspec/core/ordering.rb +3 -1
- data/lib/rspec/core/pending.rb +57 -33
- data/lib/rspec/core/project_initializer.rb +2 -0
- data/lib/rspec/core/project_initializer/spec_helper.rb +5 -4
- data/lib/rspec/core/rake_task.rb +45 -20
- data/lib/rspec/core/reporter.rb +50 -22
- data/lib/rspec/core/ruby_project.rb +1 -0
- data/lib/rspec/core/runner.rb +93 -39
- data/lib/rspec/core/shared_context.rb +7 -5
- data/lib/rspec/core/shared_example_group.rb +85 -77
- data/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
- data/lib/rspec/core/version.rb +3 -1
- data/lib/rspec/core/warnings.rb +35 -17
- data/lib/rspec/core/world.rb +57 -5
- metadata +56 -369
- metadata.gz.sig +3 -3
- data/features/README.md +0 -13
- data/features/Upgrade.md +0 -352
- data/features/command_line/README.md +0 -25
- data/features/command_line/dry_run.feature +0 -29
- data/features/command_line/example_name_option.feature +0 -97
- data/features/command_line/exit_status.feature +0 -82
- data/features/command_line/fail_fast.feature +0 -26
- data/features/command_line/format_option.feature +0 -75
- data/features/command_line/init.feature +0 -57
- data/features/command_line/line_number_appended_to_path.feature +0 -140
- data/features/command_line/line_number_option.feature +0 -58
- data/features/command_line/order.feature +0 -25
- data/features/command_line/pattern_option.feature +0 -49
- data/features/command_line/rake_task.feature +0 -122
- data/features/command_line/randomization.feature +0 -63
- data/features/command_line/require_option.feature +0 -43
- data/features/command_line/ruby.feature +0 -23
- data/features/command_line/tag.feature +0 -98
- data/features/command_line/warnings_option.feature +0 -29
- data/features/configuration/alias_example_to.feature +0 -39
- data/features/configuration/backtrace_exclusion_patterns.feature +0 -105
- data/features/configuration/custom_settings.feature +0 -84
- data/features/configuration/default_path.feature +0 -38
- data/features/configuration/deprecation_stream.feature +0 -58
- data/features/configuration/enable_global_dsl.feature +0 -54
- data/features/configuration/fail_fast.feature +0 -77
- data/features/configuration/failure_exit_code.feature +0 -36
- data/features/configuration/order_and_seed.feature +0 -3
- data/features/configuration/output_stream.feature +0 -24
- data/features/configuration/overriding_global_ordering.feature +0 -93
- data/features/configuration/pattern.feature +0 -38
- data/features/configuration/profile.feature +0 -220
- data/features/configuration/read_options_from_file.feature +0 -90
- data/features/configuration/run_all_when_everything_filtered.feature +0 -76
- data/features/example_groups/aliasing.feature +0 -48
- data/features/example_groups/basic_structure.feature +0 -55
- data/features/example_groups/shared_context.feature +0 -74
- data/features/example_groups/shared_examples.feature +0 -286
- data/features/expectation_framework_integration/configure_expectation_framework.feature +0 -102
- data/features/filtering/exclusion_filters.feature +0 -135
- data/features/filtering/if_and_unless.feature +0 -138
- data/features/filtering/inclusion_filters.feature +0 -101
- data/features/formatters/configurable_colors.feature +0 -31
- data/features/formatters/custom_formatter.feature +0 -68
- data/features/formatters/json_formatter.feature +0 -30
- data/features/formatters/regression_tests.feature +0 -95
- data/features/formatters/text_formatter.feature +0 -46
- data/features/helper_methods/arbitrary_methods.feature +0 -40
- data/features/helper_methods/let.feature +0 -50
- data/features/helper_methods/modules.feature +0 -146
- data/features/hooks/around_hooks.feature +0 -344
- data/features/hooks/before_and_after_hooks.feature +0 -427
- data/features/hooks/filtering.feature +0 -232
- data/features/metadata/current_example.feature +0 -56
- data/features/metadata/described_class.feature +0 -17
- data/features/metadata/user_defined.feature +0 -100
- data/features/mock_framework_integration/use_any_framework.feature +0 -106
- data/features/mock_framework_integration/use_flexmock.feature +0 -94
- data/features/mock_framework_integration/use_mocha.feature +0 -95
- data/features/mock_framework_integration/use_rr.feature +0 -96
- data/features/mock_framework_integration/use_rspec.feature +0 -95
- data/features/pending_and_skipped_examples/README.md +0 -3
- data/features/pending_and_skipped_examples/pending_examples.feature +0 -118
- data/features/pending_and_skipped_examples/skipped_examples.feature +0 -106
- data/features/spec_files/arbitrary_file_suffix.feature +0 -13
- data/features/step_definitions/additional_cli_steps.rb +0 -83
- data/features/subject/explicit_subject.feature +0 -101
- data/features/subject/implicit_subject.feature +0 -63
- data/features/subject/one_liner_syntax.feature +0 -71
- data/features/support/env.rb +0 -21
- data/features/support/require_expect_syntax_in_aruba_specs.rb +0 -16
- data/features/support/rubinius.rb +0 -6
- data/lib/rspec/core/command_line.rb +0 -35
- data/lib/rspec/core/drb_command_line.rb +0 -26
- data/lib/rspec/core/drb_options.rb +0 -87
- data/lib/rspec/core/formatters/legacy_formatter.rb +0 -227
- data/lib/rspec/core/shared_example_group/collection.rb +0 -27
- data/spec/command_line/order_spec.rb +0 -211
- data/spec/rspec/core/backtrace_formatter_spec.rb +0 -230
- data/spec/rspec/core/command_line_spec.rb +0 -112
- data/spec/rspec/core/command_line_spec_output.txt +0 -0
- data/spec/rspec/core/configuration_options_spec.rb +0 -409
- data/spec/rspec/core/configuration_spec.rb +0 -1479
- data/spec/rspec/core/drb_command_line_spec.rb +0 -102
- data/spec/rspec/core/drb_options_spec.rb +0 -193
- data/spec/rspec/core/dsl_spec.rb +0 -88
- data/spec/rspec/core/example_group_spec.rb +0 -1533
- data/spec/rspec/core/example_spec.rb +0 -642
- data/spec/rspec/core/filter_manager_spec.rb +0 -229
- data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -64
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +0 -303
- data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +0 -208
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +0 -75
- data/spec/rspec/core/formatters/helpers_spec.rb +0 -104
- data/spec/rspec/core/formatters/html_formatted-2.1.0.html +0 -392
- data/spec/rspec/core/formatters/html_formatted.html +0 -397
- data/spec/rspec/core/formatters/html_formatter_spec.rb +0 -122
- data/spec/rspec/core/formatters/json_formatter_spec.rb +0 -206
- data/spec/rspec/core/formatters/legacy_formatter_spec.rb +0 -137
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -43
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +0 -26
- data/spec/rspec/core/formatters_spec.rb +0 -120
- data/spec/rspec/core/hooks_filtering_spec.rb +0 -227
- data/spec/rspec/core/hooks_spec.rb +0 -294
- data/spec/rspec/core/memoized_helpers_spec.rb +0 -495
- data/spec/rspec/core/metadata_spec.rb +0 -491
- data/spec/rspec/core/option_parser_spec.rb +0 -262
- data/spec/rspec/core/ordering_spec.rb +0 -102
- data/spec/rspec/core/pending_example_spec.rb +0 -117
- data/spec/rspec/core/pending_spec.rb +0 -8
- data/spec/rspec/core/project_initializer_spec.rb +0 -73
- data/spec/rspec/core/rake_task_spec.rb +0 -146
- data/spec/rspec/core/random_spec.rb +0 -47
- data/spec/rspec/core/reporter_spec.rb +0 -155
- data/spec/rspec/core/resources/a_bar.rb +0 -0
- data/spec/rspec/core/resources/a_foo.rb +0 -0
- data/spec/rspec/core/resources/a_spec.rb +0 -1
- data/spec/rspec/core/resources/custom_example_group_runner.rb +0 -14
- data/spec/rspec/core/resources/formatter_specs.rb +0 -58
- data/spec/rspec/core/resources/utf8_encoded.rb +0 -8
- data/spec/rspec/core/rspec_matchers_spec.rb +0 -45
- data/spec/rspec/core/ruby_project_spec.rb +0 -26
- data/spec/rspec/core/runner_spec.rb +0 -151
- data/spec/rspec/core/shared_context_spec.rb +0 -102
- data/spec/rspec/core/shared_example_group/collection_spec.rb +0 -57
- data/spec/rspec/core/shared_example_group_spec.rb +0 -114
- data/spec/rspec/core/warnings_spec.rb +0 -29
- data/spec/rspec/core/world_spec.rb +0 -142
- data/spec/rspec/core_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -160
- data/spec/support/config_options_helper.rb +0 -13
- data/spec/support/formatter_support.rb +0 -83
- data/spec/support/helper_methods.rb +0 -26
- data/spec/support/isolate_load_path_mutation.rb +0 -5
- data/spec/support/isolated_directory.rb +0 -10
- data/spec/support/isolated_home_directory.rb +0 -16
- data/spec/support/legacy_formatter_using_sub_classing_example.rb +0 -87
- data/spec/support/matchers.rb +0 -85
- data/spec/support/mathn_integration_support.rb +0 -12
- data/spec/support/old_style_formatter_example.rb +0 -69
- data/spec/support/shared_example_groups.rb +0 -13
- data/spec/support/spec_files.rb +0 -44
- data/spec/support/stderr_splitter.rb +0 -36
@@ -1,82 +0,0 @@
|
|
1
|
-
Feature: exit status
|
2
|
-
|
3
|
-
The rspec command exits with an exit status of 0 if all examples pass,
|
4
|
-
and 1 if any examples fail. The failure exit code can be overridden
|
5
|
-
using the --failure-exit-code option.
|
6
|
-
|
7
|
-
Scenario: exit with 0 when all examples pass
|
8
|
-
Given a file named "ok_spec.rb" with:
|
9
|
-
"""ruby
|
10
|
-
describe "ok" do
|
11
|
-
it "passes" do
|
12
|
-
end
|
13
|
-
end
|
14
|
-
"""
|
15
|
-
When I run `rspec ok_spec.rb`
|
16
|
-
Then the exit status should be 0
|
17
|
-
And the examples should all pass
|
18
|
-
|
19
|
-
Scenario: exit with 1 when one example fails
|
20
|
-
Given a file named "ko_spec.rb" with:
|
21
|
-
"""ruby
|
22
|
-
describe "KO" do
|
23
|
-
it "fails" do
|
24
|
-
raise "KO"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
"""
|
28
|
-
When I run `rspec ko_spec.rb`
|
29
|
-
Then the exit status should be 1
|
30
|
-
And the output should contain "1 example, 1 failure"
|
31
|
-
|
32
|
-
Scenario: exit with 1 when a nested examples fails
|
33
|
-
Given a file named "nested_ko_spec.rb" with:
|
34
|
-
"""ruby
|
35
|
-
describe "KO" do
|
36
|
-
describe "nested" do
|
37
|
-
it "fails" do
|
38
|
-
raise "KO"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
"""
|
43
|
-
When I run `rspec nested_ko_spec.rb`
|
44
|
-
Then the exit status should be 1
|
45
|
-
And the output should contain "1 example, 1 failure"
|
46
|
-
|
47
|
-
Scenario: exit with 0 when no examples are run
|
48
|
-
Given a file named "a_no_examples_spec.rb" with:
|
49
|
-
"""ruby
|
50
|
-
"""
|
51
|
-
When I run `rspec a_no_examples_spec.rb`
|
52
|
-
Then the exit status should be 0
|
53
|
-
And the output should contain "0 examples"
|
54
|
-
|
55
|
-
Scenario: exit with 2 when one example fails and --failure-exit-code is 2
|
56
|
-
Given a file named "ko_spec.rb" with:
|
57
|
-
"""ruby
|
58
|
-
describe "KO" do
|
59
|
-
it "fails" do
|
60
|
-
raise "KO"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
"""
|
64
|
-
When I run `rspec --failure-exit-code 2 ko_spec.rb`
|
65
|
-
Then the exit status should be 2
|
66
|
-
And the output should contain "1 example, 1 failure"
|
67
|
-
|
68
|
-
Scenario: exit with rspec's exit code when an at_exit hook is added upstream
|
69
|
-
Given a file named "exit_at_spec.rb" with:
|
70
|
-
"""ruby
|
71
|
-
require 'rspec/autorun'
|
72
|
-
at_exit { exit(0) }
|
73
|
-
|
74
|
-
RSpec.describe "exit 0 at_exit" do
|
75
|
-
it "does not interfere with rspec's exit code" do
|
76
|
-
fail
|
77
|
-
end
|
78
|
-
end
|
79
|
-
"""
|
80
|
-
When I run `ruby exit_at_spec.rb`
|
81
|
-
Then the exit status should be 1
|
82
|
-
And the output should contain "1 example, 1 failure"
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Feature: --fail-fast
|
2
|
-
|
3
|
-
Use the `--fail-fast` option to tell RSpec to stop running the test suite on the first failed test.
|
4
|
-
|
5
|
-
You may also specify `--no-fail-fast` to turn it off (default behaviour).
|
6
|
-
|
7
|
-
Background:
|
8
|
-
Given a file named "fail_fast_spec.rb" with:
|
9
|
-
"""ruby
|
10
|
-
describe "fail fast" do
|
11
|
-
it "passing test" do; end
|
12
|
-
it "failing test" do
|
13
|
-
fail
|
14
|
-
end
|
15
|
-
it "this should not be run" do; end
|
16
|
-
end
|
17
|
-
"""
|
18
|
-
|
19
|
-
Scenario: Using --fail-fast
|
20
|
-
When I run `rspec . --fail-fast`
|
21
|
-
Then the output should contain ".F"
|
22
|
-
Then the output should not contain ".F."
|
23
|
-
|
24
|
-
Scenario: Using --no-fail-fast
|
25
|
-
When I run `rspec . --no-fail-fast`
|
26
|
-
Then the output should contain ".F."
|
@@ -1,75 +0,0 @@
|
|
1
|
-
Feature: --format option
|
2
|
-
|
3
|
-
Use the --format option to tell RSpec how to format the output.
|
4
|
-
|
5
|
-
RSpec ships with several formatters built in. By default, it uses the progress
|
6
|
-
formatter, which generates output like this:
|
7
|
-
|
8
|
-
....F.....*.....
|
9
|
-
|
10
|
-
A '.' represents a passing example, 'F' is failing, and '*' is pending.
|
11
|
-
|
12
|
-
Use the documentation formatter to see the documentation strings passed to
|
13
|
-
`describe`, `it`, and their aliases:
|
14
|
-
|
15
|
-
$ rspec spec --format documentation
|
16
|
-
|
17
|
-
You can also specify an output target ($stdout by default) with an --out
|
18
|
-
option immediately following the --format option:
|
19
|
-
|
20
|
-
$ rspec spec --format documentation --out rspec.txt
|
21
|
-
|
22
|
-
Run `rspec --help` to see a listing of available formatters.
|
23
|
-
|
24
|
-
Background:
|
25
|
-
Given a file named "example_spec.rb" with:
|
26
|
-
"""ruby
|
27
|
-
describe "something" do
|
28
|
-
it "does something that passes" do
|
29
|
-
expect(5).to eq(5)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "does something that fails" do
|
33
|
-
expect(5).to eq(4)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "does something that is pending", :pending => true do
|
37
|
-
expect(5).to be < 3
|
38
|
-
end
|
39
|
-
end
|
40
|
-
"""
|
41
|
-
|
42
|
-
Scenario: progress bar format (default)
|
43
|
-
When I run `rspec --format progress example_spec.rb`
|
44
|
-
Then the output should contain ".F*"
|
45
|
-
|
46
|
-
Scenario: documentation format
|
47
|
-
When I run `rspec example_spec.rb --format documentation`
|
48
|
-
Then the output should contain:
|
49
|
-
"""
|
50
|
-
something
|
51
|
-
does something that passes
|
52
|
-
does something that fails (FAILED - 1)
|
53
|
-
does something that is pending (PENDING: No reason given)
|
54
|
-
"""
|
55
|
-
|
56
|
-
Scenario: documentation format saved to a file
|
57
|
-
When I run `rspec example_spec.rb --format documentation --out rspec.txt`
|
58
|
-
Then the file "rspec.txt" should contain:
|
59
|
-
"""
|
60
|
-
something
|
61
|
-
does something that passes
|
62
|
-
does something that fails (FAILED - 1)
|
63
|
-
does something that is pending (PENDING: No reason given)
|
64
|
-
"""
|
65
|
-
|
66
|
-
Scenario: multiple formats and output targets
|
67
|
-
When I run `rspec example_spec.rb --format progress --format documentation --out rspec.txt`
|
68
|
-
Then the output should contain ".F*"
|
69
|
-
And the file "rspec.txt" should contain:
|
70
|
-
"""
|
71
|
-
something
|
72
|
-
does something that passes
|
73
|
-
does something that fails (FAILED - 1)
|
74
|
-
does something that is pending (PENDING: No reason given)
|
75
|
-
"""
|
@@ -1,57 +0,0 @@
|
|
1
|
-
Feature: --init option
|
2
|
-
|
3
|
-
Use the --init option on the command line to generate conventional
|
4
|
-
files for an rspec project. It generates a `.rspec` and
|
5
|
-
`spec/spec_helper.rb` with some example settings to get you started.
|
6
|
-
|
7
|
-
Scenario: generate .rspec
|
8
|
-
When I run `rspec --init`
|
9
|
-
Then the following files should exist:
|
10
|
-
| .rspec |
|
11
|
-
And the output should contain "create .rspec"
|
12
|
-
|
13
|
-
Scenario: .rspec file already exists
|
14
|
-
Given a file named ".rspec" with:
|
15
|
-
"""
|
16
|
-
--color
|
17
|
-
"""
|
18
|
-
When I run `rspec --init`
|
19
|
-
Then the output should contain "exist .rspec"
|
20
|
-
|
21
|
-
Scenario: Accept and use the recommended settings in spec_helper (which are initially commented out).
|
22
|
-
Given I have a brand new project with no files
|
23
|
-
And I have run `rspec --init`
|
24
|
-
When I accept the recommended settings by removing `=begin` and `=end` from `spec/spec_helper.rb`
|
25
|
-
And I create "spec/addition_spec.rb" with the following content:
|
26
|
-
"""ruby
|
27
|
-
RSpec.describe "Addition" do
|
28
|
-
it "works" do
|
29
|
-
expect(1 + 1).to eq(2)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
"""
|
33
|
-
And I create "spec/subtraction_spec.rb" with the following content:
|
34
|
-
"""ruby
|
35
|
-
RSpec.describe "Subtraction" do
|
36
|
-
it "works" do
|
37
|
-
expect(1 - 1).to eq(0)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
"""
|
41
|
-
|
42
|
-
When I run `rspec`
|
43
|
-
Then the examples should all pass
|
44
|
-
And the output should not contain:
|
45
|
-
"""
|
46
|
-
Addition
|
47
|
-
works
|
48
|
-
"""
|
49
|
-
|
50
|
-
When I run `rspec spec/addition_spec.rb`
|
51
|
-
Then the examples should all pass
|
52
|
-
And the output should contain:
|
53
|
-
"""
|
54
|
-
Addition
|
55
|
-
works
|
56
|
-
"""
|
57
|
-
|
@@ -1,140 +0,0 @@
|
|
1
|
-
Feature: line number appended to file path
|
2
|
-
|
3
|
-
To run one or more examples or groups, you can append the line number to the path, e.g.
|
4
|
-
|
5
|
-
rspec path/to/example_spec.rb:37
|
6
|
-
|
7
|
-
Background:
|
8
|
-
Given a file named "example_spec.rb" with:
|
9
|
-
"""ruby
|
10
|
-
describe "outer group" do
|
11
|
-
|
12
|
-
it "first example in outer group" do
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
it "second example in outer group" do
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "nested group" do
|
21
|
-
|
22
|
-
it "example in nested group" do
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
"""
|
30
|
-
And a file named "example2_spec.rb" with:
|
31
|
-
"""ruby
|
32
|
-
describe "yet another group" do
|
33
|
-
it "first example in second file" do
|
34
|
-
end
|
35
|
-
it "second example in second file" do
|
36
|
-
end
|
37
|
-
end
|
38
|
-
"""
|
39
|
-
|
40
|
-
Scenario: nested groups - outer group on declaration line
|
41
|
-
When I run `rspec example_spec.rb:1 --format doc`
|
42
|
-
Then the examples should all pass
|
43
|
-
And the output should contain "second example in outer group"
|
44
|
-
And the output should contain "first example in outer group"
|
45
|
-
And the output should contain "example in nested group"
|
46
|
-
|
47
|
-
Scenario: nested groups - outer group inside block before example
|
48
|
-
When I run `rspec example_spec.rb:2 --format doc`
|
49
|
-
Then the examples should all pass
|
50
|
-
And the output should contain "second example in outer group"
|
51
|
-
And the output should contain "first example in outer group"
|
52
|
-
And the output should contain "example in nested group"
|
53
|
-
|
54
|
-
Scenario: nested groups - inner group on declaration line
|
55
|
-
When I run `rspec example_spec.rb:11 --format doc`
|
56
|
-
Then the examples should all pass
|
57
|
-
And the output should contain "example in nested group"
|
58
|
-
And the output should not contain "second example in outer group"
|
59
|
-
And the output should not contain "first example in outer group"
|
60
|
-
|
61
|
-
Scenario: nested groups - inner group inside block before example
|
62
|
-
When I run `rspec example_spec.rb:12 --format doc`
|
63
|
-
Then the examples should all pass
|
64
|
-
And the output should contain "example in nested group"
|
65
|
-
And the output should not contain "second example in outer group"
|
66
|
-
And the output should not contain "first example in outer group"
|
67
|
-
|
68
|
-
Scenario: two examples - first example on declaration line
|
69
|
-
When I run `rspec example_spec.rb:3 --format doc`
|
70
|
-
Then the examples should all pass
|
71
|
-
And the output should contain "first example in outer group"
|
72
|
-
But the output should not contain "second example in outer group"
|
73
|
-
And the output should not contain "example in nested group"
|
74
|
-
|
75
|
-
Scenario: two examples - first example inside block
|
76
|
-
When I run `rspec example_spec.rb:4 --format doc`
|
77
|
-
Then the examples should all pass
|
78
|
-
And the output should contain "first example in outer group"
|
79
|
-
But the output should not contain "second example in outer group"
|
80
|
-
And the output should not contain "example in nested group"
|
81
|
-
|
82
|
-
Scenario: two examples - first example on end
|
83
|
-
When I run `rspec example_spec.rb:5 --format doc`
|
84
|
-
Then the examples should all pass
|
85
|
-
And the output should contain "first example in outer group"
|
86
|
-
But the output should not contain "second example in outer group"
|
87
|
-
And the output should not contain "example in nested group"
|
88
|
-
|
89
|
-
Scenario: two examples - first example after end but before next example
|
90
|
-
When I run `rspec example_spec.rb:6 --format doc`
|
91
|
-
Then the examples should all pass
|
92
|
-
And the output should contain "first example in outer group"
|
93
|
-
But the output should not contain "second example in outer group"
|
94
|
-
And the output should not contain "example in nested group"
|
95
|
-
|
96
|
-
Scenario: two examples - second example on declaration line
|
97
|
-
When I run `rspec example_spec.rb:7 --format doc`
|
98
|
-
Then the examples should all pass
|
99
|
-
And the output should contain "second example in outer group"
|
100
|
-
But the output should not contain "first example in outer group"
|
101
|
-
And the output should not contain "example in nested group"
|
102
|
-
|
103
|
-
Scenario: two examples - second example inside block
|
104
|
-
When I run `rspec example_spec.rb:7 --format doc`
|
105
|
-
Then the examples should all pass
|
106
|
-
And the output should contain "second example in outer group"
|
107
|
-
But the output should not contain "first example in outer group"
|
108
|
-
And the output should not contain "example in nested group"
|
109
|
-
|
110
|
-
Scenario: two examples - second example on end
|
111
|
-
When I run `rspec example_spec.rb:7 --format doc`
|
112
|
-
Then the examples should all pass
|
113
|
-
And the output should contain "second example in outer group"
|
114
|
-
But the output should not contain "first example in outer group"
|
115
|
-
And the output should not contain "example in nested group"
|
116
|
-
|
117
|
-
Scenario: specified multiple times for different files
|
118
|
-
When I run `rspec example_spec.rb:7 example2_spec.rb:4 --format doc`
|
119
|
-
Then the examples should all pass
|
120
|
-
And the output should contain "second example in outer group"
|
121
|
-
And the output should contain "second example in second file"
|
122
|
-
But the output should not contain "first example in outer group"
|
123
|
-
And the output should not contain "nested group"
|
124
|
-
And the output should not contain "first example in second file"
|
125
|
-
|
126
|
-
Scenario: specified multiple times for the same file with multiple arguments
|
127
|
-
When I run `rspec example_spec.rb:7 example_spec.rb:11 --format doc`
|
128
|
-
Then the examples should all pass
|
129
|
-
And the output should contain "second example in outer group"
|
130
|
-
And the output should contain "nested group"
|
131
|
-
But the output should not contain "first example in outer group"
|
132
|
-
And the output should not contain "second file"
|
133
|
-
|
134
|
-
Scenario: specified multiple times for the same file with a single argument
|
135
|
-
When I run `rspec example_spec.rb:7:11 --format doc`
|
136
|
-
Then the examples should all pass
|
137
|
-
And the output should contain "second example in outer group"
|
138
|
-
And the output should contain "nested group"
|
139
|
-
But the output should not contain "first example in outer group"
|
140
|
-
And the output should not contain "second file"
|
@@ -1,58 +0,0 @@
|
|
1
|
-
Feature: --line_number option
|
2
|
-
|
3
|
-
To run a examples or groups by line numbers, one can use the --line_number option:
|
4
|
-
|
5
|
-
rspec path/to/example_spec.rb --line_number 37
|
6
|
-
|
7
|
-
This option can be specified multiple times.
|
8
|
-
|
9
|
-
Scenario: standard examples
|
10
|
-
Given a file named "example_spec.rb" with:
|
11
|
-
"""ruby
|
12
|
-
require "rspec/expectations"
|
13
|
-
|
14
|
-
describe 9 do
|
15
|
-
|
16
|
-
it "should be > 8" do
|
17
|
-
expect(9).to be > 8
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should be < 10" do
|
21
|
-
expect(9).to be < 10
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should be 3 squared" do
|
25
|
-
expect(9).to be 3*3
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
"""
|
30
|
-
When I run `rspec example_spec.rb --line_number 5 --format doc`
|
31
|
-
Then the examples should all pass
|
32
|
-
And the output should contain "should be > 8"
|
33
|
-
But the output should not contain "should be < 10"
|
34
|
-
And the output should not contain "should be 3*3"
|
35
|
-
|
36
|
-
When I run `rspec example_spec.rb --line_number 5 --line_number 9 --format doc`
|
37
|
-
Then the examples should all pass
|
38
|
-
And the output should contain "should be > 8"
|
39
|
-
And the output should contain "should be < 10"
|
40
|
-
But the output should not contain "should be 3*3"
|
41
|
-
|
42
|
-
Scenario: one liner
|
43
|
-
Given a file named "example_spec.rb" with:
|
44
|
-
"""ruby
|
45
|
-
require "rspec/expectations"
|
46
|
-
|
47
|
-
describe 9 do
|
48
|
-
|
49
|
-
it { is_expected.to be > 8 }
|
50
|
-
|
51
|
-
it { is_expected.not_to be < 10 }
|
52
|
-
|
53
|
-
end
|
54
|
-
"""
|
55
|
-
When I run `rspec example_spec.rb --line_number 5 --format doc`
|
56
|
-
Then the examples should all pass
|
57
|
-
Then the output should contain "should be > 8"
|
58
|
-
But the output should not contain "should be < 10"
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Feature: --order (new in rspec-core-2.8)
|
2
|
-
|
3
|
-
Use the `--order` option to tell RSpec how to order the files, groups, and
|
4
|
-
examples. Options are `defined` and `rand`.
|
5
|
-
|
6
|
-
`defined` is the default, which executes groups and examples in the
|
7
|
-
order they are defined as the spec files are loaded.
|
8
|
-
|
9
|
-
Use `rand` to randomize the order of groups and examples within groups.*
|
10
|
-
|
11
|
-
* Nested groups are always run from top-level to bottom-level in order to avoid
|
12
|
-
executing `before(:all)` and `after(:all)` hooks more than once, but the order
|
13
|
-
of groups at each level is randomized.
|
14
|
-
|
15
|
-
You can also specify a seed:
|
16
|
-
|
17
|
-
<h3>Examples</h3>
|
18
|
-
|
19
|
-
--order defined
|
20
|
-
--order rand
|
21
|
-
--order rand:123
|
22
|
-
--seed 123 # same as --order rand:123
|
23
|
-
|
24
|
-
The `defined` option is only necessary when you have `--order rand` stored in a
|
25
|
-
config file (e.g. `.rspec`) and you want to override it from the command line.
|