rspec-core 2.99.2 → 3.0.0.beta1

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.
Files changed (165) hide show
  1. checksums.yaml +14 -6
  2. checksums.yaml.gz.sig +2 -0
  3. data.tar.gz.sig +0 -0
  4. data/Changelog.md +103 -191
  5. data/License.txt +1 -0
  6. data/README.md +4 -25
  7. data/features/Upgrade.md +2 -14
  8. data/features/command_line/dry_run.feature +29 -0
  9. data/features/command_line/example_name_option.feature +1 -1
  10. data/features/command_line/fail_fast.feature +26 -0
  11. data/features/command_line/format_option.feature +3 -3
  12. data/features/command_line/line_number_option.feature +16 -11
  13. data/features/command_line/order.feature +2 -3
  14. data/features/command_line/pattern_option.feature +3 -3
  15. data/features/command_line/randomization.feature +63 -0
  16. data/features/command_line/require_option.feature +2 -2
  17. data/features/command_line/ruby.feature +1 -1
  18. data/features/configuration/alias_example_to.feature +13 -22
  19. data/features/configuration/{backtrace_clean_patterns.feature → backtrace_exclusion_patterns.feature} +17 -14
  20. data/features/configuration/custom_settings.feature +11 -11
  21. data/features/configuration/overriding_global_ordering.feature +93 -0
  22. data/features/configuration/profile.feature +13 -13
  23. data/features/configuration/read_options_from_file.feature +7 -7
  24. data/features/example_groups/basic_structure.feature +1 -1
  25. data/features/example_groups/shared_context.feature +8 -8
  26. data/features/example_groups/shared_examples.feature +6 -14
  27. data/features/expectation_framework_integration/configure_expectation_framework.feature +27 -122
  28. data/features/filtering/exclusion_filters.feature +2 -5
  29. data/features/filtering/inclusion_filters.feature +1 -5
  30. data/features/formatters/json_formatter.feature +2 -2
  31. data/features/formatters/text_formatter.feature +4 -4
  32. data/features/helper_methods/arbitrary_methods.feature +2 -2
  33. data/features/helper_methods/let.feature +5 -5
  34. data/features/helper_methods/modules.feature +5 -8
  35. data/features/hooks/around_hooks.feature +2 -2
  36. data/features/hooks/before_and_after_hooks.feature +14 -14
  37. data/features/hooks/filtering.feature +12 -14
  38. data/features/metadata/described_class.feature +1 -1
  39. data/features/metadata/user_defined.feature +16 -29
  40. data/features/mock_framework_integration/use_flexmock.feature +1 -1
  41. data/features/mock_framework_integration/use_mocha.feature +1 -1
  42. data/features/mock_framework_integration/use_rr.feature +1 -1
  43. data/features/mock_framework_integration/use_rspec.feature +5 -5
  44. data/features/pending/pending_examples.feature +5 -5
  45. data/features/spec_files/arbitrary_file_suffix.feature +1 -1
  46. data/features/step_definitions/additional_cli_steps.rb +3 -3
  47. data/features/subject/explicit_subject.feature +8 -8
  48. data/features/subject/implicit_receiver.feature +29 -0
  49. data/features/subject/implicit_subject.feature +4 -4
  50. data/features/support/env.rb +10 -3
  51. data/features/support/require_expect_syntax_in_aruba_specs.rb +16 -0
  52. data/lib/rspec/core.rb +11 -48
  53. data/lib/rspec/core/backport_random.rb +302 -0
  54. data/lib/rspec/core/backtrace_formatter.rb +65 -0
  55. data/lib/rspec/core/command_line.rb +7 -18
  56. data/lib/rspec/core/configuration.rb +202 -507
  57. data/lib/rspec/core/configuration_options.rb +17 -30
  58. data/lib/rspec/core/example.rb +29 -39
  59. data/lib/rspec/core/example_group.rb +166 -259
  60. data/lib/rspec/core/filter_manager.rb +30 -47
  61. data/lib/rspec/core/flat_map.rb +17 -0
  62. data/lib/rspec/core/formatters.rb +0 -138
  63. data/lib/rspec/core/formatters/base_formatter.rb +46 -1
  64. data/lib/rspec/core/formatters/base_text_formatter.rb +38 -61
  65. data/lib/rspec/core/formatters/deprecation_formatter.rb +21 -52
  66. data/lib/rspec/core/formatters/helpers.rb +0 -28
  67. data/lib/rspec/core/formatters/html_formatter.rb +1 -1
  68. data/lib/rspec/core/formatters/json_formatter.rb +38 -9
  69. data/lib/rspec/core/formatters/snippet_extractor.rb +14 -5
  70. data/lib/rspec/core/hooks.rb +55 -39
  71. data/lib/rspec/core/memoized_helpers.rb +17 -167
  72. data/lib/rspec/core/metadata.rb +16 -64
  73. data/lib/rspec/core/option_parser.rb +30 -39
  74. data/lib/rspec/core/ordering.rb +154 -0
  75. data/lib/rspec/core/pending.rb +12 -69
  76. data/lib/rspec/core/project_initializer.rb +12 -10
  77. data/lib/rspec/core/rake_task.rb +5 -108
  78. data/lib/rspec/core/reporter.rb +15 -18
  79. data/lib/rspec/core/runner.rb +16 -30
  80. data/lib/rspec/core/shared_context.rb +3 -5
  81. data/lib/rspec/core/shared_example_group.rb +3 -51
  82. data/lib/rspec/core/shared_example_group/collection.rb +1 -19
  83. data/lib/rspec/core/version.rb +1 -1
  84. data/lib/rspec/core/warnings.rb +22 -0
  85. data/lib/rspec/core/world.rb +12 -8
  86. data/spec/command_line/order_spec.rb +20 -23
  87. data/spec/rspec/core/backtrace_formatter_spec.rb +216 -0
  88. data/spec/rspec/core/command_line_spec.rb +32 -48
  89. data/spec/rspec/core/configuration_options_spec.rb +19 -50
  90. data/spec/rspec/core/configuration_spec.rb +142 -713
  91. data/spec/rspec/core/drb_command_line_spec.rb +2 -0
  92. data/spec/rspec/core/dsl_spec.rb +0 -1
  93. data/spec/rspec/core/example_group_spec.rb +192 -223
  94. data/spec/rspec/core/example_spec.rb +40 -16
  95. data/spec/rspec/core/filter_manager_spec.rb +2 -2
  96. data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -41
  97. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +5 -123
  98. data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +2 -87
  99. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +2 -3
  100. data/spec/rspec/core/formatters/{text_mate_formatted.html → html_formatted-1.8.7-jruby.html} +44 -25
  101. data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +477 -0
  102. data/spec/rspec/core/formatters/{html_formatted.html → html_formatted-1.8.7.html} +42 -25
  103. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +425 -0
  104. data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +416 -0
  105. data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +477 -0
  106. data/spec/rspec/core/formatters/html_formatted-1.9.3.html +419 -0
  107. data/spec/rspec/core/formatters/html_formatted-2.0.0.html +425 -0
  108. data/spec/rspec/core/formatters/html_formatter_spec.rb +21 -46
  109. data/spec/rspec/core/formatters/json_formatter_spec.rb +97 -8
  110. data/spec/rspec/core/hooks_filtering_spec.rb +5 -5
  111. data/spec/rspec/core/hooks_spec.rb +61 -47
  112. data/spec/rspec/core/memoized_helpers_spec.rb +20 -322
  113. data/spec/rspec/core/metadata_spec.rb +1 -24
  114. data/spec/rspec/core/option_parser_spec.rb +20 -62
  115. data/spec/rspec/core/ordering_spec.rb +102 -0
  116. data/spec/rspec/core/pending_example_spec.rb +0 -40
  117. data/spec/rspec/core/project_initializer_spec.rb +1 -25
  118. data/spec/rspec/core/rake_task_spec.rb +5 -72
  119. data/spec/rspec/core/random_spec.rb +47 -0
  120. data/spec/rspec/core/reporter_spec.rb +23 -48
  121. data/spec/rspec/core/runner_spec.rb +31 -39
  122. data/spec/rspec/core/shared_context_spec.rb +3 -15
  123. data/spec/rspec/core/shared_example_group/collection_spec.rb +4 -17
  124. data/spec/rspec/core/shared_example_group_spec.rb +12 -45
  125. data/spec/rspec/core/{deprecation_spec.rb → warnings_spec.rb} +3 -1
  126. data/spec/rspec/core_spec.rb +4 -21
  127. data/spec/spec_helper.rb +41 -5
  128. data/spec/support/helper_methods.rb +0 -29
  129. data/spec/support/sandboxed_mock_space.rb +0 -16
  130. data/spec/support/shared_example_groups.rb +7 -36
  131. data/spec/support/stderr_splitter.rb +36 -0
  132. metadata +163 -157
  133. metadata.gz.sig +1 -0
  134. data/exe/autospec +0 -13
  135. data/features/Autotest.md +0 -38
  136. data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +0 -52
  137. data/features/subject/attribute_of_subject.feature +0 -124
  138. data/features/subject/one_liner_syntax.feature +0 -71
  139. data/lib/autotest/discover.rb +0 -10
  140. data/lib/autotest/rspec2.rb +0 -77
  141. data/lib/rspec/core/backtrace_cleaner.rb +0 -46
  142. data/lib/rspec/core/backward_compatibility.rb +0 -55
  143. data/lib/rspec/core/caller_filter.rb +0 -60
  144. data/lib/rspec/core/deprecated_mutable_array_proxy.rb +0 -32
  145. data/lib/rspec/core/deprecation.rb +0 -26
  146. data/lib/rspec/core/extensions/instance_eval_with_args.rb +0 -44
  147. data/lib/rspec/core/extensions/kernel.rb +0 -9
  148. data/lib/rspec/core/extensions/module_eval_with_args.rb +0 -38
  149. data/lib/rspec/core/extensions/ordered.rb +0 -27
  150. data/lib/rspec/core/formatters/console_codes.rb +0 -42
  151. data/lib/rspec/core/formatters/text_mate_formatter.rb +0 -34
  152. data/lib/rspec/core/metadata_hash_builder.rb +0 -97
  153. data/lib/rspec/core/minitest_assertions_adapter.rb +0 -28
  154. data/lib/rspec/core/test_unit_assertions_adapter.rb +0 -30
  155. data/spec/autotest/discover_spec.rb +0 -49
  156. data/spec/autotest/failed_results_re_spec.rb +0 -45
  157. data/spec/autotest/rspec_spec.rb +0 -133
  158. data/spec/rspec/core/backtrace_cleaner_spec.rb +0 -68
  159. data/spec/rspec/core/caller_filter_spec.rb +0 -58
  160. data/spec/rspec/core/deprecations_spec.rb +0 -59
  161. data/spec/rspec/core/formatters/console_codes_spec.rb +0 -50
  162. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +0 -107
  163. data/spec/rspec/core/kernel_extensions_spec.rb +0 -9
  164. data/spec/rspec/core/pending_spec.rb +0 -27
  165. data/spec/support/silence_dsl_deprecations.rb +0 -32
