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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.0 KiB
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
if ENV["USE_FOG_IN_TESTS"].blank?
stub_const("APP_CONFIG", {
"fog" => {},
})
end
2023-03-05 04:53:27 -08:00
end
let(:avatar_params) do
{
2023-03-05 05:06:16 -08:00
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
2023-03-05 05:06:16 -08:00
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 have_http_status(:ok)
expect(response).to have_rendered(:edit)
end
end
end
2022-06-26 11:27:38 -07:00
end