OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
lint spec and remove unnecessary view rendering
ulferts53d78f905e3f
diff --git a/spec/controllers/custom_styles_controller_spec.rb b/spec/controllers/custom_styles_controller_spec.rbindex 75dd1c68ade..07960f0aceb 100644--- a/spec/controllers/custom_styles_controller_spec.rb+++ b/spec/controllers/custom_styles_controller_spec.rb@@ -39,8 +39,6 @@ RSpec.describe CustomStylesController dodescribe '#show' dosubject { get :show }- render_views-context 'when active token exists', with_ee: %i[define_custom_style] doit 'renders show' doexpect(subject).to be_successful@@ -62,8 +60,6 @@ RSpec.describe CustomStylesController dodescribe "#upsale" dosubject { get :upsale }- render_views-it 'renders upsale' doexpect(subject).to be_successfulexpect(subject).to render_template 'upsale'@@ -79,13 +75,13 @@ RSpec.describe CustomStylesController doendbefore do- expect(CustomStyle).to receive(:create).and_return(custom_style)- expect(custom_style).to receive(:valid?).and_return(valid)+ allow(CustomStyle).to receive(:create).and_return(custom_style)+ allow(custom_style).to receive(:valid?).and_return(valid)post :create, params:end- context 'valid custom_style input' do+ context 'with valid custom_style input' dolet(:valid) { true }it 'redirects to show' do@@ -93,7 +89,7 @@ RSpec.describe CustomStylesController doendend- context 'invalid custom_style input' do+ context 'with invalid custom_style input' dolet(:valid) { false }it 'renders with error' do@@ -113,13 +109,13 @@ RSpec.describe CustomStylesController docontext 'with an existing CustomStyle' dobefore do- expect(CustomStyle).to receive(:current).and_return(custom_style)- expect(custom_style).to receive(:update).and_return(valid)+ allow(CustomStyle).to receive(:current).and_return(custom_style)+ allow(custom_style).to receive(:update).and_return(valid)post :update, params:end- context 'valid custom_style input' do+ context 'with valid custom_style input' dolet(:valid) { true }it 'redirects to show' do@@ -127,7 +123,7 @@ RSpec.describe CustomStylesController doendend- context 'invalid custom_style input' do+ context 'with invalid custom_style input' dolet(:valid) { false }it 'renders with error' do@@ -139,13 +135,13 @@ RSpec.describe CustomStylesController docontext 'without an existing CustomStyle' dobefore do- expect(CustomStyle).to receive(:create!).and_return(custom_style)- expect(custom_style).to receive(:update).and_return(valid)+ allow(CustomStyle).to receive(:create!).and_return(custom_style)+ allow(custom_style).to receive(:update).and_return(valid)post :update, params:end- context 'valid custom_style input' do+ context 'with valid custom_style input' dolet(:valid) { true }it 'redirects to show' do@@ -153,7 +149,7 @@ RSpec.describe CustomStylesController doendend- context 'invalid custom_style input' do+ context 'with invalid custom_style input' dolet(:valid) { false }it 'renders with error' do@@ -165,10 +161,8 @@ RSpec.describe CustomStylesController doenddescribe "#logo_download" do- render_views-before do- expect(CustomStyle).to receive(:current).and_return(custom_style)+ allow(CustomStyle).to receive(:current).and_return(custom_style)allow(controller).to receive(:send_file) { controller.head 200 }get :logo_download, params: { digest: "1234", filename: "logo_image.png" }end@@ -185,7 +179,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { nil }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend@@ -194,7 +188,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { build_stubbed(:custom_style) }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend@@ -205,8 +199,8 @@ RSpec.describe CustomStylesController docontext 'if it exists' dobefore do- expect(CustomStyle).to receive(:current).and_return(custom_style)- expect(custom_style).to receive(:remove_logo).and_call_original+ allow(CustomStyle).to receive(:current).and_return(custom_style)+ allow(custom_style).to receive(:remove_logo).and_call_originaldelete :logo_deleteend@@ -217,7 +211,7 @@ RSpec.describe CustomStylesController docontext 'if it does not exist' dobefore do- expect(CustomStyle).to receive(:current).and_return(nil)+ allow(CustomStyle).to receive(:current).and_return(nil)delete :logo_deleteend@@ -228,10 +222,8 @@ RSpec.describe CustomStylesController doenddescribe "#export_logo_download" do- render_views-before do- expect(CustomStyle).to receive(:current).and_return(custom_style)+ allow(CustomStyle).to receive(:current).and_return(custom_style)allow(controller).to receive(:send_file) { controller.head 200 }get :export_logo_download, params: { digest: "1234", filename: "export_logo_image.png" }end@@ -248,7 +240,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { nil }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend@@ -257,7 +249,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { build_stubbed(:custom_style) }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend@@ -268,8 +260,8 @@ RSpec.describe CustomStylesController docontext 'if it exists' dobefore do- expect(CustomStyle).to receive(:current).and_return(custom_style)- expect(custom_style).to receive(:remove_logo).and_call_original+ allow(CustomStyle).to receive(:current).and_return(custom_style)+ allow(custom_style).to receive(:remove_logo).and_call_originaldelete :logo_deleteend@@ -280,7 +272,7 @@ RSpec.describe CustomStylesController docontext 'if it does not exist' dobefore do- expect(CustomStyle).to receive(:current).and_return(nil)+ allow(CustomStyle).to receive(:current).and_return(nil)delete :logo_deleteend@@ -291,10 +283,8 @@ RSpec.describe CustomStylesController doenddescribe "#favicon_download" do- render_views-before do- expect(CustomStyle).to receive(:current).and_return(custom_style)+ allow(CustomStyle).to receive(:current).and_return(custom_style)allow(controller).to receive(:send_file) { controller.head 200 }get :favicon_download, params: { digest: "1234", filename: "favicon_image.png" }end@@ -311,7 +301,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { nil }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend@@ -320,7 +310,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { build(:custom_style) }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend@@ -331,8 +321,8 @@ RSpec.describe CustomStylesController docontext 'if it exists' dobefore do- expect(CustomStyle).to receive(:current).and_return(custom_style)- expect(custom_style).to receive(:remove_favicon).and_call_original+ allow(CustomStyle).to receive(:current).and_return(custom_style)+ allow(custom_style).to receive(:remove_favicon).and_call_originaldelete :favicon_deleteend@@ -343,7 +333,7 @@ RSpec.describe CustomStylesController docontext 'if it does not exist' dobefore do- expect(CustomStyle).to receive(:current).and_return(nil)+ allow(CustomStyle).to receive(:current).and_return(nil)delete :favicon_deleteend@@ -354,10 +344,8 @@ RSpec.describe CustomStylesController doenddescribe "#touch_icon_download" do- render_views-before do- expect(CustomStyle).to receive(:current).and_return(custom_style)+ allow(CustomStyle).to receive(:current).and_return(custom_style)allow(controller).to receive(:send_file) { controller.head 200 }get :touch_icon_download, params: { digest: "1234", filename: "touch_icon_image.png" }end@@ -374,7 +362,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { nil }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend@@ -383,7 +371,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { build(:custom_style) }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend@@ -394,8 +382,8 @@ RSpec.describe CustomStylesController docontext 'if it exists' dobefore do- expect(CustomStyle).to receive(:current).and_return(custom_style)- expect(custom_style).to receive(:remove_touch_icon).and_call_original+ allow(CustomStyle).to receive(:current).and_return(custom_style)+ allow(custom_style).to receive(:remove_touch_icon).and_call_originaldelete :touch_icon_deleteend@@ -406,7 +394,7 @@ RSpec.describe CustomStylesController docontext 'if it does not exist' dobefore do- expect(CustomStyle).to receive(:current).and_return(nil)+ allow(CustomStyle).to receive(:current).and_return(nil)delete :touch_icon_deleteend@@ -451,7 +439,7 @@ RSpec.describe CustomStylesController doendend- context 'regular user' do+ context 'for a regular user' dolet(:user) { build(:user) }describe '#get' do@@ -465,14 +453,12 @@ RSpec.describe CustomStylesController doendend- context 'anonymous user' do+ context 'for an anonymous user' dolet(:user) { User.anonymous }describe "#logo_download" do- render_views-before do- expect(CustomStyle).to receive(:current).and_return(custom_style)+ allow(CustomStyle).to receive(:current).and_return(custom_style)allow(controller).to receive(:send_file) { controller.head 200 }get :logo_download, params: { digest: "1234", filename: "logo_image.png" }end@@ -489,7 +475,7 @@ RSpec.describe CustomStylesController dolet(:custom_style) { nil }it 'renders with error' do- expect(controller).not_to receive(:send_file)+ expect(controller).not_to have_received(:send_file)expect(response).to have_http_status(:not_found)endend