@@ -1,30 +0,0 @@
1
- require 'test/unit/assertions'
2
-
3
- module RSpec
4
- module Core
5
- # @private
6
- module TestUnitAssertionsAdapter
7
- include ::Test::Unit::Assertions
8
-
9
- # If using test/unit from Ruby core with Ruby 1.9+, it includes
10
- # MiniTest::Assertions by default. Note the upcasing of 'Test'.
11
- #
12
- # If the test/unit gem is being loaded, it will not include any minitest
13
- # assertions.
14
- #
15
- # Only if Minitest 5.x is included / loaded do we need to worry about
16
- # adding a shim for the new updates. Thus instead of checking on the
17
- # RUBY_VERSION we need to check ancestors.
18
- begin
19
- # MiniTest is 4.x
20
- # Minitest is 5.x
21
- if ancestors.include?(::Minitest::Assertions)
22
- require 'rspec/core/minitest_assertions_adapter'
23
- include ::RSpec::Core::MinitestAssertionsAdapter
24
- end
25
- rescue NameError => _ignored
26
- # No-op. Minitest 5.x was not loaded
27
- end
28
- end
29
- end
30
- end
@@ -1,49 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "autotest/discover.rb" do
4
- before { File.stub(:exist?).and_call_original }
5
-
6
- context "with ./.rspec present" do
7
- before { File.stub(:exist?).with("./.rspec") { true } }
8
-
9
- context "when RSpec::Autotest is defined" do
10
- before { stub_const "RSpec::Autotest", Module.new }
11
-
12
- it "does not add 'rspec2' to the list of discoveries" do
13
- Autotest.should_not_receive(:add_discovery)
14
- load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
15
- end
16
- end
17
-
18
- context "when RSpec::Autotest is not defined" do
19
- before { hide_const "RSpec::Autotest" }
20
-
21
- it "adds 'rspec2' to the list of discoveries" do
22
- Autotest.should_receive(:add_discovery)
23
- load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
24
- end
25
- end
26
- end
27
-
28
- context "with ./.rspec absent" do
29
- before { File.stub(:exist?).with("./.rspec") { false } }
30
-
31
- context "when RSpec::Autotest is defined" do
32
- before { stub_const "RSpec::Autotest", Module.new }
33
-
34
- it "does not add 'rspec2' to the list of discoveries" do
35
- Autotest.should_not_receive(:add_discovery)
36
- load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
37
- end
38
- end
39
-
40
- context "when RSpec::Autotest is not defined" do
41
- before { hide_const "RSpec::Autotest" }
42
-
43
- it "does not add 'rspec2' to the list of discoveries" do
44
- Autotest.should_not_receive(:add_discovery)
45
- load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
46
- end
47
- end
48
- end
49
- end
@@ -1,45 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "failed_results_re for autotest" do
4
- def run_example
5
- group = RSpec::Core::ExampleGroup.describe("group")
6
- group.example("example") { yield }
7
- io = StringIO.new
8
- formatter = RSpec::Core::Formatters::BaseTextFormatter.new(io)
9
- reporter = RSpec::Core::Reporter.new(formatter)
10
-
11
- group.run(reporter)
12
- reporter.report(1, nil) {}
13
- io.string
14
- end
15
-
16
- shared_examples "autotest failed_results_re" do
17
- it "matches a failure" do
18
- output = run_example { fail }
19
- expect(output).to match(Autotest::Rspec2.new.failed_results_re)
20
- expect(output).to include(__FILE__.sub(File.expand_path('.'),'.'))
21
- end
22
-
23
- it "does not match when there are no failures" do
24
- output = run_example { } # pass
25
- expect(output).not_to match(Autotest::Rspec2.new.failed_results_re)
26
- expect(output).not_to include(__FILE__.sub(File.expand_path('.'),'.'))
27
- end
28
- end
29
-
30
- context "with color enabled" do
31
- before do
32
- RSpec.configuration.stub(:color_enabled? => true)
33
- end
34
-
35
- include_examples "autotest failed_results_re"
36
- end
37
-
38
- context "with color disabled " do
39
- before do
40
- RSpec.configuration.stub(:color_enabled? => false)
41
- end
42
-
43
- include_examples "autotest failed_results_re"
44
- end
45
- end
@@ -1,133 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Autotest::Rspec2 do
4
- let(:rspec_autotest) { Autotest::Rspec2.new }
5
- let(:spec_cmd) { File.expand_path("../../../exe/rspec", __FILE__) }
6
- let(:ruby_cmd) { "/path/to/ruby" }
7
-
8
- before do
9
- File.stub(:exist?) { false }
10
- end
11
-
12
- it "uses autotest's prefix" do
13
- rspec_autotest.prefix = "this is the prefix "
14
- expect(rspec_autotest.make_test_cmd({'a' => 'b'})).to match(/this is the prefix/)
15
- end
16
-
17
- describe "commands" do
18
- before do
19
- rspec_autotest.stub(:ruby => ruby_cmd)
20
- files = %w[file_one file_two]
21
- @files_to_test = {
22
- files[0] => [],
23
- files[1] => []
24
- }
25
- # this is not the inner representation of Autotest!
26
- rspec_autotest.files_to_test = @files_to_test
27
- @to_test = files.map { |f| File.expand_path(f) }.join ' '
28
- end
29
-
30
- it "uses double quotes for windows compatibility" do
31
- command = rspec_autotest.make_test_cmd(@files_to_test)
32
- expect(command).to include('"')
33
- expect(command).not_to include("'")
34
- end
35
-
36
- it "makes the appropriate test command" do
37
- actual_command = rspec_autotest.make_test_cmd(@files_to_test)
38
- expected_command = /#{ruby_cmd}.*"#{spec_cmd}" (.*)/
39
-
40
- expect(actual_command).to match(expected_command)
41
-
42
- actual_command =~ expected_command
43
- expect($1).to match(/#{File.expand_path('file_one')}/)
44
- expect($1).to match(/#{File.expand_path('file_two')}/)
45
- end
46
-
47
- it "returns a blank command for no files" do
48
- expect(rspec_autotest.make_test_cmd({})).to eq('')
49
- end
50
-
51
- it "quotes the paths of files to test" do
52
- cmd = rspec_autotest.make_test_cmd(@files_to_test)
53
- @files_to_test.keys.each do |file_to_test|
54
- expect(cmd).to match(/"#{File.expand_path(file_to_test)}"/)
55
- end
56
- end
57
-
58
- it "quotes the path of the ruby executable" do
59
- cmd = rspec_autotest.make_test_cmd(@files_to_test)
60
- expect(cmd).to match(%r("/path/to/ruby"))
61
- end
62
-
63
- it "gives '--tty' to #{Autotest::Rspec2::RSPEC_EXECUTABLE}, not '--autotest'" do
64
- cmd = rspec_autotest.make_test_cmd(@files_to_test)
65
- expect(cmd).to match(' --tty ')
66
- expect(cmd).not_to match(' --autotest ')
67
- end
68
- end
69
-
70
- describe "mappings" do
71
- before do
72
- @lib_file = "lib/something.rb"
73
- @spec_file = "spec/something_spec.rb"
74
- rspec_autotest.hook :initialize
75
- end
76
-
77
- it "finds the spec file for a given lib file" do
78
- expect(rspec_autotest).to map_specs([@spec_file]).to(@lib_file)
79
- end
80
-
81
- it "finds the spec file if given a spec file" do
82
- expect(rspec_autotest).to map_specs([@spec_file]).to(@spec_file)
83
- end
84
-
85
- it "ignores files in spec dir that aren't specs" do
86
- expect(rspec_autotest).to map_specs([]).to("spec/spec_helper.rb")
87
- end
88
-
89
- it "ignores untracked files (in @file)" do
90
- expect(rspec_autotest).to map_specs([]).to("lib/untracked_file")
91
- end
92
- end
93
-
94
- describe "consolidating failures" do
95
- let(:subject_file) { "lib/autotest/some.rb" }
96
- let(:spec_file) { "spec/autotest/some_spec.rb" }
97
-
98
- it "returns no failures if no failures were given in the output" do
99
- expect(rspec_autotest.consolidate_failures([[]])).to eq({})
100
- end
101
-
102
- it "returns a hash with the spec filename => spec name for each failure or error" do
103
- failures = [ [ "false should be false", spec_file ] ]
104
- expect(rspec_autotest.consolidate_failures(failures)).to eq({
105
- spec_file => ["false should be false"]
106
- })
107
- end
108
-
109
- context "when subject file appears before the spec file in the backtrace" do
110
- let(:failures) do
111
- [ [ "false should be false", "#{subject_file}:143:\n#{spec_file}:203:" ] ]
112
- end
113
-
114
- it "excludes the subject file" do
115
- expect(rspec_autotest.consolidate_failures(failures).keys).not_to include(subject_file)
116
- end
117
-
118
- it "includes the spec file" do
119
- expect(rspec_autotest.consolidate_failures(failures).keys).to include(spec_file)
120
- end
121
- end
122
- end
123
-
124
- describe "normalizing file names" do
125
- it "ensures that a single file appears in files_to_test only once" do
126
- @files_to_test = {}
127
- ['filename.rb', './filename.rb', File.expand_path('filename.rb')].each do |file|
128
- @files_to_test[file] = []
129
- end
130
- expect(rspec_autotest.normalize(@files_to_test)).to have(1).file
131
- end
132
- end
133
- end
@@ -1,68 +0,0 @@
1
- require "spec_helper"
2
-
3
- module RSpec::Core
4
- describe BacktraceCleaner do
5
- context "with no patterns" do
6
- it "keeps all lines" do
7
- lines = ["/tmp/a_file", "some_random_text", "hello\330\271!"]
8
- cleaner = BacktraceCleaner.new([], [])
9
- expect(lines.all? {|line| cleaner.exclude? line}).to be_falsey
10
- end
11
-
12
- it 'is considered a full backtrace' do
13
- expect(BacktraceCleaner.new([], []).full_backtrace?).to be_truthy
14
- end
15
- end
16
-
17
- context "with an exclusion pattern but no inclusion patterns" do
18
- it "excludes lines that match the exclusion pattern" do
19
- cleaner = BacktraceCleaner.new([], [/remove/])
20
- expect(cleaner.exclude? "remove me").to be_truthy
21
- end
22
-
23
- it "keeps lines that do not match the exclusion pattern" do
24
- cleaner = BacktraceCleaner.new([], [/remove/])
25
- expect(cleaner.exclude? "apple").to be_falsey
26
- end
27
-
28
- it 'is considered a partial backtrace' do
29
- expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_falsey
30
- end
31
- end
32
-
33
- context "with an exclusion pattern and an inclusion pattern" do
34
- it "excludes lines that match the exclusion pattern but not the inclusion pattern" do
35
- cleaner = BacktraceCleaner.new([/keep/], [/discard/])
36
- expect(cleaner.exclude? "discard").to be_truthy
37
- end
38
-
39
- it "keeps lines that match the inclusion pattern and the exclusion pattern" do
40
- cleaner = BacktraceCleaner.new([/hi/], [/.*/])
41
- expect(cleaner.exclude? "hi").to be_falsey
42
- end
43
-
44
- it "keeps lines that match neither pattern" do
45
- cleaner = BacktraceCleaner.new([/hi/], [/delete/])
46
- expect(cleaner.exclude? "fish").to be_falsey
47
- end
48
-
49
- it 'is considered a partial backtrace' do
50
- expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_falsey
51
- end
52
- end
53
-
54
- context "with an exclusion pattern that matches the current working directory" do
55
- it "defaults to having one inclusion pattern, the current working directory" do
56
- cleaner = BacktraceCleaner.new(nil, [/.*/])
57
- expect(Dir.getwd =~ cleaner.inclusion_patterns.first).to be_truthy
58
- end
59
- end
60
-
61
- context "with an exclusion pattern that does not match the current working directory" do
62
- it "defaults to having no exclusion patterns" do
63
- cleaner = BacktraceCleaner.new(nil, [/i_wont_match_a_directory/])
64
- expect(cleaner.inclusion_patterns.length).to be_zero
65
- end
66
- end
67
- end
68
- end
@@ -1,58 +0,0 @@
1
- require 'spec_helper'
2
- require 'rspec/core/caller_filter'
3
-
4
- module RSpec
5
- describe CallerFilter do
6
- def ruby_files_in_lib(lib)
7
- # http://rubular.com/r/HYpUMftlG2
8
- path = $LOAD_PATH.find { |p| p.match(/\/rspec-#{lib}(-[a-f0-9]+)?\/lib/) }
9
-
10
- unless path
11
- pending "Cannot locate rspec-#{lib} files."
12
- end
13
-
14
- Dir["#{path}/**/*.rb"].sort.tap do |files|
15
- # Just a sanity check...
16
- expect(files.count).to be > 10
17
- end
18
- end
19
-
20
- describe "the filtering regex" do
21
- def unmatched_from(files)
22
- files.reject { |file| file.match(CallerFilter::LIB_REGEX) }
23
- end
24
-
25
- %w[ core mocks expectations ].each do |lib|
26
- it "matches all ruby files in rspec-#{lib}" do
27
- files = ruby_files_in_lib(lib)
28
-
29
- files.reject! do |file|
30
- # We don't care about this file -- it only has a single require statement
31
- # and won't show up in any backtraces.
32
- file.end_with?('lib/rspec-expectations.rb') ||
33
-
34
- # This has a single require and a single deprecation, and won't be
35
- # in backtraces.
36
- file.end_with?('lib/spec/mocks.rb') ||
37
-
38
- # Autotest files are only loaded by the autotest executable
39
- # and not by the rspec command and thus won't be in backtraces.
40
- file.include?('autotest')
41
- end
42
-
43
- expect(unmatched_from files).to eq([])
44
- end
45
- end
46
-
47
- it "does not match other ruby files" do
48
- files = %w[
49
- /path/to/lib/rspec/some-extension/foo.rb
50
- /path/to/spec/rspec/core/some_spec.rb
51
- ]
52
-
53
- expect(unmatched_from files).to eq(files)
54
- end
55
- end
56
- end
57
- end
58
-
@@ -1,59 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "deprecated methods" do
4
- describe "Spec" do
5
- it "is deprecated" do
6
- RSpec.should_receive(:deprecate)
7
- Spec
8
- end
9
-
10
- it "returns RSpec" do
11
- RSpec.stub(:deprecate)
12
- expect(Spec).to eq(RSpec)
13
- end
14
-
15
- it "doesn't include backward compatibility in const_missing backtrace" do
16
- RSpec.stub(:deprecate)
17
- exception = nil
18
- begin
19
- ConstantThatDoesNotExist
20
- rescue Exception => exception
21
- end
22
- expect(exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }).to be_nil
23
- end
24
- end
25
-
26
- describe RSpec::Core::SharedExampleGroup do
27
- describe 'share_as' do
28
- it 'is deprecated' do
29
- RSpec.should_receive(:deprecate).at_least(:once)
30
- RSpec::Core::SharedExampleGroup.share_as(:DeprecatedSharedConst) {}
31
- end
32
- end
33
- end
34
-
35
- describe "Spec::Runner.configure" do
36
- it "is deprecated" do
37
- RSpec.should_receive(:deprecate).at_least(:once)
38
- Spec::Runner.configure
39
- end
40
- end
41
-
42
- describe "Spec::Rake::SpecTask" do
43
- it "is deprecated" do
44
- RSpec.should_receive(:deprecate).at_least(:once)
45
- Spec::Rake::SpecTask
46
- end
47
-
48
- it "doesn't include backward compatibility in const_missing backtrace" do
49
- RSpec.stub(:deprecate)
50
- exception = nil
51
- begin
52
- Spec::Rake::ConstantThatDoesNotExist
53
- rescue Exception => exception
54
- end
55
- expect(exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }).to be_nil
56
- end
57
- end
58
-
59
- end