rspec-core 2.99.2 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- 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,50 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rspec/core/formatters/console_codes'
|
3
|
-
|
4
|
-
RSpec.describe "RSpec::Core::Formatters::ConsoleCodes" do
|
5
|
-
let(:console_codes) { RSpec::Core::Formatters::ConsoleCodes }
|
6
|
-
|
7
|
-
describe "#console_code_for(code_or_symbol)" do
|
8
|
-
context "when given a VT100 integer code" do
|
9
|
-
it "returns the code" do
|
10
|
-
expect(console_codes.console_code_for(32)).to eq 32
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context "when given a symbolic name" do
|
15
|
-
it "returns the code" do
|
16
|
-
expect(console_codes.console_code_for(:green)).to eq 32
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "when given a nonexistant code" do
|
21
|
-
it "returns the code for white" do
|
22
|
-
expect(console_codes.console_code_for(:octarine)).to eq 37
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#wrap" do
|
28
|
-
before do
|
29
|
-
allow(RSpec.configuration).to receive(:color_enabled?) { true }
|
30
|
-
end
|
31
|
-
|
32
|
-
context "when given a VT100 integer code" do
|
33
|
-
it "formats the text with it" do
|
34
|
-
expect(console_codes.wrap('abc', 32)).to eq "\e[32mabc\e[0m"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context "when given a symbolic color name" do
|
39
|
-
it "translates it to the correct integer code and formats the text with it" do
|
40
|
-
expect(console_codes.wrap('abc', :green)).to eq "\e[32mabc\e[0m"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "when given :bold" do
|
45
|
-
it "formats the text as bold" do
|
46
|
-
expect(console_codes.wrap('abc', :bold)).to eq "\e[1mabc\e[0m"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'rspec/core/formatters/text_mate_formatter'
|
4
|
-
require 'nokogiri'
|
5
|
-
|
6
|
-
module RSpec
|
7
|
-
module Core
|
8
|
-
module Formatters
|
9
|
-
describe TextMateFormatter do
|
10
|
-
|
11
|
-
let(:root) { File.expand_path("#{File.dirname(__FILE__)}/../../../..") }
|
12
|
-
let(:expected_file) do
|
13
|
-
"#{File.dirname(__FILE__)}/text_mate_formatted.html"
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:generated_html) do
|
17
|
-
allow(RSpec).to receive(:deprecate)
|
18
|
-
options = RSpec::Core::ConfigurationOptions.new(
|
19
|
-
%w[spec/rspec/core/resources/formatter_specs.rb --format textmate --order defined]
|
20
|
-
)
|
21
|
-
options.parse_options
|
22
|
-
|
23
|
-
err, out = StringIO.new, StringIO.new
|
24
|
-
err.set_encoding("utf-8") if err.respond_to?(:set_encoding)
|
25
|
-
out.set_encoding("utf-8") if out.respond_to?(:set_encoding)
|
26
|
-
|
27
|
-
runner = RSpec::Core::Runner.new(options)
|
28
|
-
configuration = runner.instance_variable_get(:@configuration)
|
29
|
-
|
30
|
-
configuration.backtrace_formatter.inclusion_patterns = []
|
31
|
-
configuration.output_stream = out
|
32
|
-
configuration.deprecation_stream = err
|
33
|
-
|
34
|
-
runner.run(err, out)
|
35
|
-
html = out.string.gsub(/\d+\.\d+(s| seconds)/, "n.nnnn\\1")
|
36
|
-
|
37
|
-
actual_doc = Nokogiri::HTML(html)
|
38
|
-
actual_doc.css("div.backtrace pre").each do |elem|
|
39
|
-
# This is to minimize churn on backtrace lines that we do not
|
40
|
-
# assert on anyway.
|
41
|
-
backtrace = elem.inner_html.lines.
|
42
|
-
select {|e| e =~ /formatter_specs\.rb/ }.
|
43
|
-
map {|x| x.chomp.split(":")[0..1].join(':') }.
|
44
|
-
join("\n")
|
45
|
-
|
46
|
-
elem.inner_html = backtrace
|
47
|
-
end
|
48
|
-
actual_doc.inner_html
|
49
|
-
end
|
50
|
-
|
51
|
-
let(:expected_html) do
|
52
|
-
unless File.file?(expected_file)
|
53
|
-
raise "There is no HTML file with expected content for this platform: #{expected_file}"
|
54
|
-
end
|
55
|
-
File.read(expected_file)
|
56
|
-
end
|
57
|
-
|
58
|
-
before do
|
59
|
-
RSpec.configuration.stub(:load_spec_files) do
|
60
|
-
RSpec.configuration.files_to_run.map {|f| load File.expand_path(f) }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# Uncomment this group temporarily in order to overwrite the expected
|
65
|
-
# with actual. Use with care!!!
|
66
|
-
describe "file generator", :if => ENV['GENERATE'] do
|
67
|
-
it "generates a new comparison file" do
|
68
|
-
Dir.chdir(root) do
|
69
|
-
File.open(expected_file, 'w') {|io| io.write(generated_html)}
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe 'produced HTML', :if => RUBY_VERSION <= '2.0.0' do
|
75
|
-
# Rubies before 2 are a wild west of different outputs, and it's not
|
76
|
-
# worth the effort to maintain accurate fixtures for all of them.
|
77
|
-
# Since we are verifying fixtures on other rubies, if this code at
|
78
|
-
# least runs we can be reasonably confident the output is right since
|
79
|
-
# behaviour variances that we care about across versions is neglible.
|
80
|
-
it 'is present' do
|
81
|
-
expect(generated_html).to be
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'produced HTML', :if => RUBY_VERSION >= '2.0.0' do
|
86
|
-
it "produces HTML identical to the one we designed manually" do
|
87
|
-
Dir.chdir(root) do
|
88
|
-
actual_doc = Nokogiri::HTML(generated_html)
|
89
|
-
backtrace_lines = actual_doc.search("div.backtrace a")
|
90
|
-
actual_doc.search("div.backtrace").remove
|
91
|
-
|
92
|
-
expected_doc = Nokogiri::HTML(expected_html)
|
93
|
-
expected_doc.search("div.backtrace").remove
|
94
|
-
|
95
|
-
expect(actual_doc.inner_html).to eq(expected_doc.inner_html)
|
96
|
-
|
97
|
-
backtrace_lines.each do |backtrace_line|
|
98
|
-
expect(backtrace_line['href']).to include("txmt://open?url=")
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe RSpec::Core::Pending do
|
4
|
-
describe 'PendingDeclaredInExample' do
|
5
|
-
before { allow_deprecation }
|
6
|
-
|
7
|
-
it 'is an alternate reference to SkipDeclaredInExample' do
|
8
|
-
expect(::RSpec::Core::Pending::PendingDeclaredInExample).to \
|
9
|
-
be(::RSpec::Core::Pending::SkipDeclaredInExample)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'prints a deprecation warning' do
|
13
|
-
expect_deprecation_with_call_site(
|
14
|
-
__FILE__,
|
15
|
-
__LINE__ + 3,
|
16
|
-
/PendingDeclaredInExample/
|
17
|
-
)
|
18
|
-
::RSpec::Core::Pending::PendingDeclaredInExample
|
19
|
-
end
|
20
|
-
|
21
|
-
specify 'the const_missing hook raises for other undefined constants' do
|
22
|
-
expect {
|
23
|
-
::RSpec::Core::Pending::SomeUndefinedConst
|
24
|
-
}.to raise_error(NameError, /uninitialized constant/)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module SilenceDSLDeprecations
|
2
|
-
class Reporter
|
3
|
-
def initialize(reporter)
|
4
|
-
@reporter = reporter
|
5
|
-
end
|
6
|
-
|
7
|
-
def deprecation(*)
|
8
|
-
# do nothing
|
9
|
-
end
|
10
|
-
|
11
|
-
def respond_to?(*args)
|
12
|
-
@reporter.respond_to?(*args) || super
|
13
|
-
end
|
14
|
-
|
15
|
-
def method_missing(*args, &block)
|
16
|
-
@reporter.__send__(*args, &block)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def silence_dsl_deprecations
|
21
|
-
old_reporter = RSpec.configuration.reporter
|
22
|
-
replace_reporter(Reporter.new(old_reporter))
|
23
|
-
yield
|
24
|
-
ensure
|
25
|
-
replace_reporter(old_reporter)
|
26
|
-
end
|
27
|
-
|
28
|
-
def replace_reporter(new_reporter)
|
29
|
-
RSpec.configuration.instance_variable_set(:@reporter, new_reporter)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|