Retrospring/spec/controllers/settings/profile_picture_controller_...

38 lines
922 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "rails_helper"
describe Settings::ProfilePictureController, type: :controller do
describe "#update" do
subject { patch :update, params: { user: avatar_params } }
2023-03-05 04:53:27 -08:00
before do
stub_const("APP_CONFIG", {
"fog" => {}
})
end
let(:avatar_params) do
{
profile_picture: fixture_file_upload("banana_racc.jpg", "image/jpeg")
}
end
let(:user) { FactoryBot.create :user }
context "user signed in" do
before(:each) { sign_in user }
it "enqueues a Sidekiq job to process the uploaded profile picture" do
subject
expect(::CarrierWave::Workers::ProcessAsset).to have_enqueued_sidekiq_job("User", user.id.to_s, "profile_picture")
end
it "redirects to the edit_user_profile page" do
subject
expect(response).to redirect_to(:settings_profile)
end
end
end
2022-06-26 11:27:38 -07:00
end