From 976d4a9e9157414642de869ea1289bc2dc0bda83 Mon Sep 17 00:00:00 2001 From: Andy Mikula Date: Thu, 13 Oct 2016 09:25:44 -0600 Subject: [PATCH 1/2] Resolve warnings during tests --- lib/faker/code.rb | 8 ++++---- lib/faker/company.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/faker/code.rb b/lib/faker/code.rb index 4db910a4da..8cfbc7d51d 100644 --- a/lib/faker/code.rb +++ b/lib/faker/code.rb @@ -77,9 +77,9 @@ def generate_imei # Calculate the Luhn checksum of the values thus far len_offset = (len + 1) % 2 - (0..(len - 1)).each do |pos| - if (pos + len_offset) % 2 != 0 - t = str[pos] * 2 + (0..(len - 1)).each do |position| + if (position + len_offset) % 2 != 0 + t = str[position] * 2 if t > 9 t -= 9 @@ -87,7 +87,7 @@ def generate_imei sum += t else - sum += str[pos] + sum += str[position] end end diff --git a/lib/faker/company.rb b/lib/faker/company.rb index bc777df551..3055ae656e 100644 --- a/lib/faker/company.rb +++ b/lib/faker/company.rb @@ -69,8 +69,8 @@ def luhn_algorithm(number) multiplications << digit.to_i * 2 else multiplications << digit.to_i + end end - end sum = 0 From e042de3541e5001a6f126b8e661bb72fd95f747b Mon Sep 17 00:00:00 2001 From: Andy Mikula Date: Thu, 13 Oct 2016 10:39:50 -0600 Subject: [PATCH 2/2] Use psych instead of syck --- test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index dcbd0846f1..13a7a6577f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,7 +2,7 @@ require 'rubygems' require 'timecop' require 'yaml' -YAML::ENGINE.yamler = 'syck' if defined? YAML::ENGINE +YAML::ENGINE.yamler = 'psych' if defined? YAML::ENGINE require File.expand_path(File.dirname(__FILE__) + '/../lib/faker') # configure I18n