Blame SOURCES/rubygem-activesupport-5.0.0-DRY-Downloader.patch

72d67b
From 7d7c2d13ba896dd8b58fe91d2fe0c4fc588069ca Mon Sep 17 00:00:00 2001
72d67b
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
72d67b
Date: Mon, 4 Jul 2016 13:11:44 +0200
72d67b
Subject: [PATCH 1/2] DRY Downloader.
72d67b
72d67b
---
72d67b
 activesupport/test/multibyte_conformance_test.rb      | 18 ------------------
72d67b
 .../test/multibyte_grapheme_break_conformance_test.rb | 19 ++-----------------
72d67b
 .../test/multibyte_normalization_conformance_test.rb  | 18 ------------------
72d67b
 activesupport/test/multibyte_test_helpers.rb          | 18 ++++++++++++++++++
72d67b
 4 files changed, 20 insertions(+), 53 deletions(-)
72d67b
72d67b
diff --git a/activesupport/test/multibyte_conformance_test.rb b/activesupport/test/multibyte_conformance_test.rb
72d67b
index 9fca47a..709c63a 100644
72d67b
--- a/activesupport/test/multibyte_conformance_test.rb
72d67b
+++ b/activesupport/test/multibyte_conformance_test.rb
72d67b
@@ -6,24 +6,6 @@
72d67b
 require 'tmpdir'
72d67b
 
72d67b
 class MultibyteConformanceTest < ActiveSupport::TestCase
72d67b
-  class Downloader
72d67b
-    def self.download(from, to)
72d67b
-      unless File.exist?(to)
72d67b
-        unless File.exist?(File.dirname(to))
72d67b
-          system "mkdir -p #{File.dirname(to)}"
72d67b
-        end
72d67b
-        open(from) do |source|
72d67b
-          File.open(to, 'w') do |target|
72d67b
-            source.each_line do |l|
72d67b
-              target.write l
72d67b
-            end
72d67b
-          end
72d67b
-        end
72d67b
-      end
72d67b
-      true
72d67b
-    end
72d67b
-  end
72d67b
-
72d67b
   include MultibyteTestHelpers
72d67b
 
72d67b
   UNIDATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::Unicode::UNICODE_VERSION}/ucd"
72d67b
diff --git a/activesupport/test/multibyte_grapheme_break_conformance_test.rb b/activesupport/test/multibyte_grapheme_break_conformance_test.rb
72d67b
index 6e2f02a..45e1976 100644
72d67b
--- a/activesupport/test/multibyte_grapheme_break_conformance_test.rb
72d67b
+++ b/activesupport/test/multibyte_grapheme_break_conformance_test.rb
72d67b
@@ -1,29 +1,14 @@
72d67b
 # encoding: utf-8
72d67b
 
72d67b
 require 'abstract_unit'
72d67b
+require 'multibyte_test_helpers'
72d67b
 
72d67b
 require 'fileutils'
72d67b
 require 'open-uri'
72d67b
 require 'tmpdir'
72d67b
 
72d67b
 class MultibyteGraphemeBreakConformanceTest < ActiveSupport::TestCase
72d67b
-  class Downloader
72d67b
-    def self.download(from, to)
72d67b
-      unless File.exist?(to)
72d67b
-        $stderr.puts "Downloading #{from} to #{to}"
72d67b
-        unless File.exist?(File.dirname(to))
72d67b
-          system "mkdir -p #{File.dirname(to)}"
72d67b
-        end
72d67b
-        open(from) do |source|
72d67b
-          File.open(to, 'w') do |target|
72d67b
-            source.each_line do |l|
72d67b
-              target.write l
72d67b
-            end
72d67b
-          end
72d67b
-        end
72d67b
-      end
72d67b
-    end
72d67b
-  end
72d67b
+  include MultibyteTestHelpers
72d67b
 
72d67b
   TEST_DATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::Unicode::UNICODE_VERSION}/ucd/auxiliary"
72d67b
   TEST_DATA_FILE = '/GraphemeBreakTest.txt'
72d67b
diff --git a/activesupport/test/multibyte_normalization_conformance_test.rb b/activesupport/test/multibyte_normalization_conformance_test.rb
72d67b
index 0d31c95..ad2e651 100644
72d67b
--- a/activesupport/test/multibyte_normalization_conformance_test.rb
72d67b
+++ b/activesupport/test/multibyte_normalization_conformance_test.rb
72d67b
@@ -8,24 +8,6 @@
72d67b
 require 'tmpdir'
72d67b
 
72d67b
 class MultibyteNormalizationConformanceTest < ActiveSupport::TestCase
72d67b
-  class Downloader
72d67b
-    def self.download(from, to)
72d67b
-      unless File.exist?(to)
72d67b
-        $stderr.puts "Downloading #{from} to #{to}"
72d67b
-        unless File.exist?(File.dirname(to))
72d67b
-          system "mkdir -p #{File.dirname(to)}"
72d67b
-        end
72d67b
-        open(from) do |source|
72d67b
-          File.open(to, 'w') do |target|
72d67b
-            source.each_line do |l|
72d67b
-              target.write l
72d67b
-            end
72d67b
-          end
72d67b
-        end
72d67b
-      end
72d67b
-    end
72d67b
-  end
72d67b
-
72d67b
   include MultibyteTestHelpers
72d67b
 
72d67b
   UNIDATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::Unicode::UNICODE_VERSION}/ucd"
72d67b
diff --git a/activesupport/test/multibyte_test_helpers.rb b/activesupport/test/multibyte_test_helpers.rb
72d67b
index 58cf548..709586e 100644
72d67b
--- a/activesupport/test/multibyte_test_helpers.rb
72d67b
+++ b/activesupport/test/multibyte_test_helpers.rb
72d67b
@@ -1,4 +1,22 @@
72d67b
 module MultibyteTestHelpers
72d67b
+  class Downloader
72d67b
+    def self.download(from, to)
72d67b
+      unless File.exist?(to)
72d67b
+        unless File.exist?(File.dirname(to))
72d67b
+          system "mkdir -p #{File.dirname(to)}"
72d67b
+        end
72d67b
+        open(from) do |source|
72d67b
+          File.open(to, 'w') do |target|
72d67b
+            source.each_line do |l|
72d67b
+              target.write l
72d67b
+            end
72d67b
+          end
72d67b
+        end
72d67b
+      end
72d67b
+      true
72d67b
+    end
72d67b
+  end
72d67b
+
72d67b
   UNICODE_STRING = 'こにちわ'.freeze
72d67b
   ASCII_STRING = 'ohayo'.freeze
72d67b
   BYTE_STRING = "\270\236\010\210\245".force_encoding("ASCII-8BIT").freeze
72d67b
-- 
72d67b
2.9.0
72d67b