rspec-core 3.0.0.beta2 → 3.0.0.rc1
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.
- 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,49 +0,0 @@
|
|
1
|
-
Feature: pattern option
|
2
|
-
|
3
|
-
By default, RSpec loads files matching the pattern:
|
4
|
-
|
5
|
-
"spec/**/*_spec.rb"
|
6
|
-
|
7
|
-
Use the `--pattern` option to declare a different pattern.
|
8
|
-
|
9
|
-
Scenario: default pattern
|
10
|
-
Given a file named "spec/example_spec.rb" with:
|
11
|
-
"""ruby
|
12
|
-
describe "addition" do
|
13
|
-
it "adds things" do
|
14
|
-
expect(1 + 2).to eq(3)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
"""
|
18
|
-
When I run `rspec`
|
19
|
-
Then the output should contain "1 example, 0 failures"
|
20
|
-
|
21
|
-
Scenario: override the default pattern on the command line
|
22
|
-
Given a file named "spec/example.spec" with:
|
23
|
-
"""ruby
|
24
|
-
describe "addition" do
|
25
|
-
it "adds things" do
|
26
|
-
expect(1 + 2).to eq(3)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
"""
|
30
|
-
When I run `rspec --pattern "spec/**/*.spec"`
|
31
|
-
Then the output should contain "1 example, 0 failures"
|
32
|
-
|
33
|
-
Scenario: override the default pattern in configuration
|
34
|
-
Given a file named "spec/spec_helper.rb" with:
|
35
|
-
"""ruby
|
36
|
-
RSpec.configure do |config|
|
37
|
-
config.pattern << ',**/*.spec'
|
38
|
-
end
|
39
|
-
"""
|
40
|
-
And a file named "spec/example.spec" with:
|
41
|
-
"""ruby
|
42
|
-
describe "addition" do
|
43
|
-
it "adds things" do
|
44
|
-
expect(1 + 2).to eq(3)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
"""
|
48
|
-
When I run `rspec -rspec_helper`
|
49
|
-
Then the output should contain "1 example, 0 failures"
|
@@ -1,122 +0,0 @@
|
|
1
|
-
Feature: rake task
|
2
|
-
|
3
|
-
RSpec ships with a rake task with a number of useful options
|
4
|
-
|
5
|
-
Scenario: default options with passing spec (prints command and exit status is 0)
|
6
|
-
Given a file named "Rakefile" with:
|
7
|
-
"""ruby
|
8
|
-
require 'rspec/core/rake_task'
|
9
|
-
|
10
|
-
RSpec::Core::RakeTask.new(:spec)
|
11
|
-
|
12
|
-
task :default => :spec
|
13
|
-
"""
|
14
|
-
And a file named "spec/thing_spec.rb" with:
|
15
|
-
"""ruby
|
16
|
-
describe "something" do
|
17
|
-
it "does something" do
|
18
|
-
# pass
|
19
|
-
end
|
20
|
-
end
|
21
|
-
"""
|
22
|
-
When I run `rake`
|
23
|
-
Then the output should match /(ruby|rbx) -S rspec/
|
24
|
-
Then the exit status should be 0
|
25
|
-
|
26
|
-
Scenario: default options with failing spec (exit status is 1)
|
27
|
-
Given a file named "Rakefile" with:
|
28
|
-
"""ruby
|
29
|
-
require 'rspec/core/rake_task'
|
30
|
-
|
31
|
-
RSpec::Core::RakeTask.new(:spec)
|
32
|
-
|
33
|
-
task :default => :spec
|
34
|
-
"""
|
35
|
-
And a file named "spec/thing_spec.rb" with:
|
36
|
-
"""ruby
|
37
|
-
describe "something" do
|
38
|
-
it "does something" do
|
39
|
-
fail
|
40
|
-
end
|
41
|
-
end
|
42
|
-
"""
|
43
|
-
When I run `rake`
|
44
|
-
Then the exit status should be 1
|
45
|
-
|
46
|
-
Scenario: fail_on_error = false with failing spec (exit status is 0)
|
47
|
-
Given a file named "Rakefile" with:
|
48
|
-
"""ruby
|
49
|
-
require 'rspec/core/rake_task'
|
50
|
-
|
51
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
52
|
-
t.fail_on_error = false
|
53
|
-
end
|
54
|
-
|
55
|
-
task :default => :spec
|
56
|
-
"""
|
57
|
-
And a file named "spec/thing_spec.rb" with:
|
58
|
-
"""ruby
|
59
|
-
describe "something" do
|
60
|
-
it "does something" do
|
61
|
-
fail
|
62
|
-
end
|
63
|
-
end
|
64
|
-
"""
|
65
|
-
When I run `rake`
|
66
|
-
Then the exit status should be 0
|
67
|
-
|
68
|
-
Scenario: rspec_opts is specified in order to pass args to the rspec command
|
69
|
-
Given a file named "Rakefile" with:
|
70
|
-
"""ruby
|
71
|
-
require 'rspec/core/rake_task'
|
72
|
-
|
73
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
74
|
-
t.rspec_opts = "--tag fast"
|
75
|
-
end
|
76
|
-
"""
|
77
|
-
And a file named "spec/thing_spec.rb" with:
|
78
|
-
"""ruby
|
79
|
-
describe "something" do
|
80
|
-
it "has a tag", :fast => true do
|
81
|
-
# pass
|
82
|
-
end
|
83
|
-
|
84
|
-
it "does not have a tag" do
|
85
|
-
fail
|
86
|
-
end
|
87
|
-
end
|
88
|
-
"""
|
89
|
-
When I run `rake spec`
|
90
|
-
Then the exit status should be 0
|
91
|
-
Then the output should match:
|
92
|
-
"""
|
93
|
-
(ruby|rbx) -S rspec ./spec/thing_spec.rb --tag fast
|
94
|
-
"""
|
95
|
-
|
96
|
-
Scenario: rspec_opts is specified using arguments to the rake task
|
97
|
-
Given a file named "Rakefile" with:
|
98
|
-
"""ruby
|
99
|
-
require 'rspec/core/rake_task'
|
100
|
-
|
101
|
-
RSpec::Core::RakeTask.new(:spec, :tag) do |t, task_args|
|
102
|
-
t.rspec_opts = "--tag #{task_args[:tag]}"
|
103
|
-
end
|
104
|
-
"""
|
105
|
-
And a file named "spec/thing_spec.rb" with:
|
106
|
-
"""ruby
|
107
|
-
describe "something" do
|
108
|
-
it "has a tag", :fast => true do
|
109
|
-
# pass
|
110
|
-
end
|
111
|
-
|
112
|
-
it "does not have a tag" do
|
113
|
-
fail
|
114
|
-
end
|
115
|
-
end
|
116
|
-
"""
|
117
|
-
When I run `rake spec[fast]`
|
118
|
-
Then the exit status should be 0
|
119
|
-
Then the output should match:
|
120
|
-
"""
|
121
|
-
(ruby|rbx) -S rspec ./spec/thing_spec.rb --tag fast
|
122
|
-
"""
|
@@ -1,63 +0,0 @@
|
|
1
|
-
Feature: Randomization can be reproduced across test runs
|
2
|
-
|
3
|
-
In Ruby, randomness is seeded by calling `srand`
|
4
|
-
and passing it the seed that you want to use.
|
5
|
-
By doing this, subsequent calls to `rand`, `shuffle`, `sample`, etc.
|
6
|
-
will all be randomized the same way given the same seed is passed to `srand`.
|
7
|
-
|
8
|
-
RSpec takes care not to seed randomization directly
|
9
|
-
when taking action that involves randomness
|
10
|
-
(such as random ordering of examples).
|
11
|
-
|
12
|
-
Since RSpec does not ever invoke `srand`, this means that you
|
13
|
-
are free to choose which, if any, mechanism is used to seed randomization.
|
14
|
-
|
15
|
-
There is an example below of how to use RSpec's seed for this purpose
|
16
|
-
if you wish to do so.
|
17
|
-
|
18
|
-
If you would like to manage seeding randomization without any help from RSpec,
|
19
|
-
please keep the following things in mind:
|
20
|
-
|
21
|
-
* The seed should never be hard-coded.
|
22
|
-
|
23
|
-
The first example below only does this to show that seeding randomization
|
24
|
-
with a seed other than the one used by RSpec
|
25
|
-
will correctly seed randomization.
|
26
|
-
|
27
|
-
* Report the seed that was chosen.
|
28
|
-
|
29
|
-
The randomization that was used for a given test run can not be reproduced
|
30
|
-
if noone knows what seed was used to begin with.
|
31
|
-
|
32
|
-
* Provide a mechanism to feed the seed into the tests.
|
33
|
-
|
34
|
-
Without this, the call to `srand` will have to be hard-coded any time
|
35
|
-
it is necessary to replicate a given test run's randomness.
|
36
|
-
|
37
|
-
Background:
|
38
|
-
Given a file named "spec/random_spec.rb" with:
|
39
|
-
"""ruby
|
40
|
-
require 'spec_helper'
|
41
|
-
|
42
|
-
describe 'randomized example' do
|
43
|
-
it 'prints random numbers' do
|
44
|
-
puts 5.times.map { rand(99) }.join("-")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
"""
|
48
|
-
|
49
|
-
Scenario: Specifying a seed using srand provides predictable randomization
|
50
|
-
Given a file named "spec/spec_helper.rb" with:
|
51
|
-
"""ruby
|
52
|
-
srand 123
|
53
|
-
"""
|
54
|
-
When I run `rspec`
|
55
|
-
Then the output should contain "66-92-98-17-83"
|
56
|
-
|
57
|
-
Scenario: Passing the RSpec seed to srand provides predictable randomization
|
58
|
-
Given a file named "spec/spec_helper.rb" with:
|
59
|
-
"""ruby
|
60
|
-
srand RSpec.configuration.seed
|
61
|
-
"""
|
62
|
-
When I run `rspec --seed 123`
|
63
|
-
Then the output should contain "66-92-98-17-83"
|
@@ -1,43 +0,0 @@
|
|
1
|
-
Feature: --require option
|
2
|
-
|
3
|
-
Use the `--require` (or `-r`) option to specify a file to require
|
4
|
-
before running specs.
|
5
|
-
|
6
|
-
Scenario: using the --require option
|
7
|
-
Given a file named "logging_formatter.rb" with:
|
8
|
-
"""ruby
|
9
|
-
require "rspec/core/formatters/base_text_formatter"
|
10
|
-
require 'delegate'
|
11
|
-
|
12
|
-
class LoggingFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
13
|
-
def initialize(output)
|
14
|
-
super LoggingIO.new(output)
|
15
|
-
end
|
16
|
-
|
17
|
-
class LoggingIO < SimpleDelegator
|
18
|
-
def initialize(output)
|
19
|
-
@file = File.new('rspec.log', 'w')
|
20
|
-
super
|
21
|
-
end
|
22
|
-
|
23
|
-
def puts(*args)
|
24
|
-
[@file, __getobj__].each { |out| out.puts(*args) }
|
25
|
-
end
|
26
|
-
|
27
|
-
def close
|
28
|
-
@file.close
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
"""
|
33
|
-
And a file named "spec/example_spec.rb" with:
|
34
|
-
"""ruby
|
35
|
-
describe "an embarassing situation" do
|
36
|
-
it "happens to everyone" do
|
37
|
-
end
|
38
|
-
end
|
39
|
-
"""
|
40
|
-
When I run `rspec --require ./logging_formatter.rb --format LoggingFormatter`
|
41
|
-
Then the output should contain "1 example, 0 failures"
|
42
|
-
And the file "rspec.log" should contain "1 example, 0 failures"
|
43
|
-
And the exit status should be 0
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Feature: run with ruby command
|
2
|
-
|
3
|
-
You can use the `ruby` command to run specs. You just need to require
|
4
|
-
`rspec/autorun`.
|
5
|
-
|
6
|
-
Generally speaking, you're better off using the `rspec` command, which
|
7
|
-
avoids the complexity of `rspec/autorun` (e.g. no `at_exit` hook needed!),
|
8
|
-
but some tools only work with the `ruby` command.
|
9
|
-
|
10
|
-
Scenario: Require `rspec/autorun` from a spec file
|
11
|
-
Given a file named "example_spec.rb" with:
|
12
|
-
"""ruby
|
13
|
-
require 'rspec/autorun'
|
14
|
-
|
15
|
-
RSpec.describe 1 do
|
16
|
-
it "is < 2" do
|
17
|
-
expect(1).to be < 2
|
18
|
-
end
|
19
|
-
end
|
20
|
-
"""
|
21
|
-
When I run `ruby example_spec.rb`
|
22
|
-
Then the output should contain "1 example, 0 failures"
|
23
|
-
|
@@ -1,98 +0,0 @@
|
|
1
|
-
Feature: --tag option
|
2
|
-
|
3
|
-
Use the --tag (or -t) option to filter the examples by tags.
|
4
|
-
|
5
|
-
The tag can be a simple name or a name:value pair. In the first case,
|
6
|
-
examples with :name => true will be filtered. In the second case, examples
|
7
|
-
with :name => value will be filtered, where value is always a string. In
|
8
|
-
both cases, name is converted to a symbol.
|
9
|
-
|
10
|
-
Tags can also be used to exclude examples by adding a ~ before the tag. For
|
11
|
-
example ~tag will exclude all examples marked with :tag => true and
|
12
|
-
~tag:value will exclude all examples marked with :tag => value.
|
13
|
-
|
14
|
-
To be compatible with the Cucumber syntax, tags can optionally start with
|
15
|
-
an @ symbol, which will be ignored.
|
16
|
-
|
17
|
-
Background:
|
18
|
-
Given a file named "tagged_spec.rb" with:
|
19
|
-
"""ruby
|
20
|
-
describe "group with tagged specs" do
|
21
|
-
it "example I'm working now", :focus => true do; end
|
22
|
-
it "special example with string", :type => 'special' do; end
|
23
|
-
it "special example with symbol", :type => :special do; end
|
24
|
-
it "slow example", :skip => true do; end
|
25
|
-
it "ordinary example", :speed => 'slow' do; end
|
26
|
-
it "untagged example" do; end
|
27
|
-
end
|
28
|
-
"""
|
29
|
-
|
30
|
-
Scenario: filter examples with non-existent tag
|
31
|
-
When I run `rspec . --tag mytag`
|
32
|
-
Then the process should succeed even though no examples were run
|
33
|
-
|
34
|
-
Scenario: filter examples with a simple tag
|
35
|
-
When I run `rspec . --tag focus`
|
36
|
-
Then the output should contain "include {:focus=>true}"
|
37
|
-
And the examples should all pass
|
38
|
-
|
39
|
-
Scenario: filter examples with a simple tag and @
|
40
|
-
When I run `rspec . --tag @focus`
|
41
|
-
Then the output should contain "include {:focus=>true}"
|
42
|
-
Then the examples should all pass
|
43
|
-
|
44
|
-
Scenario: filter examples with a name:value tag
|
45
|
-
When I run `rspec . --tag type:special`
|
46
|
-
Then the output should contain:
|
47
|
-
"""
|
48
|
-
include {:type=>"special"}
|
49
|
-
"""
|
50
|
-
And the output should contain "2 examples"
|
51
|
-
And the examples should all pass
|
52
|
-
|
53
|
-
Scenario: filter examples with a name:value tag and @
|
54
|
-
When I run `rspec . --tag @type:special`
|
55
|
-
Then the output should contain:
|
56
|
-
"""
|
57
|
-
include {:type=>"special"}
|
58
|
-
"""
|
59
|
-
And the examples should all pass
|
60
|
-
|
61
|
-
Scenario: exclude examples with a simple tag
|
62
|
-
When I run `rspec . --tag ~skip`
|
63
|
-
Then the output should contain "exclude {:skip=>true}"
|
64
|
-
Then the examples should all pass
|
65
|
-
|
66
|
-
Scenario: exclude examples with a simple tag and @
|
67
|
-
When I run `rspec . --tag ~@skip`
|
68
|
-
Then the output should contain "exclude {:skip=>true}"
|
69
|
-
Then the examples should all pass
|
70
|
-
|
71
|
-
Scenario: exclude examples with a name:value tag
|
72
|
-
When I run `rspec . --tag ~speed:slow`
|
73
|
-
Then the output should contain:
|
74
|
-
"""
|
75
|
-
exclude {:speed=>"slow"}
|
76
|
-
"""
|
77
|
-
Then the examples should all pass
|
78
|
-
|
79
|
-
Scenario: exclude examples with a name:value tag and @
|
80
|
-
When I run `rspec . --tag ~@speed:slow`
|
81
|
-
Then the output should contain:
|
82
|
-
"""
|
83
|
-
exclude {:speed=>"slow"}
|
84
|
-
"""
|
85
|
-
Then the examples should all pass
|
86
|
-
|
87
|
-
Scenario: filter examples with a simple tag, exclude examples with another tag
|
88
|
-
When I run `rspec . --tag focus --tag ~skip`
|
89
|
-
Then the output should contain "include {:focus=>true}"
|
90
|
-
And the output should contain "exclude {:skip=>true}"
|
91
|
-
And the examples should all pass
|
92
|
-
|
93
|
-
Scenario: exclude examples with multiple tags
|
94
|
-
When I run `rspec . --tag ~skip --tag ~speed:slow`
|
95
|
-
Then the output should contain one of the following:
|
96
|
-
| exclude {:skip=>true, :speed=>"slow"} |
|
97
|
-
| exclude {:speed=>"slow", :skip=>true} |
|
98
|
-
Then the examples should all pass
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Feature: run with warnings enabled
|
2
|
-
|
3
|
-
You can use the `--warnings` option to run specs with warnings enabled
|
4
|
-
|
5
|
-
@unsupported-on-rbx
|
6
|
-
Scenario:
|
7
|
-
Given a file named "example_spec.rb" with:
|
8
|
-
"""ruby
|
9
|
-
describe do
|
10
|
-
it 'generates warning' do
|
11
|
-
@undefined
|
12
|
-
end
|
13
|
-
end
|
14
|
-
"""
|
15
|
-
When I run `rspec --warnings example_spec.rb`
|
16
|
-
Then the output should contain "warning"
|
17
|
-
|
18
|
-
@unsupported-on-rbx
|
19
|
-
Scenario:
|
20
|
-
Given a file named "example_spec.rb" with:
|
21
|
-
"""ruby
|
22
|
-
describe do
|
23
|
-
it 'generates warning' do
|
24
|
-
@undefined
|
25
|
-
end
|
26
|
-
end
|
27
|
-
"""
|
28
|
-
When I run `rspec example_spec.rb`
|
29
|
-
Then the output should not contain "warning"
|
@@ -1,39 +0,0 @@
|
|
1
|
-
Feature: alias_example_to
|
2
|
-
|
3
|
-
Use `config.alias_example_to` to create new example group methods
|
4
|
-
that define examples with the configured metadata. You can also
|
5
|
-
specify metadata using only symbols.
|
6
|
-
|
7
|
-
Scenario: Use alias_example_to to define pending example
|
8
|
-
Given a file named "alias_example_to_spec.rb" with:
|
9
|
-
"""ruby
|
10
|
-
RSpec.configure do |c|
|
11
|
-
c.alias_example_to :pit, :pending => "Pit alias used"
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "an example group" do
|
15
|
-
pit "does something later on" do
|
16
|
-
fail "not implemented yet"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
"""
|
20
|
-
When I run `rspec alias_example_to_spec.rb --format doc`
|
21
|
-
Then the output should contain "does something later on (PENDING: Pit alias used)"
|
22
|
-
And the output should contain "0 failures"
|
23
|
-
|
24
|
-
Scenario: use symbols as metadata
|
25
|
-
Given a file named "use_symbols_as_metadata_spec.rb" with:
|
26
|
-
"""ruby
|
27
|
-
RSpec.configure do |c|
|
28
|
-
c.alias_example_to :pit, :pending
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "an example group" do
|
32
|
-
pit "does something later on" do
|
33
|
-
fail "not implemented yet"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
"""
|
37
|
-
When I run `rspec use_symbols_as_metadata_spec.rb --format doc`
|
38
|
-
Then the output should contain "does something later on (PENDING: No reason given)"
|
39
|
-
And the output should contain "0 failures"
|