sources: remove image_url method from base strategy.
Remove the `image_url` method from source strategies. This method would return only the first image if a source had multiple images. The `image_urls` method should be used instead. Tests were the main place that still used `image_url` instead of `image_urls`. Also make post replacements return an error if replacing with a source that contains multiple images, instead of just blindly replacing the post with the first image in the source.
This commit is contained in:
@@ -36,7 +36,7 @@ module Sources
|
||||
end
|
||||
|
||||
should "download the full-size image" do
|
||||
assert_downloaded(2_739_443, @source.image_url)
|
||||
assert_downloaded(2_739_443, @source.image_urls.sole)
|
||||
end
|
||||
|
||||
should "find the correct artist" do
|
||||
@@ -57,7 +57,7 @@ module Sources
|
||||
context "A bad link" do
|
||||
should "correctly get the full size" do
|
||||
source = Sources::Strategies.find("https://imglf4.lf127.net/img/S1d2QlVsWkJhSW1qcnpIS0ZSa3ZJUFczb2RKSVlpMHJkNy9kc3BSQVQvQm5DNzB4eVhxay9nPT0.png?imageView&thumbnail=1680x0&quality=96&stripmeta=0")
|
||||
assert_equal("https://imglf4.lf127.net/img/S1d2QlVsWkJhSW1qcnpIS0ZSa3ZJUFczb2RKSVlpMHJkNy9kc3BSQVQvQm5DNzB4eVhxay9nPT0.png", source.image_url)
|
||||
assert_equal(["https://imglf4.lf127.net/img/S1d2QlVsWkJhSW1qcnpIS0ZSa3ZJUFczb2RKSVlpMHJkNy9kc3BSQVQvQm5DNzB4eVhxay9nPT0.png"], source.image_urls)
|
||||
assert_nothing_raised { source.to_h }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user