tests: fix broken tests.

This commit is contained in:
evazion
2020-08-05 12:41:17 -05:00
parent 56a4e58510
commit e31afd0827
3 changed files with 9 additions and 5 deletions

View File

@@ -34,10 +34,12 @@ class EmailsControllerTest < ActionDispatch::IntegrationTest
context "for a user without an email address" do
should "render" do
@user.email_address.destroy!
@user.reload_email_address
get_auth edit_user_email_path(@user), @user
assert_equal false, @user.email_address.present?
assert_response :success
assert_select "h1", text: "Add Email"
end
end

View File

@@ -142,9 +142,11 @@ class PostTest < ActiveSupport::TestCase
end
should "fail" do
@post.delete!("test")
assert_equal(["Is status locked ; cannot delete post"], @post.errors.full_messages)
assert_equal(1, Post.where("id = ?", @post.id).count)
assert_raise(ActiveRecord::RecordInvalid) do
@post.delete!("test")
end
assert_equal(false, @post.reload.is_deleted?)
end
end

View File

@@ -221,8 +221,8 @@ module Sources
context "A Tumblr post with new image URLs" do
should "return the correct image url" do
page_url = "https://emlan.tumblr.com/post/189469423572/kuro-attempts-to-buy-a-racy-book-at-comiket-but"
image1_url = "https://66.media.tumblr.com/168dabd09d5ad69eb5fedcf94c45c31a/3dbfaec9b9e0c2e3-72/s640x960/bf33a1324f3f36d2dc64f011bfeab4867da62bc8.png"
image2_url = "https://66.media.tumblr.com/5a2c3fe25c977e2281392752ab971c90/3dbfaec9b9e0c2e3-92/s540x810/cd270c29db06b5e7fdcee63114fe3eb2c9c0d590.png"
image1_url = "https://64.media.tumblr.com/168dabd09d5ad69eb5fedcf94c45c31a/3dbfaec9b9e0c2e3-72/s640x960/bf33a1324f3f36d2dc64f011bfeab4867da62bc8.png"
image2_url = "https://64.media.tumblr.com/5a2c3fe25c977e2281392752ab971c90/3dbfaec9b9e0c2e3-92/s540x810/cd270c29db06b5e7fdcee63114fe3eb2c9c0d590.png"
strategy = Sources::Strategies.find(image2_url, page_url)
assert_equal([image1_url, image2_url], strategy.image_urls)