Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FillMurray Links To Include www #1660

Merged
merged 5 commits into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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