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
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe RSpec::Core::Deprecation do
|
|
4
|
-
describe "#deprecate" do
|
|
5
|
-
it "passes the hash to the reporter" do
|
|
6
|
-
expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method", :replacement => "replacement")
|
|
7
|
-
RSpec.deprecate("deprecated_method", :replacement => "replacement")
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "adds the call site" do
|
|
11
|
-
expect_deprecation_with_call_site(__FILE__, __LINE__ + 1)
|
|
12
|
-
RSpec.deprecate("deprecated_method")
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "doesn't override a passed call site" do
|
|
16
|
-
expect_deprecation_with_call_site("some_file.rb", 17)
|
|
17
|
-
RSpec.deprecate("deprecated_method", :call_site => "/some_file.rb:17")
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe "#warn_deprecation" do
|
|
22
|
-
it "puts message in a hash" do
|
|
23
|
-
expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :message => "this is the message")
|
|
24
|
-
RSpec.warn_deprecation("this is the message")
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -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
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require 'rspec/core/drb_command_line'
|
|
3
|
-
|
|
4
|
-
describe "::DRbCommandLine", :type => :drb, :unless => RUBY_PLATFORM == 'java' do
|
|
5
|
-
let(:config) { RSpec::Core::Configuration.new }
|
|
6
|
-
let(:out) { StringIO.new }
|
|
7
|
-
let(:err) { StringIO.new }
|
|
8
|
-
|
|
9
|
-
include_context "spec files"
|
|
10
|
-
|
|
11
|
-
def command_line(*args)
|
|
12
|
-
RSpec::Core::DRbCommandLine.new(config_options(*args))
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def config_options(*args)
|
|
16
|
-
options = RSpec::Core::ConfigurationOptions.new(args)
|
|
17
|
-
options.parse_options
|
|
18
|
-
options
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
context "without server running" do
|
|
22
|
-
it "raises an error" do
|
|
23
|
-
expect { command_line.run(err, out) }.to raise_error(DRb::DRbConnError)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe "--drb-port" do
|
|
28
|
-
def with_RSPEC_DRB_set_to(val)
|
|
29
|
-
with_env_vars('RSPEC_DRB' => val) { yield }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
context "without RSPEC_DRB environment variable set" do
|
|
33
|
-
it "defaults to 8989" do
|
|
34
|
-
with_RSPEC_DRB_set_to(nil) do
|
|
35
|
-
expect(command_line.drb_port).to eq(8989)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "sets the DRb port" do
|
|
40
|
-
with_RSPEC_DRB_set_to(nil) do
|
|
41
|
-
expect(command_line("--drb-port", "1234").drb_port).to eq(1234)
|
|
42
|
-
expect(command_line("--drb-port", "5678").drb_port).to eq(5678)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
context "with RSPEC_DRB environment variable set" do
|
|
48
|
-
context "without config variable set" do
|
|
49
|
-
it "uses RSPEC_DRB value" do
|
|
50
|
-
with_RSPEC_DRB_set_to('9000') do
|
|
51
|
-
expect(command_line.drb_port).to eq("9000")
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context "and config variable set" do
|
|
57
|
-
it "uses configured value" do
|
|
58
|
-
with_RSPEC_DRB_set_to('9000') do
|
|
59
|
-
expect(command_line(*%w[--drb-port 5678]).drb_port).to eq(5678)
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
context "with server running" do
|
|
67
|
-
class SimpleDRbSpecServer
|
|
68
|
-
def self.run(argv, err, out)
|
|
69
|
-
options = RSpec::Core::ConfigurationOptions.new(argv)
|
|
70
|
-
options.parse_options
|
|
71
|
-
RSpec::Core::CommandLine.new(options, RSpec::Core::Configuration.new).run(err, out)
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
before(:all) do
|
|
76
|
-
@drb_port = '8990'
|
|
77
|
-
@drb_example_file_counter = 0
|
|
78
|
-
DRb::start_service("druby://127.0.0.1:#{@drb_port}", SimpleDRbSpecServer)
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
after(:all) do
|
|
82
|
-
DRb::stop_service
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it "returns 0 if spec passes" do
|
|
86
|
-
result = command_line("--drb-port", @drb_port, passing_spec_filename).run(err, out)
|
|
87
|
-
expect(result).to be(0)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
it "returns 1 if spec fails" do
|
|
91
|
-
result = command_line("--drb-port", @drb_port, failing_spec_filename).run(err, out)
|
|
92
|
-
expect(result).to be(1)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
it "outputs colorized text when running with --colour option" do
|
|
96
|
-
pending "figure out a way to tell the output to say it's tty"
|
|
97
|
-
command_line(failing_spec_filename, "--color", "--drb-port", @drb_port).run(err, out)
|
|
98
|
-
out.rewind
|
|
99
|
-
expect(out.read).to match(/\e\[31m/m)
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require 'rspec/core/drb_options'
|
|
3
|
-
|
|
4
|
-
describe RSpec::Core::DrbOptions, :isolated_directory => true, :isolated_home => true do
|
|
5
|
-
include ConfigOptionsHelper
|
|
6
|
-
|
|
7
|
-
describe "#drb_argv" do
|
|
8
|
-
it "preserves extra arguments" do
|
|
9
|
-
File.stub(:exist?) { false }
|
|
10
|
-
expect(config_options_object(*%w[ a --drb b --color c ]).drb_argv).to match_array %w[ --color a b c ]
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
%w(--color --fail-fast --profile --backtrace --tty).each do |option|
|
|
14
|
-
it "includes #{option}" do
|
|
15
|
-
expect(config_options_object("#{option}").drb_argv).to include("#{option}")
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "includes --failure-exit-code" do
|
|
20
|
-
expect(config_options_object(*%w[--failure-exit-code 2]).drb_argv).to include("--failure-exit-code", "2")
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "includes --options" do
|
|
24
|
-
expect(config_options_object(*%w[--options custom.opts]).drb_argv).to include("--options", "custom.opts")
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it "includes --order" do
|
|
28
|
-
expect(config_options_object(*%w[--order random]).drb_argv).to include('--order', 'random')
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context "with --example" do
|
|
32
|
-
it "includes --example" do
|
|
33
|
-
expect(config_options_object(*%w[--example foo]).drb_argv).to include("--example", "foo")
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "unescapes characters which were escaped upon storing --example originally" do
|
|
37
|
-
expect(config_options_object("--example", "foo\\ bar").drb_argv).to include("--example", "foo bar")
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
context "with tags" do
|
|
42
|
-
it "includes the inclusion tags" do
|
|
43
|
-
coo = config_options_object("--tag", "tag")
|
|
44
|
-
expect(coo.drb_argv).to eq(["--tag", "tag"])
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "includes the inclusion tags with values" do
|
|
48
|
-
coo = config_options_object("--tag", "tag:foo")
|
|
49
|
-
expect(coo.drb_argv).to eq(["--tag", "tag:foo"])
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "leaves inclusion tags intact" do
|
|
53
|
-
coo = config_options_object("--tag", "tag")
|
|
54
|
-
coo.drb_argv
|
|
55
|
-
expect(coo.filter_manager.inclusions).to eq( {:tag=>true} )
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "leaves inclusion tags with values intact" do
|
|
59
|
-
coo = config_options_object("--tag", "tag:foo")
|
|
60
|
-
coo.drb_argv
|
|
61
|
-
expect(coo.filter_manager.inclusions).to eq( {:tag=>'foo'} )
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it "includes the exclusion tags" do
|
|
65
|
-
coo = config_options_object("--tag", "~tag")
|
|
66
|
-
expect(coo.drb_argv).to eq(["--tag", "~tag"])
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
it "includes the exclusion tags with values" do
|
|
70
|
-
coo = config_options_object("--tag", "~tag:foo")
|
|
71
|
-
expect(coo.drb_argv).to eq(["--tag", "~tag:foo"])
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it "leaves exclusion tags intact" do
|
|
75
|
-
coo = config_options_object("--tag", "~tag")
|
|
76
|
-
coo.drb_argv
|
|
77
|
-
expect(coo.filter_manager.exclusions).to include(:tag=>true)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "leaves exclusion tags with values intact" do
|
|
81
|
-
coo = config_options_object("--tag", "~tag:foo")
|
|
82
|
-
coo.drb_argv
|
|
83
|
-
expect(coo.filter_manager.exclusions).to include(:tag=>'foo')
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
context "with formatters" do
|
|
88
|
-
it "includes the formatters" do
|
|
89
|
-
coo = config_options_object("--format", "d")
|
|
90
|
-
expect(coo.drb_argv).to eq(["--format", "d"])
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
it "leaves formatters intact" do
|
|
94
|
-
coo = config_options_object("--format", "d")
|
|
95
|
-
coo.drb_argv
|
|
96
|
-
expect(coo.options[:formatters]).to eq([["d"]])
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
it "leaves output intact" do
|
|
100
|
-
coo = config_options_object("--format", "p", "--out", "foo.txt", "--format", "d")
|
|
101
|
-
coo.drb_argv
|
|
102
|
-
expect(coo.options[:formatters]).to eq([["p","foo.txt"],["d"]])
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
context "with --out" do
|
|
107
|
-
it "combines with formatters" do
|
|
108
|
-
coo = config_options_object(*%w[--format h --out report.html])
|
|
109
|
-
expect(coo.drb_argv).to eq(%w[--format h --out report.html])
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
context "with --line_number" do
|
|
114
|
-
it "includes --line_number" do
|
|
115
|
-
expect(config_options_object(*%w[--line_number 35]).drb_argv).to eq(%w[--line_number 35])
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
it "includes multiple lines" do
|
|
119
|
-
expect(config_options_object(*%w[-l 90 -l 4 -l 55]).drb_argv).to eq(
|
|
120
|
-
%w[--line_number 90 --line_number 4 --line_number 55]
|
|
121
|
-
)
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
context "with -I libs" do
|
|
126
|
-
it "includes -I" do
|
|
127
|
-
expect(config_options_object(*%w[-I a_dir]).drb_argv).to eq(%w[-I a_dir])
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
it "includes multiple paths" do
|
|
131
|
-
expect(config_options_object(*%w[-I dir_1 -I dir_2 -I dir_3]).drb_argv).to eq(
|
|
132
|
-
%w[-I dir_1 -I dir_2 -I dir_3]
|
|
133
|
-
)
|
|
134
|
-
end
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
context "with --require" do
|
|
138
|
-
it "includes --require" do
|
|
139
|
-
expect(config_options_object(*%w[--require a_path]).drb_argv).to eq(%w[--require a_path])
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
it "includes multiple paths" do
|
|
143
|
-
expect(config_options_object(*%w[--require dir/ --require file.rb]).drb_argv).to eq(
|
|
144
|
-
%w[--require dir/ --require file.rb]
|
|
145
|
-
)
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
context "--drb specified in ARGV" do
|
|
150
|
-
it "renders all the original arguments except --drb" do
|
|
151
|
-
drb_argv = config_options_object(*%w[ --drb --color --format s --example pattern
|
|
152
|
-
--line_number 1 --profile --backtrace -I
|
|
153
|
-
path/a -I path/b --require path/c --require
|
|
154
|
-
path/d]).drb_argv
|
|
155
|
-
expect(drb_argv).to eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s -I path/a -I path/b --require path/c --require path/d])
|
|
156
|
-
end
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
context "--drb specified in the options file" do
|
|
160
|
-
it "renders all the original arguments except --drb" do
|
|
161
|
-
File.open("./.rspec", "w") {|f| f << "--drb --color"}
|
|
162
|
-
drb_argv = config_options_object(*%w[ --tty --format s --example
|
|
163
|
-
pattern --line_number 1 --profile
|
|
164
|
-
--backtrace ]).drb_argv
|
|
165
|
-
|
|
166
|
-
expect(drb_argv).to eq(%w[ --color --profile --backtrace --tty
|
|
167
|
-
--example pattern --line_number 1 --format s])
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
context "--drb specified in ARGV and the options file" do
|
|
172
|
-
it "renders all the original arguments except --drb" do
|
|
173
|
-
File.open("./.rspec", "w") {|f| f << "--drb --color"}
|
|
174
|
-
drb_argv = config_options_object(*%w[ --drb --format s --example
|
|
175
|
-
pattern --line_number 1 --profile
|
|
176
|
-
--backtrace]).drb_argv
|
|
177
|
-
|
|
178
|
-
expect(drb_argv).to eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s])
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
context "--drb specified in ARGV and in as ARGV-specified --options file" do
|
|
183
|
-
it "renders all the original arguments except --drb and --options" do
|
|
184
|
-
File.open("./.rspec", "w") {|f| f << "--drb --color"}
|
|
185
|
-
drb_argv = config_options_object(*%w[ --drb --format s --example
|
|
186
|
-
pattern --line_number 1 --profile
|
|
187
|
-
--backtrace]).drb_argv
|
|
188
|
-
|
|
189
|
-
expect(drb_argv).to eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s ])
|
|
190
|
-
end
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
end
|
data/spec/rspec/core/dsl_spec.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
main = self
|
|
4
|
-
|
|
5
|
-
describe "The RSpec DSL" do
|
|
6
|
-
methods = [
|
|
7
|
-
:describe,
|
|
8
|
-
:share_examples_for,
|
|
9
|
-
:shared_examples_for,
|
|
10
|
-
:shared_examples,
|
|
11
|
-
:shared_context,
|
|
12
|
-
:share_as
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
methods.each do |method_name|
|
|
16
|
-
describe "##{method_name}" do
|
|
17
|
-
it "is not added to every object in the system" do
|
|
18
|
-
expect(main).to respond_to(method_name)
|
|
19
|
-
expect(Module.new).to respond_to(method_name)
|
|
20
|
-
expect(Object.new).not_to respond_to(method_name)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|