diff --git a/Changelog.md b/Changelog.md index c4253411b3..598fcc0356 100644 --- a/Changelog.md +++ b/Changelog.md @@ -16,6 +16,14 @@ Breaking Changes for 3.0.0: are handled by methods matching the names on formatters. This allows us to add or remove notifications without breaking existing formatters. (Jon Rowe) +* Remove support for deprecated `:alias` option for + `RSpec.configuration.add_setting`. (Myron Marston) +* Remove support for deprecated `RSpec.configuration.requires = [...]`. + (Myron Marston) +* Remove support for deprecated `--formatter` CLI option. (Myron Marston) +* Remove support for deprecated `--configure` CLI option. (Myron Marston) +* Remove support for deprecated `RSpec::Core::RakeTask#spec_opts=`. + (Myron Marston) Enhancements: diff --git a/lib/rspec/core.rb b/lib/rspec/core.rb index 62a5368db2..7b440fc9a5 100644 --- a/lib/rspec/core.rb +++ b/lib/rspec/core.rb @@ -85,20 +85,6 @@ def self.reset # @see RSpec.configure # @see Core::Configuration def self.configuration - if block_given? - RSpec.warn_deprecation <<-WARNING - -***************************************************************** -DEPRECATION WARNING - -* RSpec.configuration with a block is deprecated and has no effect. -* please use RSpec.configure with a block instead. - -Called from #{CallerFilter.first_non_rspec_line} -***************************************************************** - -WARNING - end @configuration ||= begin config = RSpec::Core::Configuration.new config.expose_dsl_globally = true diff --git a/lib/rspec/core/configuration.rb b/lib/rspec/core/configuration.rb index 2bf7a579d9..28e5e7da8d 100644 --- a/lib/rspec/core/configuration.rb +++ b/lib/rspec/core/configuration.rb @@ -41,11 +41,6 @@ def self.define_reader(name) end end - # @private - def self.deprecate_alias_key - RSpec.deprecate("add_setting with :alias option", :replacement => ":alias_with") - end - # @private def self.define_aliases(name, alias_name) alias_method alias_name, name @@ -64,13 +59,9 @@ def self.define_predicate_for(*names) # `Configuration` instance rather than this class method. def self.add_setting(name, opts={}) raise "Use the instance add_setting method if you want to set a default" if opts.has_key?(:default) - if opts[:alias] - deprecate_alias_key - define_aliases(opts[:alias], name) - else - attr_writer name - add_read_only_setting name - end + attr_writer name + add_read_only_setting name + Array(opts[:alias_with]).each do |alias_name| define_aliases(name, alias_name) end @@ -559,13 +550,6 @@ def libs=(libs) end end - def requires=(paths) - RSpec.deprecate("RSpec::Core::Configuration#requires=(paths)", - :replacement => "paths.each {|path| require path}") - paths.map {|path| require path} - @requires += paths - end - # Run examples defined on `line_numbers` in all files to run. def line_numbers=(line_numbers) filter_run :line_numbers => line_numbers.map{|l| l.to_i} diff --git a/lib/rspec/core/option_parser.rb b/lib/rspec/core/option_parser.rb index 5c20a27c9b..54dee92133 100644 --- a/lib/rspec/core/option_parser.rb +++ b/lib/rspec/core/option_parser.rb @@ -26,9 +26,6 @@ def parse(args) def convert_deprecated_args(args) args.map! { |arg| case arg - when "--formatter" - RSpec.deprecate("the --formatter option", :replacement => "-f or --format") - "--format" when "--default_path" "--default-path" when "--line_number" @@ -100,11 +97,6 @@ def parser(options) exit end - parser.on('--configure', 'Deprecated. Use --init instead.') do |cmd| - RSpec.warning "--configure is deprecated with no effect. Use --init instead.", :call_site => nil - exit - end - parser.separator("\n **** Output ****\n\n") parser.on('-f', '--format FORMATTER', 'Choose a formatter.', diff --git a/lib/rspec/core/rake_task.rb b/lib/rspec/core/rake_task.rb index 9f1c2b42ef..649923672d 100644 --- a/lib/rspec/core/rake_task.rb +++ b/lib/rspec/core/rake_task.rb @@ -54,18 +54,6 @@ class RakeTask < ::Rake::TaskLib # nil attr_accessor :rspec_opts - # @deprecated - # Use rspec_opts instead. - # - # Command line options to pass to rspec. - # - # default: - # nil - def spec_opts=(opts) - RSpec.deprecate('RSpec::Core::RakeTask#spec_opts=', :replacement => 'rspec_opts=') - @rspec_opts = opts - end - def initialize(*args, &task_block) setup_ivars(args) diff --git a/spec/rspec/core/configuration_spec.rb b/spec/rspec/core/configuration_spec.rb index 308bd58dce..9f7790c891 100644 --- a/spec/rspec/core/configuration_spec.rb +++ b/spec/rspec/core/configuration_spec.rb @@ -7,15 +7,6 @@ module RSpec::Core let(:config) { Configuration.new } - describe "RSpec.configuration with a block" do - before { allow(RSpec).to receive(:warn_deprecation) } - - it "is deprecated" do - expect(RSpec).to receive(:warn_deprecation) - RSpec.configuration {} - end - end - describe '#deprecation_stream' do it 'defaults to standard error' do expect($rspec_core_without_stderr_monkey_patch.deprecation_stream).to eq STDERR @@ -1030,22 +1021,6 @@ def metadata_hash(*args) end end - describe "#requires=" do - before { expect(RSpec).to receive :deprecate } - - it "requires the configured files" do - expect(config).to receive(:require).with('foo').ordered - expect(config).to receive(:require).with('bar').ordered - config.requires = ['foo', 'bar'] - end - - it "stores require paths" do - expect(config).to receive(:require).with("a/path") - config.requires = ["a/path"] - expect(config.requires).to eq ['a/path'] - end - end - describe "#add_setting" do describe "with no modifiers" do context "with no additional options" do @@ -1097,14 +1072,6 @@ def metadata_hash(*args) end end - context "with :alias => " do - it "is deprecated" do - expect(RSpec)::to receive(:deprecate).with(/:alias option/, :replacement => ":alias_with") - config.add_setting :custom_option - config.add_setting :another_custom_option, :alias => :custom_option - end - end - context "with :alias_with => " do before do config.add_setting :custom_option, :alias_with => :another_custom_option diff --git a/spec/rspec/core/example_group_spec.rb b/spec/rspec/core/example_group_spec.rb index 892b11ff83..af0972f1a5 100644 --- a/spec/rspec/core/example_group_spec.rb +++ b/spec/rspec/core/example_group_spec.rb @@ -938,29 +938,31 @@ def extract_execution_results(group) end %w[ fdescribe fcontext ].each do |method_name| - def executed_examples_of(group) - examples = group.examples.select { |ex| ex.metadata[:execution_result][:started_at] } - group.children.inject(examples) { |exs, child| exs + executed_examples_of(child) } - end + describe ".#{method_name}" do + def executed_examples_of(group) + examples = group.examples.select { |ex| ex.metadata[:execution_result][:started_at] } + group.children.inject(examples) { |exs, child| exs + executed_examples_of(child) } + end - [:focus, :focused].each do |metadata| - it "generates an example group that can be filtered with :#{metadata}" do - RSpec.configuration.filter_run metadata + [:focus, :focused].each do |metadata| + it "generates an example group that can be filtered with :#{metadata}" do + RSpec.configuration.filter_run metadata - parent_group = ExampleGroup.describe do - describe "not focused" do - example("not focused example") { } - end + parent_group = ExampleGroup.describe do + describe "not focused" do + example("not focused example") { } + end - send(method_name, "focused") do - example("focused example") { } + send(method_name, "focused") do + example("focused example") { } + end end - end - parent_group.run + parent_group.run - executed_descriptions = executed_examples_of(parent_group).map(&:description) - expect(executed_descriptions).to eq(["focused example"]) + executed_descriptions = executed_examples_of(parent_group).map(&:description) + expect(executed_descriptions).to eq(["focused example"]) + end end end end diff --git a/spec/rspec/core/option_parser_spec.rb b/spec/rspec/core/option_parser_spec.rb index a5b5ebfc62..3e2bc719df 100644 --- a/spec/rspec/core/option_parser_spec.rb +++ b/spec/rspec/core/option_parser_spec.rb @@ -45,18 +45,6 @@ module RSpec::Core end end - describe "--formatter" do - it "is deprecated" do - expect(RSpec).to receive(:deprecate) - Parser.parse(%w[--formatter doc]) - end - - it "gets converted to --format" do - options = Parser.parse(%w[--formatter doc]) - expect(options[:formatters].first).to eq(["doc"]) - end - end - describe "--default_path" do it "gets converted to --default-path" do options = Parser.parse(%w[--default_path foo])