add spec for trying to create TOS with no file

This commit is contained in:
Andy Brett
2021-05-03 14:04:32 -07:00
committed by Maikel Linke
parent 3e2f81d640
commit a4bb697787

View File

@@ -0,0 +1,19 @@
# frozen_string_literal: true
require 'spec_helper'
describe Admin::TermsOfServiceFilesController, type: :controller do
let(:user) { create(:admin_user) }
before do
allow(controller).to receive(:spree_current_user) { user }
end
describe "trying to create terms of service without a file" do
it "redirects and show an error" do
post :create, params: {}
expect(response).to redirect_to admin_terms_of_service_files_path
expect(flash[:error]).to eq I18n.t(".admin.terms_of_service_files.create.select_file")
end
end
end