1
0
mirror of https://github.com/danbee/my-images synced 2025-03-04 08:49:05 +00:00
my-images/spec/features/user_manages_image_spec.rb

44 lines
942 B
Ruby

require "rails_helper"
feature "user manages images" do
include ActiveJob::TestHelper
it "uploads the image" do
stub_clarifai(%w[computer technology])
sign_in
attach_file("Image", "#{Rails.root}/spec/fixtures/spectrum.jpg")
click_on("Create Image")
expect(page).to have_css(".image")
end
it "deletes the image" do
user = User.create(uid: "1")
Image.create(
user: user,
image: File.new("#{Rails.root}/spec/fixtures/spectrum.jpg"),
)
sign_in(user)
click_on("Delete")
expect(page).not_to have_css(".image")
end
it "views the image with tags" do
stub_clarifai(%w[computer technology])
sign_in
attach_file("Image", "#{Rails.root}/spec/fixtures/spectrum.jpg")
perform_enqueued_jobs do
click_on("Create Image")
end
page.find(".image").click
%w[computer technology].each do |tag|
expect(page).to have_content(tag)
end
end
end