Hello community, here is the log from the commit of package rubygem-rspec-support for openSUSE:Factory checked in at 2015-06-15 17:45:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-rspec-support (Old) and /work/SRC/openSUSE:Factory/.rubygem-rspec-support.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rspec-support" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-rspec-support/rubygem-rspec-support.changes 2015-03-01 14:57:46.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-rspec-support.new/rubygem-rspec-support.changes 2015-06-15 17:45:36.000000000 +0200 @@ -1,0 +2,25 @@ +Sat Jun 13 04:35:37 UTC 2015 - co...@suse.com + +- updated to version 3.3.0 + see installed Changelog.md + + ### 3.3.0 / 2015-06-12 + [Full Changelog](http://github.com/rspec/rspec-support/compare/v3.2.2...v3.3.0) + + Enhancements: + + * Improve formatting of arrays and hashes in failure messages so they + use our custom formatting of matchers, time objects, etc. + (Myron Marston, Nicholas Chmielewski, #205) + * Use improved formatting for diffs as well. (Nicholas Chmielewski, #205) + + Bug Fixes: + + * Fix `FuzzyMatcher` so that it checks `expected == actual` rather than + `actual == expected`, which avoids errors in situations where the + `actual` object's `==` is improperly implemented to assume that only + objects of the same type will be given. This allows rspec-mocks' + `anything` to match against objects with buggy `==` definitions. + (Myron Marston, #193) + +------------------------------------------------------------------- Old: ---- rspec-support-3.2.2.gem New: ---- rspec-support-3.3.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-rspec-support.spec ++++++ --- /var/tmp/diff_new_pack.DnFWDS/_old 2015-06-15 17:45:37.000000000 +0200 +++ /var/tmp/diff_new_pack.DnFWDS/_new 2015-06-15 17:45:37.000000000 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-rspec-support -Version: 3.2.2 +Version: 3.3.0 Release: 0 %define mod_name rspec-support %define mod_full_name %{mod_name}-%{version} ++++++ rspec-support-3.2.2.gem -> rspec-support-3.3.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Changelog.md new/Changelog.md --- old/Changelog.md 2015-02-24 04:35:55.000000000 +0100 +++ new/Changelog.md 2015-06-12 17:05:41.000000000 +0200 @@ -1,4 +1,24 @@ +### 3.3.0 / 2015-06-12 +[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.2.2...v3.3.0) + +Enhancements: + +* Improve formatting of arrays and hashes in failure messages so they + use our custom formatting of matchers, time objects, etc. + (Myron Marston, Nicholas Chmielewski, #205) +* Use improved formatting for diffs as well. (Nicholas Chmielewski, #205) + +Bug Fixes: + +* Fix `FuzzyMatcher` so that it checks `expected == actual` rather than + `actual == expected`, which avoids errors in situations where the + `actual` object's `==` is improperly implemented to assume that only + objects of the same type will be given. This allows rspec-mocks' + `anything` to match against objects with buggy `==` definitions. + (Myron Marston, #193) + ### 3.2.2 / 2015-02-23 +[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.2.1...v3.2.2) Bug Fixes: Files old/checksums.yaml.gz and new/checksums.yaml.gz differ Files old/checksums.yaml.gz.sig and new/checksums.yaml.gz.sig differ Files old/data.tar.gz.sig and new/data.tar.gz.sig differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/differ.rb new/lib/rspec/support/differ.rb --- old/lib/rspec/support/differ.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/differ.rb 2015-06-12 17:05:41.000000000 +0200 @@ -1,5 +1,6 @@ RSpec::Support.require_rspec_support 'encoded_string' RSpec::Support.require_rspec_support 'hunk_generator' +RSpec::Support.require_rspec_support "object_formatter" require 'pp' @@ -25,7 +26,7 @@ # rubocop:disable MethodLength def diff_as_string(actual, expected) - encoding = pick_encoding(actual, expected) + encoding = EncodedString.pick_encoding(actual, expected) actual = EncodedString.new(actual, encoding) expected = EncodedString.new(expected, encoding) @@ -59,8 +60,9 @@ diff_as_string(actual_as_string, expected_as_string) end - attr_reader :color - alias_method :color?, :color + def color? + @color + end def initialize(opts={}) @color = opts.fetch(:color, false) @@ -177,12 +179,9 @@ object = @object_preparer.call(object) case object when Hash - object.keys.sort_by { |k| k.to_s }.map do |key| - pp_key = PP.singleline_pp(key, "") - pp_value = PP.singleline_pp(object[key], "") - - "#{pp_key} => #{pp_value}," - end.join("\n") + hash_to_string(object) + when Array + PP.pp(ObjectFormatter.prepare_for_inspection(object), "") when String object =~ /\n/ ? object : object.inspect else @@ -190,13 +189,14 @@ end end - if String.method_defined?(:encoding) - def pick_encoding(source_a, source_b) - Encoding.compatible?(source_a, source_b) || Encoding.default_external - end - else - def pick_encoding(_source_a, _source_b) - end + def hash_to_string(hash) + formatted_hash = ObjectFormatter.prepare_for_inspection(hash) + formatted_hash.keys.sort_by { |k| k.to_s }.map do |key| + pp_key = PP.singleline_pp(key, "") + pp_value = PP.singleline_pp(formatted_hash[key], "") + + "#{pp_key} => #{pp_value}," + end.join("\n") end def handle_encoding_errors(actual, expected) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/directory_maker.rb new/lib/rspec/support/directory_maker.rb --- old/lib/rspec/support/directory_maker.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/directory_maker.rb 2015-06-12 17:05:41.000000000 +0200 @@ -16,6 +16,8 @@ stack = generate_path(stack, part) begin Dir.mkdir(stack) unless directory_exists?(stack) + rescue Errno::EEXIST => e + raise e unless directory_exists?(stack) rescue Errno::ENOTDIR => e raise Errno::EEXIST, e.message end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/encoded_string.rb new/lib/rspec/support/encoded_string.rb --- old/lib/rspec/support/encoded_string.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/encoded_string.rb 2015-06-12 17:05:41.000000000 +0200 @@ -131,8 +131,15 @@ def detect_source_encoding(string) string.encoding end + + def self.pick_encoding(source_a, source_b) + Encoding.compatible?(source_a, source_b) || Encoding.default_external + end else + def self.pick_encoding(_source_a, _source_b) + end + private def matching_encoding(string) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/fuzzy_matcher.rb new/lib/rspec/support/fuzzy_matcher.rb --- old/lib/rspec/support/fuzzy_matcher.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/fuzzy_matcher.rb 2015-06-12 17:05:41.000000000 +0200 @@ -12,7 +12,7 @@ return arrays_match?(expected, actual.to_a) end - return true if actual == expected + return true if expected == actual begin expected === actual diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/object_formatter.rb new/lib/rspec/support/object_formatter.rb --- old/lib/rspec/support/object_formatter.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/rspec/support/object_formatter.rb 2015-06-12 17:05:41.000000000 +0200 @@ -0,0 +1,93 @@ +module RSpec + module Support + # Provide additional output details beyond what `inspect` provides when + # printing Time, DateTime, or BigDecimal + module ObjectFormatter + # @api private + def self.format(object) + prepare_for_inspection(object).inspect + end + + # rubocop:disable MethodLength + + # @private + # Prepares the provided object to be formatted by wrapping it as needed + # in something that, when `inspect` is called on it, will produce the + # desired output. + # + # This allows us to apply the desired formatting to hash/array data structures + # at any level of nesting, simply by walking that structure and replacing items + # with custom items that have `inspect` defined to return the desired output + # for that item. Then we can just use `Array#inspect` or `Hash#inspect` to + # format the entire thing. + def self.prepare_for_inspection(object) + case object + when Array + return object.map { |o| prepare_for_inspection(o) } + when Hash + return prepare_hash(object) + when Time + inspection = format_time(object) + else + if defined?(DateTime) && DateTime === object + inspection = format_date_time(object) + elsif defined?(BigDecimal) && BigDecimal === object + inspection = "#{object.to_s 'F'} (#{object.inspect})" + elsif RSpec::Support.is_a_matcher?(object) && object.respond_to?(:description) + inspection = object.description + else + return object + end + end + + InspectableItem.new(inspection) + end + # rubocop:enable MethodLength + + # @private + def self.prepare_hash(input) + input.inject({}) do |hash, (k, v)| + hash[prepare_for_inspection(k)] = prepare_for_inspection(v) + hash + end + end + + TIME_FORMAT = "%Y-%m-%d %H:%M:%S" + + if Time.method_defined?(:nsec) + # @private + def self.format_time(time) + time.strftime("#{TIME_FORMAT}.#{"%09d" % time.nsec} %z") + end + else # for 1.8.7 + # @private + def self.format_time(time) + time.strftime("#{TIME_FORMAT}.#{"%06d" % time.usec} %z") + end + end + + DATE_TIME_FORMAT = "%a, %d %b %Y %H:%M:%S.%N %z" + # ActiveSupport sometimes overrides inspect. If `ActiveSupport` is + # defined use a custom format string that includes more time precision. + # @private + def self.format_date_time(date_time) + if defined?(ActiveSupport) + date_time.strftime(DATE_TIME_FORMAT) + else + date_time.inspect + end + end + + # @private + InspectableItem = Struct.new(:inspection) do + def inspect + inspection + end + + def pretty_print(pp) + pp.text inspection + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/ruby_features.rb new/lib/rspec/support/ruby_features.rb --- old/lib/rspec/support/ruby_features.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/ruby_features.rb 2015-06-12 17:05:41.000000000 +0200 @@ -1,3 +1,5 @@ +require 'rbconfig' + module RSpec module Support # @api private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/spec/deprecation_helpers.rb new/lib/rspec/support/spec/deprecation_helpers.rb --- old/lib/rspec/support/spec/deprecation_helpers.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/spec/deprecation_helpers.rb 2015-06-12 17:05:41.000000000 +0200 @@ -54,6 +54,10 @@ end end + def expect_no_warnings + expect(::Kernel).not_to receive(:warn) + end + def allow_warning allow(::Kernel).to receive(:warn) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/spec/in_sub_process.rb new/lib/rspec/support/spec/in_sub_process.rb --- old/lib/rspec/support/spec/in_sub_process.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/spec/in_sub_process.rb 2015-06-12 17:05:41.000000000 +0200 @@ -15,7 +15,7 @@ begin yield - warning_preventer.verify_example!(self) if prevent_warnings + warning_preventer.verify_no_warnings! if prevent_warnings rescue Exception => e exception = e end @@ -35,13 +35,18 @@ raise exception if exception end + # rubocop:enable MethodLength + alias :in_sub_process_if_possible :in_sub_process else def in_sub_process(*) skip "This spec requires forking to work properly, " \ "and your platform does not support forking" end + + def in_sub_process_if_possible(*) + yield + end end - # rubocop:enable MethodLength end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/spec/library_wide_checks.rb new/lib/rspec/support/spec/library_wide_checks.rb --- old/lib/rspec/support/spec/library_wide_checks.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/rspec/support/spec/library_wide_checks.rb 2015-06-12 17:05:41.000000000 +0200 @@ -0,0 +1,145 @@ +require 'rspec/support/spec/shell_out' + +RSpec.shared_examples_for "library wide checks" do |lib, options| + consider_a_test_env_file = options.fetch(:consider_a_test_env_file, /MATCHES NOTHING/) + allowed_loaded_feature_regexps = options.fetch(:allowed_loaded_feature_regexps, []) + preamble_for_lib = options[:preamble_for_lib] + preamble_for_spec = "require 'rspec/core'; require 'spec_helper'" + skip_spec_files = options.fetch(:skip_spec_files, /MATCHES NOTHING/) + + include RSpec::Support::ShellOut + + define_method :files_to_require_for do |sub_dir| + slash = File::SEPARATOR + lib_path_re = /#{slash + lib}[^#{slash}]*#{slash}lib/ + load_path = $LOAD_PATH.grep(lib_path_re).first + directory = load_path.sub(/lib$/, sub_dir) + files = Dir["#{directory}/**/*.rb"] + extract_regex = /#{Regexp.escape(directory) + File::SEPARATOR}(.+)\.rb$/ + + # We sort to ensure the files are loaded in a consistent order, regardless + # of OS. Otherwise, it could load in a different order on Travis than + # locally, and potentially trigger a "circular require considered harmful" + # warning or similar. + files.sort.map { |file| file[extract_regex, 1] } + end + + def command_from(code_lines) + code_lines.join("\n") + end + + def load_all_files(files, preamble, postamble=nil) + requires = files.map { |f| "require '#{f}'" } + command = command_from(Array(preamble) + requires + Array(postamble)) + + stdout, stderr, status = with_env 'NO_COVERAGE' => '1' do + options = %w[ -w ] + options << "--disable=gem" if RUBY_VERSION.to_f >= 1.9 && RSpec::Support::Ruby.mri? + run_ruby_with_current_load_path(command, *options) + end + + # Ignore bundler warning. + stderr = stderr.split("\n").reject { |l| l =~ %r{bundler/source/rubygems} }.join("\n") + [stdout, stderr, status.exitstatus] + end + + define_method :load_all_lib_files do + files = all_lib_files - lib_test_env_files + preamble = ['orig_loaded_features = $".dup', preamble_for_lib] + postamble = ['puts(($" - orig_loaded_features).join("\n"))'] + + @loaded_feature_lines, stderr, exitstatus = load_all_files(files, preamble, postamble) + ["", stderr, exitstatus] + end + + define_method :load_all_spec_files do + files = files_to_require_for("spec") + lib_test_env_files + files = files.reject { |f| f =~ skip_spec_files } + load_all_files(files, preamble_for_spec) + end + + attr_reader :all_lib_files, :lib_test_env_files, + :lib_file_results, :spec_file_results + + before(:context) do + @all_lib_files = files_to_require_for("lib") + @lib_test_env_files = all_lib_files.grep(consider_a_test_env_file) + + @lib_file_results, @spec_file_results = [ + # Load them in parallel so it's faster... + Thread.new { load_all_lib_files }, + Thread.new { load_all_spec_files } + ].map(&:join).map(&:value) + end + + def have_successful_no_warnings_output + eq ["", "", 0] + end + + it "issues no warnings when loaded", :slow do + expect(lib_file_results).to have_successful_no_warnings_output + end + + it "issues no warnings when the spec files are loaded", :slow do + expect(spec_file_results).to have_successful_no_warnings_output + end + + it 'only loads a known set of stdlibs so gem authors are forced ' \ + 'to load libs they use to have passing specs', :slow do + loaded_features = @loaded_feature_lines.split("\n") + if RUBY_VERSION == '1.8.7' + # On 1.8.7, $" returns the relative require path if that was used + # to require the file. LIB_REGEX will not match the relative version + # since it has a `/lib` prefix. Here we deal with this by expanding + # relative files relative to the $LOAD_PATH dir (lib). + Dir.chdir("lib") { loaded_features.map! { |f| File.expand_path(f) } } + end + + loaded_features.reject! { |feature| RSpec::CallerFilter::LIB_REGEX =~ feature } + loaded_features.reject! { |feature| allowed_loaded_feature_regexps.any? { |r| r =~ feature } } + + expect(loaded_features).to eq([]) + end + + # This malformed whitespace detection logic has been borrowed from bundler: + # https://github.com/bundler/bundler/blob/v1.8.0/spec/quality_spec.rb + def check_for_tab_characters(filename) + failing_lines = [] + File.readlines(filename).each_with_index do |line, number| + failing_lines << number + 1 if line =~ /\t/ + end + + return if failing_lines.empty? + "#{filename} has tab characters on lines #{failing_lines.join(', ')}" + end + + def check_for_extra_spaces(filename) + failing_lines = [] + File.readlines(filename).each_with_index do |line, number| + next if line =~ /^\s+#.*\s+\n$/ + failing_lines << number + 1 if line =~ /\s+\n$/ + end + + return if failing_lines.empty? + "#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}" + end + + RSpec::Matchers.define :be_well_formed do + match do |actual| + actual.empty? + end + + failure_message do |actual| + actual.join("\n") + end + end + + it "has no malformed whitespace", :slow do + error_messages = [] + `git ls-files -z`.split("\x0").each do |filename| + error_messages << check_for_tab_characters(filename) + error_messages << check_for_extra_spaces(filename) + end + expect(error_messages.compact).to be_well_formed + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/spec/prevent_load_time_warnings.rb new/lib/rspec/support/spec/prevent_load_time_warnings.rb --- old/lib/rspec/support/spec/prevent_load_time_warnings.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/spec/prevent_load_time_warnings.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,56 +0,0 @@ -require 'rspec/support/spec/shell_out' - -module RSpec - module Support - module WarningsPrevention - def files_to_require_for(lib, sub_dir) - slash = File::SEPARATOR - lib_path_re = /#{slash + lib}[^#{slash}]*#{slash}lib/ - load_path = $LOAD_PATH.grep(lib_path_re).first - directory = load_path.sub(/lib$/, sub_dir) - files = Dir["#{directory}/**/*.rb"] - extract_regex = /#{Regexp.escape(directory) + File::SEPARATOR}(.+)\.rb$/ - - # We sort to ensure the files are loaded in a consistent order, regardless - # of OS. Otherwise, it could load in a different order on Travis than - # locally, and potentially trigger a "circular require considered harmful" - # warning or similar. - files.sort.map { |file| file[extract_regex, 1] } - end - end - end -end - -RSpec.shared_examples_for "a library that issues no warnings when loaded" do |lib, *preamble_stmnts| - include RSpec::Support::ShellOut - include RSpec::Support::WarningsPrevention - - define_method :expect_no_warnings_from_files_in do |sub_dir, *pre_stmnts| - # We want to explicitly load every file because each lib has some files that - # aren't automatically loaded, instead being delayed based on an autoload - # (such as for rspec-expectations' matchers) or based on a config option - # (e.g. `config.mock_with :rr` => 'rspec/core/mocking_adapters/rr'). - files_to_require = files_to_require_for(lib, sub_dir) - statements = pre_stmnts + files_to_require.map do |file| - "require '#{file}'" - end - - command = statements.join("; ") - - stdout, stderr, status = with_env 'NO_COVERAGE' => '1' do - run_ruby_with_current_load_path(command, "-w") - end - - expect(stdout).to eq("") - expect(stderr).to eq("") - expect(status.exitstatus).to eq(0) - end - - it "issues no warnings when loaded", :slow do - expect_no_warnings_from_files_in "lib", *preamble_stmnts - end - - it "issues no warnings when the spec files are loaded", :slow do - expect_no_warnings_from_files_in "spec", "require 'rspec/core'; require 'spec_helper'" - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/spec/shell_out.rb new/lib/rspec/support/spec/shell_out.rb --- old/lib/rspec/support/spec/shell_out.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/spec/shell_out.rb 2015-06-12 17:05:41.000000000 +0200 @@ -22,6 +22,9 @@ return stdout, filter(stderr), status end else # 1.8.7 + # popen3 doesn't provide the exit status so we fake it out. + FakeProcessStatus = Struct.new(:exitstatus) + def shell_out(*command) stdout = stderr = nil @@ -30,8 +33,7 @@ stderr = err.read end - # popen3 doesn't provide the exit status so we fake it out. - status = instance_double(Process::Status, :exitstatus => 0) + status = FakeProcessStatus.new(0) return stdout, filter(stderr), status end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/spec/stderr_splitter.rb new/lib/rspec/support/spec/stderr_splitter.rb --- old/lib/rspec/support/spec/stderr_splitter.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/spec/stderr_splitter.rb 2015-06-12 17:05:41.000000000 +0200 @@ -50,8 +50,8 @@ @output_tracker = ::StringIO.new end - def verify_example!(example) - example.send(:fail, "Warnings were generated: #{output}") if has_output? + def verify_no_warnings! + raise "Warnings were generated: #{output}" if has_output? reset! end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/spec/string_matcher.rb new/lib/rspec/support/spec/string_matcher.rb --- old/lib/rspec/support/spec/string_matcher.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/rspec/support/spec/string_matcher.rb 2015-06-12 17:05:41.000000000 +0200 @@ -0,0 +1,46 @@ +require 'rspec/matchers' +# Special matcher for comparing encoded strings so that +# we don't run any expectation failures through the Differ, +# which also relies on EncodedString. Instead, confirm the +# strings have the same bytes. +RSpec::Matchers.define :be_identical_string do |expected| + + if String.method_defined?(:encoding) + match do + expected_encoding? && + actual.bytes.to_a == expected.bytes.to_a + end + + failure_message do + "expected\n#{actual.inspect} (#{actual.encoding.name}) to be identical to\n"\ + "#{expected.inspect} (#{expected.encoding.name})\n"\ + "The exact bytes are printed below for more detail:\n"\ + "#{actual.bytes.to_a}\n"\ + "#{expected.bytes.to_a}\n"\ + end + + # Depends on chaining :with_same_encoding for it to + # check for string encoding. + def expected_encoding? + if defined?(@expect_same_encoding) && @expect_same_encoding + actual.encoding == expected.encoding + else + true + end + end + else + match do + actual.split(//) == expected.split(//) + end + + failure_message do + "expected\n#{actual.inspect} to be identical to\n#{expected.inspect}\n" + end + end + + chain :with_same_encoding do + @expect_same_encoding ||= true + end +end +RSpec::Matchers.alias_matcher :a_string_identical_to, :be_identical_string +RSpec::Matchers.alias_matcher :be_diffed_as, :be_identical_string diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/spec.rb new/lib/rspec/support/spec.rb --- old/lib/rspec/support/spec.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/spec.rb 2015-06-12 17:05:41.000000000 +0200 @@ -1,4 +1,6 @@ require 'rspec/support' +require 'rspec/support/spec/in_sub_process' + RSpec::Support.require_rspec_support "spec/deprecation_helpers" RSpec::Support.require_rspec_support "spec/with_isolated_stderr" RSpec::Support.require_rspec_support "spec/stderr_splitter" @@ -12,14 +14,15 @@ c.include RSpecHelpers c.include RSpec::Support::WithIsolatedStdErr c.include RSpec::Support::FormattingSupport + c.include RSpec::Support::InSubProcess unless defined?(Debugger) # debugger causes warnings when used c.before do warning_preventer.reset! end - c.after do |example| - warning_preventer.verify_example!(example) + c.after do + warning_preventer.verify_no_warnings! end end @@ -30,6 +33,7 @@ c.filter_run :focus c.run_all_when_everything_filtered = true + c.example_status_persistence_file_path = "./spec/examples.txt" c.define_derived_metadata :failing_on_appveyor do |meta| meta[:pending] ||= "This spec fails on AppVeyor and needs someone to fix it." @@ -43,7 +47,8 @@ # Simplecov emits some ruby warnings when loaded, so silence them. old_verbose, $VERBOSE = $VERBOSE, false - return if ENV['NO_COVERAGE'] || RUBY_VERSION < '1.9.3' || RUBY_ENGINE != 'ruby' + return if ENV['NO_COVERAGE'] || RUBY_VERSION < '1.9.3' + return if RUBY_ENGINE != 'ruby' || RSpec::Support::OS.windows? # Don't load it when we're running a single isolated # test file rather than the whole suite. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support/version.rb new/lib/rspec/support/version.rb --- old/lib/rspec/support/version.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support/version.rb 2015-06-12 17:05:41.000000000 +0200 @@ -1,7 +1,7 @@ module RSpec module Support module Version - STRING = '3.2.2' + STRING = '3.3.0' end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/support.rb new/lib/rspec/support.rb --- old/lib/rspec/support.rb 2015-02-24 04:35:55.000000000 +0100 +++ new/lib/rspec/support.rb 2015-06-12 17:05:41.000000000 +0200 @@ -72,5 +72,40 @@ end end end + + # A single thread local variable so we don't excessively pollute that namespace. + def self.thread_local_data + Thread.current[:__rspec] ||= {} + end + + def self.failure_notifier=(callable) + thread_local_data[:failure_notifier] = callable + end + + # @private + DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure } + + def self.failure_notifier + thread_local_data[:failure_notifier] || DEFAULT_FAILURE_NOTIFIER + end + + def self.notify_failure(failure, options={}) + failure_notifier.call(failure, options) + end + + def self.with_failure_notifier(callable) + orig_notifier = failure_notifier + self.failure_notifier = callable + yield + ensure + self.failure_notifier = orig_notifier + end + + # The Differ is only needed when a a spec fails with a diffable failure. + # In the more common case of all specs passing or the only failures being + # non-diffable, we can avoid the extra cost of loading the differ, diff-lcs, + # pp, etc by avoiding an unnecessary require. Instead, autoload will take + # care of loading the differ on first use. + autoload :Differ, "rspec/support/differ" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-02-24 04:35:55.000000000 +0100 +++ new/metadata 2015-06-12 17:05:41.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: rspec-support version: !ruby/object:Gem::Version - version: 3.2.2 + version: 3.3.0 platform: ruby authors: - David Chelimsky @@ -48,7 +48,7 @@ ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ F3MdtaDehhjC -----END CERTIFICATE----- -date: 2015-02-24 00:00:00.000000000 Z +date: 2015-06-12 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler @@ -96,15 +96,17 @@ - lib/rspec/support/hunk_generator.rb - lib/rspec/support/matcher_definition.rb - lib/rspec/support/method_signature_verifier.rb +- lib/rspec/support/object_formatter.rb - lib/rspec/support/recursive_const_methods.rb - lib/rspec/support/ruby_features.rb - lib/rspec/support/spec.rb - lib/rspec/support/spec/deprecation_helpers.rb - lib/rspec/support/spec/formatting_support.rb - lib/rspec/support/spec/in_sub_process.rb -- lib/rspec/support/spec/prevent_load_time_warnings.rb +- lib/rspec/support/spec/library_wide_checks.rb - lib/rspec/support/spec/shell_out.rb - lib/rspec/support/spec/stderr_splitter.rb +- lib/rspec/support/spec/string_matcher.rb - lib/rspec/support/spec/with_isolated_directory.rb - lib/rspec/support/spec/with_isolated_stderr.rb - lib/rspec/support/version.rb @@ -130,9 +132,9 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubyforge_project: rspec +rubyforge_project: rubygems_version: 2.2.2 signing_key: specification_version: 4 -summary: rspec-support-3.2.2 +summary: rspec-support-3.3.0 test_files: [] Files old/metadata.gz.sig and new/metadata.gz.sig differ