Align project files with CodeHarbor

Since both projects are developed together and by the same team, we also want to have the same code structure and utility methods available in both projects. Therefore, this commit changes many files, but without a functional change.
This commit is contained in:
Sebastian Serth
2023-10-10 23:25:02 +02:00
parent fb3e8972d9
commit 99bd46af1a
112 changed files with 433 additions and 320 deletions

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe ErrorTemplateAttributesController do
RSpec.describe ErrorTemplateAttributesController do
render_views
let!(:error_template_attribute) { create(:error_template_attribute) }
@ -10,39 +10,67 @@ describe ErrorTemplateAttributesController do
before { allow(controller).to receive(:current_user).and_return(user) }
it 'gets index' do
get :index
expect(response).to have_http_status(:ok)
expect(assigns(:error_template_attributes)).not_to be_nil
describe 'GET #index' do
before { get :index }
expect_assigns(error_template_attributes: ErrorTemplateAttribute.all)
expect_http_status(:ok)
expect_template(:index)
end
it 'gets new' do
get :new
expect(response).to have_http_status(:ok)
describe 'GET #new' do
before { get :new }
expect_http_status(:ok)
expect_template(:new)
end
it 'creates error_template_attribute' do
expect { post :create, params: {error_template_attribute: {}} }.to change(ErrorTemplateAttribute, :count).by(1)
expect(response).to redirect_to(error_template_attribute_path(assigns(:error_template_attribute)))
describe 'POST #create' do
before { post :create, params: {error_template_attribute: {}} }
expect_assigns(error_template_attribute: ErrorTemplateAttribute)
it 'creates the error template attribute' do
expect { post :create, params: {error_template_attribute: {}} }.to change(ErrorTemplateAttribute, :count).by(1)
end
expect_redirect { error_template_attribute_path(assigns(:error_template_attribute)) }
end
it 'shows error_template_attribute' do
get :show, params: {id: error_template_attribute}
expect(response).to have_http_status(:ok)
describe 'GET #show' do
before { get :show, params: {id: error_template_attribute} }
expect_assigns(error_template_attribute: ErrorTemplateAttribute)
expect_http_status(:ok)
expect_template(:show)
end
it 'gets edit' do
get :edit, params: {id: error_template_attribute}
expect(response).to have_http_status(:ok)
describe 'GET #edit' do
before { get :edit, params: {id: error_template_attribute} }
expect_assigns(error_template_attribute: ErrorTemplateAttribute)
expect_http_status(:ok)
expect_template(:edit)
end
it 'updates error_template_attribute' do
patch :update, params: {id: error_template_attribute, error_template_attribute: attributes_for(:error_template_attribute)}
expect(response).to redirect_to(error_template_attribute_path(assigns(:error_template_attribute)))
describe 'PATCH #update' do
before { patch :update, params: {id: error_template_attribute, error_template_attribute: attributes_for(:error_template_attribute)} }
expect_assigns(error_template_attribute: ErrorTemplateAttribute)
expect_redirect { error_template_attribute }
end
it 'destroys error_template_attribute' do
expect { delete :destroy, params: {id: error_template_attribute} }.to change(ErrorTemplateAttribute, :count).by(-1)
expect(response).to redirect_to(error_template_attributes_path)
describe 'DELETE #destroy' do
before { delete :destroy, params: {id: error_template_attribute} }
expect_assigns(error_template_attribute: ErrorTemplateAttribute)
it 'destroys the error template attribute' do
error_template_attribute = create(:error_template_attribute)
expect { delete :destroy, params: {id: error_template_attribute} }.to change(ErrorTemplateAttribute, :count).by(-1)
end
expect_redirect { error_template_attribute }
end
end