2022-07-01 21:26:39 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "rails_helper"
|
|
|
|
|
|
|
|
describe Settings::ExportController, type: :controller do
|
|
|
|
describe "#index" do
|
|
|
|
subject { get :index }
|
|
|
|
|
|
|
|
context "user signed in" do
|
|
|
|
let(:user) { FactoryBot.create(:user) }
|
|
|
|
|
|
|
|
before { sign_in user }
|
|
|
|
|
|
|
|
it "renders the index template" do
|
|
|
|
subject
|
|
|
|
expect(response).to render_template(:index)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-07-02 05:51:25 -07:00
|
|
|
|
|
|
|
describe "#create" do
|
|
|
|
subject { post :create }
|
|
|
|
|
|
|
|
context "user signed in" do
|
|
|
|
let(:user) { FactoryBot.create(:user) }
|
|
|
|
|
|
|
|
before { sign_in user }
|
|
|
|
|
|
|
|
it "enqueues an ExportWorker job" do
|
|
|
|
subject
|
|
|
|
expect(ExportWorker).to have_enqueued_sidekiq_job(user.id)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "redirects to the export page" do
|
|
|
|
subject
|
|
|
|
expect(response).to redirect_to(:settings_export)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-07-01 21:26:39 -07:00
|
|
|
end
|