File: 0003-tests-turn-relative-paths-into-absolute-ones.patch

package info (click to toggle)
ruby-faker 1.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,088 kB
  • sloc: ruby: 11,588; makefile: 6
file content (71 lines) | stat: -rw-r--r-- 2,631 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From: Antonio Terceiro <terceiro@debian.org>
Date: Sat, 2 Feb 2019 13:27:36 -0200
Subject: tests: turn relative paths into absolute ones

This fixes the tests to run against the installed package
---
 test/test_en_locale.rb | 2 +-
 test/test_es_locale.rb | 2 +-
 test/test_helper.rb    | 4 ++--
 test/test_locale.rb    | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/test_en_locale.rb b/test/test_en_locale.rb
index 02a656b..0ffcb7a 100644
--- a/test/test_en_locale.rb
+++ b/test/test_en_locale.rb
@@ -30,7 +30,7 @@ class TestEnLocale < Test::Unit::TestCase
   end
 
   def test_values_trimmed
-    en_file = YAML.load_file('lib/locales/en.yml')
+    en_file = YAML.load_file("#{$locales_path}/en.yml")
     check_hash(en_file)
   end
 
diff --git a/test/test_es_locale.rb b/test/test_es_locale.rb
index 1a692fe..f842b31 100644
--- a/test/test_es_locale.rb
+++ b/test/test_es_locale.rb
@@ -1,7 +1,7 @@
 require_relative 'test_helper'
 
 LoadedEsYaml = %w[en es].each_with_object({}) do |locale, h|
-  h[locale] = YAML.load_file(File.expand_path(File.dirname(__FILE__) + "/../lib/locales/#{locale}.yml"))[locale]['faker']
+  h[locale] = YAML.load_file("#{$locales_path}/#{locale}.yml")[locale]['faker']
 end
 
 class TestEsLocale < Test::Unit::TestCase
diff --git a/test/test_helper.rb b/test/test_helper.rb
index ec00bfc..ac910ce 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -11,13 +11,13 @@ require 'yaml'
 require 'pathname'
 
 YAML::ENGINE.yamler = 'psych' if defined? YAML::ENGINE
-require File.expand_path(File.dirname(__FILE__) + '/../lib/faker')
+require 'faker'
 
 # configure I18n
-locales_path = File.expand_path(File.dirname(__FILE__) + '../lib/locales')
 relative_locales_path = File.expand_path(File.dirname(__FILE__) + '../lib/locales')
 system_locales_path = File.expand_path(File.join(File.dirname(`gem which faker`),'locales'))
 locales_path = Pathname.new(relative_locales_path).directory? ? relative_locales_path : system_locales_path
+$locales_path = locales_path
 I18n.available_locales = Dir[locales_path + '/*'].map do |file|
   file.split('.').first
 end
diff --git a/test/test_locale.rb b/test/test_locale.rb
index c3dfc5c..99eaf6f 100644
--- a/test/test_locale.rb
+++ b/test/test_locale.rb
@@ -1,7 +1,7 @@
 require_relative 'test_helper'
 
 LoadedYaml = ['en', 'en-BORK'].each_with_object({}) do |locale, h|
-  h[locale] = YAML.load_file(File.expand_path(File.dirname(__FILE__) + "/../lib/locales/#{locale}.yml"))[locale]['faker']
+  h[locale] = YAML.load_file("#{$locales_path}/#{locale}.yml")[locale]['faker']
 end
 
 class TestLocale < Test::Unit::TestCase