Skip to content

Commit

Permalink
Update FillMurray Links To Include www (#1660)
Browse files Browse the repository at this point in the history
* Update FillMurray Links To Include www

* Faker::Number.decimal_part should return string for now
  • Loading branch information
RaymondFallon authored and vbrazo committed Jul 24, 2019
1 parent 57ccfbc commit 748adef
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions doc/default/fillmurray.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
2 changes: 1 addition & 1 deletion lib/faker/default/fillmurray.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/default/number.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/faker/default/test_faker_fillmurray.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 748adef

Please sign in to comment.