require "test_helper"

class UserAvatarHelperTest < ActionView::TestCase
  test "attach avatar should work" do
    user_3 = users(:user_3)
    assert_equal false, user_3.avatar.attached?
    user_3.avatar.attach(
      io: File.open(Rails.root.join("test/fixtures/files/main_bg.png")),
      filename: "avatar.png",
      content_type: "image/png",
      identify: false
    )
    image_tag_s = image_tag(user_3.avatar.variant(:thumb))
    assert_equal true, image_tag_s.include?("/rails/active_storage/representations/redirect/")
  end
end
