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.
- checksums.yaml +14 -6
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +103 -191
- data/License.txt +1 -0
- data/README.md +4 -25
- data/features/Upgrade.md +2 -14
- data/features/command_line/dry_run.feature +29 -0
- data/features/command_line/example_name_option.feature +1 -1
- data/features/command_line/fail_fast.feature +26 -0
- data/features/command_line/format_option.feature +3 -3
- data/features/command_line/line_number_option.feature +16 -11
- data/features/command_line/order.feature +2 -3
- data/features/command_line/pattern_option.feature +3 -3
- data/features/command_line/randomization.feature +63 -0
- data/features/command_line/require_option.feature +2 -2
- data/features/command_line/ruby.feature +1 -1
- data/features/configuration/alias_example_to.feature +13 -22
- data/features/configuration/{backtrace_clean_patterns.feature → backtrace_exclusion_patterns.feature} +17 -14
- data/features/configuration/custom_settings.feature +11 -11
- data/features/configuration/overriding_global_ordering.feature +93 -0
- data/features/configuration/profile.feature +13 -13
- data/features/configuration/read_options_from_file.feature +7 -7
- data/features/example_groups/basic_structure.feature +1 -1
- data/features/example_groups/shared_context.feature +8 -8
- data/features/example_groups/shared_examples.feature +6 -14
- data/features/expectation_framework_integration/configure_expectation_framework.feature +27 -122
- data/features/filtering/exclusion_filters.feature +2 -5
- data/features/filtering/inclusion_filters.feature +1 -5
- data/features/formatters/json_formatter.feature +2 -2
- data/features/formatters/text_formatter.feature +4 -4
- data/features/helper_methods/arbitrary_methods.feature +2 -2
- data/features/helper_methods/let.feature +5 -5
- data/features/helper_methods/modules.feature +5 -8
- data/features/hooks/around_hooks.feature +2 -2
- data/features/hooks/before_and_after_hooks.feature +14 -14
- data/features/hooks/filtering.feature +12 -14
- data/features/metadata/described_class.feature +1 -1
- data/features/metadata/user_defined.feature +16 -29
- data/features/mock_framework_integration/use_flexmock.feature +1 -1
- data/features/mock_framework_integration/use_mocha.feature +1 -1
- data/features/mock_framework_integration/use_rr.feature +1 -1
- data/features/mock_framework_integration/use_rspec.feature +5 -5
- data/features/pending/pending_examples.feature +5 -5
- data/features/spec_files/arbitrary_file_suffix.feature +1 -1
- data/features/step_definitions/additional_cli_steps.rb +3 -3
- data/features/subject/explicit_subject.feature +8 -8
- data/features/subject/implicit_receiver.feature +29 -0
- data/features/subject/implicit_subject.feature +4 -4
- data/features/support/env.rb +10 -3
- data/features/support/require_expect_syntax_in_aruba_specs.rb +16 -0
- data/lib/rspec/core.rb +11 -48
- data/lib/rspec/core/backport_random.rb +302 -0
- data/lib/rspec/core/backtrace_formatter.rb +65 -0
- data/lib/rspec/core/command_line.rb +7 -18
- data/lib/rspec/core/configuration.rb +202 -507
- data/lib/rspec/core/configuration_options.rb +17 -30
- data/lib/rspec/core/example.rb +29 -39
- data/lib/rspec/core/example_group.rb +166 -259
- data/lib/rspec/core/filter_manager.rb +30 -47
- data/lib/rspec/core/flat_map.rb +17 -0
- data/lib/rspec/core/formatters.rb +0 -138
- data/lib/rspec/core/formatters/base_formatter.rb +46 -1
- data/lib/rspec/core/formatters/base_text_formatter.rb +38 -61
- data/lib/rspec/core/formatters/deprecation_formatter.rb +21 -52
- data/lib/rspec/core/formatters/helpers.rb +0 -28
- data/lib/rspec/core/formatters/html_formatter.rb +1 -1
- data/lib/rspec/core/formatters/json_formatter.rb +38 -9
- data/lib/rspec/core/formatters/snippet_extractor.rb +14 -5
- data/lib/rspec/core/hooks.rb +55 -39
- data/lib/rspec/core/memoized_helpers.rb +17 -167
- data/lib/rspec/core/metadata.rb +16 -64
- data/lib/rspec/core/option_parser.rb +30 -39
- data/lib/rspec/core/ordering.rb +154 -0
- data/lib/rspec/core/pending.rb +12 -69
- data/lib/rspec/core/project_initializer.rb +12 -10
- data/lib/rspec/core/rake_task.rb +5 -108
- data/lib/rspec/core/reporter.rb +15 -18
- data/lib/rspec/core/runner.rb +16 -30
- data/lib/rspec/core/shared_context.rb +3 -5
- data/lib/rspec/core/shared_example_group.rb +3 -51
- data/lib/rspec/core/shared_example_group/collection.rb +1 -19
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/warnings.rb +22 -0
- data/lib/rspec/core/world.rb +12 -8
- data/spec/command_line/order_spec.rb +20 -23
- data/spec/rspec/core/backtrace_formatter_spec.rb +216 -0
- data/spec/rspec/core/command_line_spec.rb +32 -48
- data/spec/rspec/core/configuration_options_spec.rb +19 -50
- data/spec/rspec/core/configuration_spec.rb +142 -713
- data/spec/rspec/core/drb_command_line_spec.rb +2 -0
- data/spec/rspec/core/dsl_spec.rb +0 -1
- data/spec/rspec/core/example_group_spec.rb +192 -223
- data/spec/rspec/core/example_spec.rb +40 -16
- data/spec/rspec/core/filter_manager_spec.rb +2 -2
- data/spec/rspec/core/formatters/base_formatter_spec.rb +0 -41
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +5 -123
- data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +2 -87
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +2 -3
- data/spec/rspec/core/formatters/{text_mate_formatted.html → html_formatted-1.8.7-jruby.html} +44 -25
- data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +477 -0
- data/spec/rspec/core/formatters/{html_formatted.html → html_formatted-1.8.7.html} +42 -25
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +425 -0
- data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +416 -0
- data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +477 -0
- data/spec/rspec/core/formatters/html_formatted-1.9.3.html +419 -0
- data/spec/rspec/core/formatters/html_formatted-2.0.0.html +425 -0
- data/spec/rspec/core/formatters/html_formatter_spec.rb +21 -46
- data/spec/rspec/core/formatters/json_formatter_spec.rb +97 -8
- data/spec/rspec/core/hooks_filtering_spec.rb +5 -5
- data/spec/rspec/core/hooks_spec.rb +61 -47
- data/spec/rspec/core/memoized_helpers_spec.rb +20 -322
- data/spec/rspec/core/metadata_spec.rb +1 -24
- data/spec/rspec/core/option_parser_spec.rb +20 -62
- data/spec/rspec/core/ordering_spec.rb +102 -0
- data/spec/rspec/core/pending_example_spec.rb +0 -40
- data/spec/rspec/core/project_initializer_spec.rb +1 -25
- data/spec/rspec/core/rake_task_spec.rb +5 -72
- data/spec/rspec/core/random_spec.rb +47 -0
- data/spec/rspec/core/reporter_spec.rb +23 -48
- data/spec/rspec/core/runner_spec.rb +31 -39
- data/spec/rspec/core/shared_context_spec.rb +3 -15
- data/spec/rspec/core/shared_example_group/collection_spec.rb +4 -17
- data/spec/rspec/core/shared_example_group_spec.rb +12 -45
- data/spec/rspec/core/{deprecation_spec.rb → warnings_spec.rb} +3 -1
- data/spec/rspec/core_spec.rb +4 -21
- data/spec/spec_helper.rb +41 -5
- data/spec/support/helper_methods.rb +0 -29
- data/spec/support/sandboxed_mock_space.rb +0 -16
- data/spec/support/shared_example_groups.rb +7 -36
- data/spec/support/stderr_splitter.rb +36 -0
- metadata +163 -157
- metadata.gz.sig +1 -0
- data/exe/autospec +0 -13
- data/features/Autotest.md +0 -38
- data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +0 -52
- data/features/subject/attribute_of_subject.feature +0 -124
- data/features/subject/one_liner_syntax.feature +0 -71
- 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/deprecated_mutable_array_proxy.rb +0 -32
- data/lib/rspec/core/deprecation.rb +0 -26
- 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/console_codes.rb +0 -42
- 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/minitest_assertions_adapter.rb +0 -28
- data/lib/rspec/core/test_unit_assertions_adapter.rb +0 -30
- 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/rspec/core/backtrace_cleaner_spec.rb +0 -68
- data/spec/rspec/core/caller_filter_spec.rb +0 -58
- data/spec/rspec/core/deprecations_spec.rb +0 -59
- data/spec/rspec/core/formatters/console_codes_spec.rb +0 -50
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +0 -107
- data/spec/rspec/core/kernel_extensions_spec.rb +0 -9
- data/spec/rspec/core/pending_spec.rb +0 -27
- 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
|
data/spec/autotest/rspec_spec.rb
DELETED
|
@@ -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
|