Merge pull request #1120 from Retrospring/fix/no-fog-in-tests

Disable fog in tests
This commit is contained in:
Karina Kwiatek 2023-03-06 08:58:50 +01:00 committed by GitHub
commit 3e22af6966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 8 deletions

View File

@ -5,9 +5,18 @@ require "rails_helper"
describe Settings::ProfilePictureController, type: :controller do
describe "#update" do
subject { patch :update, params: { user: avatar_params } }
before do
if ENV["USE_FOG_IN_TESTS"].blank?
stub_const("APP_CONFIG", {
"fog" => {},
})
end
end
let(:avatar_params) do
{
profile_picture: fixture_file_upload("banana_racc.jpg", "image/jpeg")
profile_picture: fixture_file_upload("banana_racc.jpg", "image/jpeg"),
}
end
@ -18,7 +27,7 @@ describe Settings::ProfilePictureController, type: :controller do
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")
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

View File

@ -3,6 +3,14 @@
require "rails_helper"
describe UseCase::DataExport::User, :data_export do
before do
if ENV["USE_FOG_IN_TESTS"].blank?
stub_const("APP_CONFIG", {
"fog" => {},
})
end
end
let(:user_params) do
{
email: "fizzyraccoon@bsnss.biz",
@ -35,8 +43,8 @@ describe UseCase::DataExport::User, :data_export do
location: "Binland",
motivation_header: "",
website: "https://retrospring.net",
allow_long_questions: true
}
allow_long_questions: true,
},
}
end
@ -91,7 +99,7 @@ describe UseCase::DataExport::User, :data_export do
privacy_noindex: false,
sharing_enabled: false,
sharing_autoclose: false,
sharing_custom_url: nil
sharing_custom_url: nil,
},
profile: {
display_name: "Fizzy Raccoon",
@ -102,12 +110,12 @@ describe UseCase::DataExport::User, :data_export do
created_at: user.profile.created_at.as_json,
updated_at: user.profile.updated_at.as_json,
anon_display_name: nil,
allow_long_questions: true
allow_long_questions: true,
},
roles: {
administrator: false,
moderator: false
}
moderator: false,
},
}
)
end