From 795bac44fd0191a7927e09337c9e13718af56dc1 Mon Sep 17 00:00:00 2001 From: ysksn Date: Thu, 13 Dec 2018 10:53:52 +0900 Subject: Add spec for Settings::ExportsController#create (#9512) --- .../controllers/settings/exports_controller_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'spec') diff --git a/spec/controllers/settings/exports_controller_spec.rb b/spec/controllers/settings/exports_controller_spec.rb index b7cab4d8f..a46fe095d 100644 --- a/spec/controllers/settings/exports_controller_spec.rb +++ b/spec/controllers/settings/exports_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' describe Settings::ExportsController do @@ -28,4 +30,23 @@ describe Settings::ExportsController do end end end + + describe 'POST #create' do + before do + sign_in Fabricate(:user), scope: :user + end + + it 'redirects to settings_export_path' do + post :create + expect(response).to redirect_to(settings_export_path) + end + + it 'queues BackupWorker job by 1' do + Sidekiq::Testing.fake! do + expect do + post :create + end.to change(BackupWorker.jobs, :size).by(1) + end + end + end end -- cgit