rspec-core 2.99.0 → 3.0.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.
- checksums.yaml +8 -8
- checksums.yaml.gz.sig +0 -0
- data/.yardopts +1 -0
- data/Changelog.md +339 -1
- data/License.txt +1 -0
- data/README.md +19 -37
- data/exe/rspec +2 -23
- data/lib/rspec/core/backport_random.rb +336 -0
- data/lib/rspec/core/backtrace_formatter.rb +70 -0
- data/lib/rspec/core/configuration.rb +479 -577
- data/lib/rspec/core/configuration_options.rb +71 -54
- data/lib/rspec/core/drb.rb +111 -0
- data/lib/rspec/core/dsl.rb +86 -18
- data/lib/rspec/core/example.rb +267 -119
- data/lib/rspec/core/example_group.rb +381 -393
- data/lib/rspec/core/filter_manager.rb +133 -114
- data/lib/rspec/core/flat_map.rb +18 -0
- data/lib/rspec/core/formatters/base_formatter.rb +51 -125
- data/lib/rspec/core/formatters/base_text_formatter.rb +34 -286
- data/lib/rspec/core/formatters/console_codes.rb +24 -1
- data/lib/rspec/core/formatters/deprecation_formatter.rb +25 -26
- data/lib/rspec/core/formatters/documentation_formatter.rb +27 -25
- data/lib/rspec/core/formatters/helpers.rb +14 -36
- data/lib/rspec/core/formatters/html_formatter.rb +58 -65
- data/lib/rspec/core/formatters/html_printer.rb +12 -18
- data/lib/rspec/core/formatters/json_formatter.rb +54 -31
- data/lib/rspec/core/formatters/profile_formatter.rb +67 -0
- data/lib/rspec/core/formatters/progress_formatter.rb +11 -15
- data/lib/rspec/core/formatters/snippet_extractor.rb +22 -11
- data/lib/rspec/core/formatters.rb +90 -43
- data/lib/rspec/core/hooks.rb +325 -270
- data/lib/rspec/core/memoized_helpers.rb +45 -156
- data/lib/rspec/core/metadata.rb +284 -236
- data/lib/rspec/core/metadata_filter.rb +86 -0
- data/lib/rspec/core/mocking_adapters/flexmock.rb +29 -0
- data/lib/rspec/core/{mocking/with_mocha.rb → mocking_adapters/mocha.rb} +19 -16
- data/lib/rspec/core/mocking_adapters/null.rb +12 -0
- data/lib/rspec/core/mocking_adapters/rr.rb +29 -0
- data/lib/rspec/core/mocking_adapters/rspec.rb +30 -0
- data/lib/rspec/core/notifications.rb +511 -0
- data/lib/rspec/core/option_parser.rb +49 -74
- data/lib/rspec/core/ordering.rb +156 -0
- data/lib/rspec/core/pending.rb +94 -96
- data/lib/rspec/core/project_initializer/.rspec +3 -0
- data/lib/rspec/core/project_initializer/spec/spec_helper.rb +78 -0
- data/lib/rspec/core/project_initializer.rb +24 -64
- data/lib/rspec/core/rake_task.rb +44 -130
- data/lib/rspec/core/reporter.rb +76 -59
- data/lib/rspec/core/ruby_project.rb +2 -1
- data/lib/rspec/core/runner.rb +117 -52
- data/lib/rspec/core/shared_context.rb +10 -10
- data/lib/rspec/core/shared_example_group.rb +108 -121
- data/lib/rspec/core/version.rb +3 -1
- data/lib/rspec/core/warnings.rb +40 -0
- data/lib/rspec/core/world.rb +66 -10
- data/lib/rspec/core.rb +64 -104
- data.tar.gz.sig +3 -0
- metadata +75 -322
- metadata.gz.sig +1 -0
- data/exe/autospec +0 -13
- data/features/Autotest.md +0 -38
- data/features/README.md +0 -17
- data/features/Upgrade.md +0 -364
- data/features/command_line/README.md +0 -28
- data/features/command_line/example_name_option.feature +0 -97
- data/features/command_line/exit_status.feature +0 -82
- data/features/command_line/format_option.feature +0 -75
- data/features/command_line/init.feature +0 -18
- data/features/command_line/line_number_appended_to_path.feature +0 -140
- data/features/command_line/line_number_option.feature +0 -53
- data/features/command_line/order.feature +0 -26
- data/features/command_line/pattern_option.feature +0 -49
- data/features/command_line/rake_task.feature +0 -122
- data/features/command_line/require_option.feature +0 -43
- data/features/command_line/ruby.feature +0 -22
- 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 -48
- data/features/configuration/backtrace_clean_patterns.feature +0 -102
- 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/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/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/configuration/show_failures_in_pending_blocks.feature +0 -61
- data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +0 -52
- 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 -294
- data/features/expectation_framework_integration/configure_expectation_framework.feature +0 -197
- data/features/filtering/exclusion_filters.feature +0 -138
- data/features/filtering/if_and_unless.feature +0 -168
- data/features/filtering/inclusion_filters.feature +0 -105
- data/features/formatters/configurable_colors.feature +0 -31
- data/features/formatters/custom_formatter.feature +0 -36
- data/features/formatters/json_formatter.feature +0 -30
- 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 -149
- data/features/hooks/around_hooks.feature +0 -343
- data/features/hooks/before_and_after_hooks.feature +0 -427
- data/features/hooks/filtering.feature +0 -234
- data/features/metadata/current_example.feature +0 -56
- data/features/metadata/described_class.feature +0 -17
- data/features/metadata/user_defined.feature +0 -113
- data/features/mock_framework_integration/use_any_framework.feature +0 -106
- data/features/mock_framework_integration/use_flexmock.feature +0 -96
- data/features/mock_framework_integration/use_mocha.feature +0 -97
- data/features/mock_framework_integration/use_rr.feature +0 -98
- data/features/mock_framework_integration/use_rspec.feature +0 -97
- data/features/pending/pending_examples.feature +0 -229
- data/features/spec_files/arbitrary_file_suffix.feature +0 -13
- data/features/step_definitions/additional_cli_steps.rb +0 -49
- data/features/subject/attribute_of_subject.feature +0 -124
- 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 -14
- data/features/support/rubinius.rb +0 -6
- data/lib/autotest/discover.rb +0 -10
- data/lib/autotest/rspec2.rb +0 -77
- data/lib/rspec/core/backtrace_cleaner.rb +0 -46
- data/lib/rspec/core/backward_compatibility.rb +0 -55
- data/lib/rspec/core/caller_filter.rb +0 -60
- data/lib/rspec/core/command_line.rb +0 -47
- data/lib/rspec/core/deprecated_mutable_array_proxy.rb +0 -32
- data/lib/rspec/core/deprecation.rb +0 -26
- data/lib/rspec/core/drb_command_line.rb +0 -26
- data/lib/rspec/core/drb_options.rb +0 -87
- data/lib/rspec/core/extensions/instance_eval_with_args.rb +0 -44
- data/lib/rspec/core/extensions/kernel.rb +0 -9
- data/lib/rspec/core/extensions/module_eval_with_args.rb +0 -38
- data/lib/rspec/core/extensions/ordered.rb +0 -27
- data/lib/rspec/core/formatters/text_mate_formatter.rb +0 -34
- data/lib/rspec/core/metadata_hash_builder.rb +0 -97
- data/lib/rspec/core/mocking/with_absolutely_nothing.rb +0 -11
- data/lib/rspec/core/mocking/with_flexmock.rb +0 -27
- data/lib/rspec/core/mocking/with_rr.rb +0 -27
- data/lib/rspec/core/mocking/with_rspec.rb +0 -27
- data/lib/rspec/core/shared_example_group/collection.rb +0 -45
- data/spec/autotest/discover_spec.rb +0 -49
- data/spec/autotest/failed_results_re_spec.rb +0 -45
- data/spec/autotest/rspec_spec.rb +0 -133
- data/spec/command_line/order_spec.rb +0 -204
- data/spec/rspec/core/backtrace_cleaner_spec.rb +0 -68
- data/spec/rspec/core/caller_filter_spec.rb +0 -58
- data/spec/rspec/core/command_line_spec.rb +0 -127
- data/spec/rspec/core/command_line_spec_output.txt +0 -0
- data/spec/rspec/core/configuration_options_spec.rb +0 -417
- data/spec/rspec/core/configuration_spec.rb +0 -2072
- data/spec/rspec/core/deprecation_spec.rb +0 -27
- data/spec/rspec/core/deprecations_spec.rb +0 -59
- 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 -25
- data/spec/rspec/core/example_group_spec.rb +0 -1337
- data/spec/rspec/core/example_spec.rb +0 -502
- data/spec/rspec/core/filter_manager_spec.rb +0 -246
- data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -108
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +0 -524
- data/spec/rspec/core/formatters/console_codes_spec.rb +0 -50
- data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +0 -263
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +0 -89
- data/spec/rspec/core/formatters/helpers_spec.rb +0 -104
- data/spec/rspec/core/formatters/html_formatted.html +0 -397
- data/spec/rspec/core/formatters/html_formatter_spec.rb +0 -131
- data/spec/rspec/core/formatters/json_formatter_spec.rb +0 -115
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -30
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +0 -26
- data/spec/rspec/core/formatters/text_mate_formatted.html +0 -397
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +0 -107
- data/spec/rspec/core/hooks_filtering_spec.rb +0 -227
- data/spec/rspec/core/hooks_spec.rb +0 -269
- data/spec/rspec/core/kernel_extensions_spec.rb +0 -9
- data/spec/rspec/core/memoized_helpers_spec.rb +0 -776
- data/spec/rspec/core/metadata_spec.rb +0 -514
- data/spec/rspec/core/option_parser_spec.rb +0 -297
- data/spec/rspec/core/pending_example_spec.rb +0 -260
- data/spec/rspec/core/pending_spec.rb +0 -27
- data/spec/rspec/core/project_initializer_spec.rb +0 -130
- data/spec/rspec/core/rake_task_spec.rb +0 -202
- data/spec/rspec/core/reporter_spec.rb +0 -167
- 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 -60
- 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 -82
- data/spec/rspec/core/shared_context_spec.rb +0 -114
- data/spec/rspec/core/shared_example_group/collection_spec.rb +0 -70
- data/spec/rspec/core/shared_example_group_spec.rb +0 -138
- data/spec/rspec/core/world_spec.rb +0 -142
- data/spec/rspec/core_spec.rb +0 -108
- data/spec/spec_helper.rb +0 -135
- data/spec/support/config_options_helper.rb +0 -15
- data/spec/support/helper_methods.rb +0 -55
- data/spec/support/in_sub_process.rb +0 -37
- data/spec/support/isolate_load_path_mutation.rb +0 -6
- data/spec/support/isolated_directory.rb +0 -10
- data/spec/support/isolated_home_directory.rb +0 -16
- data/spec/support/matchers.rb +0 -65
- data/spec/support/mathn_integration_support.rb +0 -12
- data/spec/support/sandboxed_mock_space.rb +0 -116
- data/spec/support/shared_example_groups.rb +0 -42
- data/spec/support/silence_dsl_deprecations.rb +0 -32
- data/spec/support/spec_files.rb +0 -44
data/lib/rspec/core/world.rb
CHANGED
|
@@ -1,67 +1,116 @@
|
|
|
1
1
|
module RSpec
|
|
2
2
|
module Core
|
|
3
|
+
# @api private
|
|
4
|
+
#
|
|
5
|
+
# Internal container for global non-configuration data
|
|
3
6
|
class World
|
|
4
7
|
|
|
5
8
|
include RSpec::Core::Hooks
|
|
6
9
|
|
|
10
|
+
# @private
|
|
7
11
|
attr_reader :example_groups, :filtered_examples
|
|
12
|
+
|
|
13
|
+
# Used internally to determine what to do when a SIGINT is received
|
|
8
14
|
attr_accessor :wants_to_quit
|
|
9
15
|
|
|
10
16
|
def initialize(configuration=RSpec.configuration)
|
|
11
17
|
@configuration = configuration
|
|
12
|
-
@example_groups = []
|
|
18
|
+
@example_groups = []
|
|
13
19
|
@filtered_examples = Hash.new { |hash,group|
|
|
14
20
|
hash[group] = begin
|
|
15
21
|
examples = group.examples.dup
|
|
16
22
|
examples = filter_manager.prune(examples)
|
|
17
|
-
examples.uniq
|
|
18
|
-
examples
|
|
23
|
+
examples.uniq!
|
|
24
|
+
examples
|
|
19
25
|
end
|
|
20
26
|
}
|
|
21
27
|
end
|
|
22
28
|
|
|
29
|
+
# @private
|
|
30
|
+
# Used internally to clear remaining groups when fail_fast is set
|
|
31
|
+
def clear_remaining_example_groups
|
|
32
|
+
example_groups.clear
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @private
|
|
36
|
+
def windows_os?
|
|
37
|
+
RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @api private
|
|
41
|
+
#
|
|
42
|
+
# Apply ordering strategy from configuration to example groups
|
|
43
|
+
def ordered_example_groups
|
|
44
|
+
ordering_strategy = @configuration.ordering_registry.fetch(:global)
|
|
45
|
+
ordering_strategy.order(@example_groups)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @api private
|
|
49
|
+
#
|
|
50
|
+
# Reset world to 'scratch' before running suite
|
|
23
51
|
def reset
|
|
24
52
|
example_groups.clear
|
|
25
|
-
|
|
53
|
+
@shared_example_group_registry = nil
|
|
26
54
|
end
|
|
27
55
|
|
|
56
|
+
# @private
|
|
28
57
|
def filter_manager
|
|
29
58
|
@configuration.filter_manager
|
|
30
59
|
end
|
|
31
60
|
|
|
61
|
+
# @api private
|
|
62
|
+
#
|
|
63
|
+
# Register an example group
|
|
32
64
|
def register(example_group)
|
|
33
65
|
example_groups << example_group
|
|
34
66
|
example_group
|
|
35
67
|
end
|
|
36
68
|
|
|
69
|
+
# @private
|
|
70
|
+
def shared_example_group_registry
|
|
71
|
+
@shared_example_group_registry ||= SharedExampleGroup::Registry.new
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# @private
|
|
37
75
|
def inclusion_filter
|
|
38
76
|
@configuration.inclusion_filter
|
|
39
77
|
end
|
|
40
78
|
|
|
79
|
+
# @private
|
|
41
80
|
def exclusion_filter
|
|
42
81
|
@configuration.exclusion_filter
|
|
43
82
|
end
|
|
44
83
|
|
|
84
|
+
# @private
|
|
45
85
|
def configure_group(group)
|
|
46
86
|
@configuration.configure_group(group)
|
|
47
87
|
end
|
|
48
88
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
89
|
+
# @api private
|
|
90
|
+
#
|
|
91
|
+
# Get count of examples to be run
|
|
92
|
+
def example_count(groups=example_groups)
|
|
93
|
+
FlatMap.flat_map(groups) {|g| g.descendants}.
|
|
94
|
+
inject(0) {|sum, g| sum + g.filtered_examples.size}
|
|
53
95
|
end
|
|
54
96
|
|
|
97
|
+
# @api private
|
|
98
|
+
#
|
|
99
|
+
# Find line number of previous declaration
|
|
55
100
|
def preceding_declaration_line(filter_line)
|
|
56
101
|
declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
|
|
57
102
|
line <= filter_line ? line : highest_prior_declaration_line
|
|
58
103
|
end
|
|
59
104
|
end
|
|
60
105
|
|
|
106
|
+
# @private
|
|
61
107
|
def reporter
|
|
62
108
|
@configuration.reporter
|
|
63
109
|
end
|
|
64
110
|
|
|
111
|
+
# @api private
|
|
112
|
+
#
|
|
113
|
+
# Notify reporter of filters
|
|
65
114
|
def announce_filters
|
|
66
115
|
filter_announcements = []
|
|
67
116
|
|
|
@@ -86,7 +135,7 @@ module RSpec
|
|
|
86
135
|
example_groups.clear
|
|
87
136
|
if filter_manager.empty?
|
|
88
137
|
reporter.message("No examples found.")
|
|
89
|
-
elsif exclusion_filter.
|
|
138
|
+
elsif exclusion_filter.empty?
|
|
90
139
|
message = everything_filtered_message
|
|
91
140
|
if @configuration.run_all_when_everything_filtered?
|
|
92
141
|
message << "; ignoring #{inclusion_filter.description}"
|
|
@@ -98,18 +147,25 @@ module RSpec
|
|
|
98
147
|
end
|
|
99
148
|
end
|
|
100
149
|
|
|
150
|
+
# @private
|
|
101
151
|
def everything_filtered_message
|
|
102
152
|
"\nAll examples were filtered out"
|
|
103
153
|
end
|
|
104
154
|
|
|
155
|
+
# @api private
|
|
156
|
+
#
|
|
157
|
+
# Add inclusion filters to announcement message
|
|
105
158
|
def announce_inclusion_filter(announcements)
|
|
106
159
|
unless inclusion_filter.empty?
|
|
107
160
|
announcements << "include #{inclusion_filter.description}"
|
|
108
161
|
end
|
|
109
162
|
end
|
|
110
163
|
|
|
164
|
+
# @api private
|
|
165
|
+
#
|
|
166
|
+
# Add exclusion filters to announcement message
|
|
111
167
|
def announce_exclusion_filter(announcements)
|
|
112
|
-
unless exclusion_filter.
|
|
168
|
+
unless exclusion_filter.empty?
|
|
113
169
|
announcements << "exclude #{exclusion_filter.description}"
|
|
114
170
|
end
|
|
115
171
|
end
|
data/lib/rspec/core.rb
CHANGED
|
@@ -1,77 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
lambda do |path|
|
|
3
|
-
require_relative path
|
|
4
|
-
end
|
|
5
|
-
else # for 1.8.7
|
|
6
|
-
lambda do |path|
|
|
7
|
-
require "rspec/#{path}"
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
require 'set'
|
|
12
|
-
require 'time'
|
|
1
|
+
$_rspec_core_load_started_at = Time.now
|
|
13
2
|
require 'rbconfig'
|
|
14
|
-
require_rspec['core/caller_filter']
|
|
15
|
-
require_rspec['core/filter_manager']
|
|
16
|
-
require_rspec['core/dsl']
|
|
17
|
-
require_rspec['core/extensions/kernel']
|
|
18
|
-
require_rspec['core/extensions/instance_eval_with_args']
|
|
19
|
-
require_rspec['core/extensions/module_eval_with_args']
|
|
20
|
-
require_rspec['core/extensions/ordered']
|
|
21
|
-
require_rspec['core/deprecation']
|
|
22
|
-
require_rspec['core/backward_compatibility']
|
|
23
|
-
require_rspec['core/reporter']
|
|
24
|
-
|
|
25
|
-
require_rspec['core/metadata_hash_builder']
|
|
26
|
-
require_rspec['core/hooks']
|
|
27
|
-
require_rspec['core/memoized_helpers']
|
|
28
|
-
require_rspec['core/metadata']
|
|
29
|
-
require_rspec['core/pending']
|
|
30
|
-
require_rspec['core/formatters']
|
|
31
|
-
|
|
32
|
-
require_rspec['core/world']
|
|
33
|
-
require_rspec['core/configuration']
|
|
34
|
-
require_rspec['core/project_initializer']
|
|
35
|
-
require_rspec['core/option_parser']
|
|
36
|
-
require_rspec['core/configuration_options']
|
|
37
|
-
require_rspec['core/command_line']
|
|
38
|
-
require_rspec['core/runner']
|
|
39
|
-
require_rspec['core/example']
|
|
40
|
-
require_rspec['core/shared_example_group/collection']
|
|
41
|
-
require_rspec['core/shared_example_group']
|
|
42
|
-
require_rspec['core/example_group']
|
|
43
|
-
require_rspec['core/version']
|
|
44
3
|
|
|
4
|
+
require "rspec/support"
|
|
5
|
+
RSpec::Support.require_rspec_support "caller_filter"
|
|
6
|
+
|
|
7
|
+
RSpec::Support.define_optimized_require_for_rspec(:core) { |f| require_relative f }
|
|
8
|
+
|
|
9
|
+
%w[
|
|
10
|
+
version
|
|
11
|
+
warnings
|
|
12
|
+
|
|
13
|
+
flat_map
|
|
14
|
+
filter_manager
|
|
15
|
+
dsl
|
|
16
|
+
notifications
|
|
17
|
+
reporter
|
|
18
|
+
|
|
19
|
+
hooks
|
|
20
|
+
memoized_helpers
|
|
21
|
+
metadata
|
|
22
|
+
metadata_filter
|
|
23
|
+
pending
|
|
24
|
+
formatters
|
|
25
|
+
ordering
|
|
26
|
+
|
|
27
|
+
world
|
|
28
|
+
configuration
|
|
29
|
+
option_parser
|
|
30
|
+
configuration_options
|
|
31
|
+
runner
|
|
32
|
+
example
|
|
33
|
+
shared_example_group
|
|
34
|
+
example_group
|
|
35
|
+
].each { |name| RSpec::Support.require_rspec_core name }
|
|
36
|
+
|
|
37
|
+
# Namespace for all core RSpec code.
|
|
45
38
|
module RSpec
|
|
46
39
|
autoload :SharedContext, 'rspec/core/shared_context'
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
def self.wants_to_quit
|
|
50
|
-
# Used internally to determine what to do when a SIGINT is received
|
|
51
|
-
world.wants_to_quit
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# @private
|
|
55
|
-
# Used internally to determine what to do when a SIGINT is received
|
|
56
|
-
def self.wants_to_quit=(maybe)
|
|
57
|
-
world.wants_to_quit=(maybe)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# @private
|
|
61
|
-
# Internal container for global non-configuration data
|
|
62
|
-
def self.world
|
|
63
|
-
@world ||= RSpec::Core::World.new
|
|
64
|
-
end
|
|
41
|
+
extend RSpec::Core::Warnings
|
|
65
42
|
|
|
66
|
-
#
|
|
67
|
-
# Used internally to set the global object
|
|
68
|
-
def self.world=(new_world)
|
|
69
|
-
@world = new_world
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
# @private
|
|
73
|
-
# Used internally to ensure examples get reloaded between multiple runs in
|
|
43
|
+
# Used to ensure examples get reloaded between multiple runs in
|
|
74
44
|
# the same process.
|
|
45
|
+
#
|
|
46
|
+
# Users must invoke this if they want to have the configuration reset when
|
|
47
|
+
# they use runner multiple times within the same process.
|
|
75
48
|
def self.reset
|
|
76
49
|
@world = nil
|
|
77
50
|
@configuration = nil
|
|
@@ -86,27 +59,12 @@ module RSpec
|
|
|
86
59
|
# @see RSpec.configure
|
|
87
60
|
# @see Core::Configuration
|
|
88
61
|
def self.configuration
|
|
89
|
-
|
|
90
|
-
|
|
62
|
+
@configuration ||= begin
|
|
63
|
+
config = RSpec::Core::Configuration.new
|
|
64
|
+
config.expose_dsl_globally = true
|
|
65
|
+
config
|
|
66
|
+
end
|
|
91
67
|
|
|
92
|
-
*****************************************************************
|
|
93
|
-
DEPRECATION WARNING
|
|
94
|
-
|
|
95
|
-
* RSpec.configuration with a block is deprecated and has no effect.
|
|
96
|
-
* please use RSpec.configure with a block instead.
|
|
97
|
-
|
|
98
|
-
Called from #{CallerFilter.first_non_rspec_line}
|
|
99
|
-
*****************************************************************
|
|
100
|
-
|
|
101
|
-
WARNING
|
|
102
|
-
end
|
|
103
|
-
@configuration ||= RSpec::Core::Configuration.new
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
# @private
|
|
107
|
-
# Used internally to set the global object
|
|
108
|
-
def self.configuration=(new_configuration)
|
|
109
|
-
@configuration = new_configuration
|
|
110
68
|
end
|
|
111
69
|
|
|
112
70
|
# Yields the global configuration to a block.
|
|
@@ -121,12 +79,6 @@ WARNING
|
|
|
121
79
|
yield configuration if block_given?
|
|
122
80
|
end
|
|
123
81
|
|
|
124
|
-
# @private
|
|
125
|
-
# Used internally to clear remaining groups when fail_fast is set
|
|
126
|
-
def self.clear_remaining_example_groups
|
|
127
|
-
world.example_groups.clear
|
|
128
|
-
end
|
|
129
|
-
|
|
130
82
|
# The example being executed.
|
|
131
83
|
#
|
|
132
84
|
# The primary audience for this method is library authors who need access
|
|
@@ -141,7 +93,7 @@ WARNING
|
|
|
141
93
|
# fetch_current_example = RSpec.respond_to?(:current_example) ?
|
|
142
94
|
# proc { RSpec.current_example } : proc { |context| context.example }
|
|
143
95
|
#
|
|
144
|
-
# c.before(:
|
|
96
|
+
# c.before(:example) do
|
|
145
97
|
# example = fetch_current_example.call(self)
|
|
146
98
|
#
|
|
147
99
|
# # ...
|
|
@@ -149,20 +101,29 @@ WARNING
|
|
|
149
101
|
# end
|
|
150
102
|
#
|
|
151
103
|
def self.current_example
|
|
152
|
-
|
|
104
|
+
thread_local_metadata[:current_example]
|
|
153
105
|
end
|
|
154
106
|
|
|
155
107
|
# Set the current example being executed.
|
|
156
108
|
# @api private
|
|
157
109
|
def self.current_example=(example)
|
|
158
|
-
|
|
110
|
+
thread_local_metadata[:current_example] = example
|
|
159
111
|
end
|
|
160
112
|
|
|
161
113
|
# @private
|
|
162
|
-
|
|
163
|
-
|
|
114
|
+
# A single thread local variable so we don't excessively pollute that
|
|
115
|
+
# namespace.
|
|
116
|
+
def self.thread_local_metadata
|
|
117
|
+
Thread.current[:_rspec] ||= {}
|
|
164
118
|
end
|
|
165
119
|
|
|
120
|
+
# @private
|
|
121
|
+
# Internal container for global non-configuration data
|
|
122
|
+
def self.world
|
|
123
|
+
@world ||= RSpec::Core::World.new
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Namespace for the rspec-core code.
|
|
166
127
|
module Core
|
|
167
128
|
# @private
|
|
168
129
|
# This avoids issues with reporting time caused by examples that
|
|
@@ -170,23 +131,24 @@ WARNING
|
|
|
170
131
|
# it.
|
|
171
132
|
class Time
|
|
172
133
|
class << self
|
|
173
|
-
define_method(:now
|
|
134
|
+
define_method(:now, &::Time.method(:now))
|
|
174
135
|
end
|
|
175
136
|
end
|
|
176
137
|
|
|
177
138
|
# @private path to executable file
|
|
178
139
|
def self.path_to_executable
|
|
179
|
-
File.expand_path('../../../exe/rspec', __FILE__)
|
|
140
|
+
@path_to_executable ||= File.expand_path('../../../exe/rspec', __FILE__)
|
|
180
141
|
end
|
|
181
|
-
|
|
182
142
|
end
|
|
183
143
|
|
|
144
|
+
# @private
|
|
184
145
|
MODULES_TO_AUTOLOAD = {
|
|
185
146
|
:Matchers => "rspec/expectations",
|
|
186
147
|
:Expectations => "rspec/expectations",
|
|
187
148
|
:Mocks => "rspec/mocks"
|
|
188
149
|
}
|
|
189
150
|
|
|
151
|
+
# @private
|
|
190
152
|
def self.const_missing(name)
|
|
191
153
|
# Load rspec-expectations when RSpec::Matchers is referenced. This allows
|
|
192
154
|
# people to define custom matchers (using `RSpec::Matchers.define`) before
|
|
@@ -198,10 +160,8 @@ WARNING
|
|
|
198
160
|
#
|
|
199
161
|
# As of rspec 2.14.1, we no longer require `rspec/mocks` and
|
|
200
162
|
# `rspec/expectations` when `rspec` is required, so we want
|
|
201
|
-
# to make them available as an autoload.
|
|
163
|
+
# to make them available as an autoload.
|
|
202
164
|
require MODULES_TO_AUTOLOAD.fetch(name) { return super }
|
|
203
165
|
::RSpec.const_get(name)
|
|
204
166
|
end
|
|
205
167
|
end
|
|
206
|
-
|
|
207
|
-
require_rspec['core/backward_compatibility']
|
data.tar.gz.sig
ADDED