diff --git a/doc/default/fillmurray.md b/doc/default/fillmurray.md index e69e640511..87963f059f 100644 --- a/doc/default/fillmurray.md +++ b/doc/default/fillmurray.md @@ -3,9 +3,9 @@ Available since version 1.7.1. ```ruby -Faker::Fillmurray.image #=> "http://fillmurray.com/300/300" +Faker::Fillmurray.image #=> "http://www.fillmurray.com/300/300" -Faker::Fillmurray.image(true) #=> "http://fillmurray.com/g/300/300" +Faker::Fillmurray.image(true) #=> "http://www.fillmurray.com/g/300/300" -Faker::Fillmurray.image(false, 200, 400) #=> "http://fillmurray.com/200/400" +Faker::Fillmurray.image(false, 200, 400) #=> "http://www.fillmurray.com/200/400" ``` diff --git a/lib/faker/default/fillmurray.rb b/lib/faker/default/fillmurray.rb index 433dd8b93e..2d8172f97d 100644 --- a/lib/faker/default/fillmurray.rb +++ b/lib/faker/default/fillmurray.rb @@ -8,7 +8,7 @@ def image(grayscale = false, width = 200, height = 200) raise ArgumentError, 'Height should be a number' unless height.to_s =~ /^\d+$/ raise ArgumentError, 'Grayscale should be a boolean' unless [true, false].include?(grayscale) - grayscale == true ? "https://fillmurray.com/g/#{width}/#{height}" : "https://fillmurray.com/#{width}/#{height}" + "https://www.fillmurray.com#{'/g' if grayscale == true}/#{width}/#{height}" end end end diff --git a/lib/faker/default/number.rb b/lib/faker/default/number.rb index c5eb99341a..1d1532145a 100644 --- a/lib/faker/default/number.rb +++ b/lib/faker/default/number.rb @@ -21,7 +21,7 @@ def decimal_part(digits = 10) num = non_zero_digit digits -= 1 end - leading_zero_number(digits) + num + leading_zero_number(digits) + num.to_s end def decimal(l_digits = 5, r_digits = 2) diff --git a/test/faker/default/test_faker_fillmurray.rb b/test/faker/default/test_faker_fillmurray.rb index e10486079d..c73b0d75e8 100644 --- a/test/faker/default/test_faker_fillmurray.rb +++ b/test/faker/default/test_faker_fillmurray.rb @@ -8,11 +8,11 @@ def setup end def test_fillmurray - assert !@tester.image(false, '300', '300').match(%r{https:\/\/fillmurray\.com\/(\d+)\/(\d+)}).nil? + assert !@tester.image(false, '300', '300').match(%r{https:\/\/www\.fillmurray\.com\/(\d+)\/(\d+)}).nil? end def test_fillmurray_with_grayscale - assert @tester.image(true, '300', '300').match(%r{https:\/\/fillmurray\.com\/(g?\/?)(\d+)\/(\d+)})[1] == 'g/' + assert @tester.image(true, '300', '300').match(%r{https:\/\/www\.fillmurray\.com\/(g?\/?)(\d+)\/(\d+)})[1] == 'g/' end def test_fillmurray_with_incorrect_height_format