diff --git a/spec/controllers/error_template_attributes_controller_spec.rb b/spec/controllers/error_template_attributes_controller_spec.rb new file mode 100644 index 00000000..27e33247 --- /dev/null +++ b/spec/controllers/error_template_attributes_controller_spec.rb @@ -0,0 +1,43 @@ +require 'rails_helper' + +describe ErrorTemplateAttributesController do + let!(:error_template_attribute) { FactoryBot.create(:error_template_attribute) } + let(:user) { FactoryBot.create(:admin) } + before(:each) { allow(controller).to receive(:current_user).and_return(user) } + + it "should get index" do + get :index + expect(response.status).to eq(200) + expect(assigns(:error_template_attributes)).not_to be_nil + end + + it "should get new" do + get :new + expect(response.status).to eq(200) + end + + it "should create error_template_attribute" do + expect { post :create, error_template_attribute: { } }.to change(ErrorTemplateAttribute, :count).by(1) + expect(response).to redirect_to(error_template_attribute_path(assigns(:error_template_attribute))) + end + + it "should show error_template_attribute" do + get :show, id: error_template_attribute + expect(response.status).to eq(200) + end + + it "should get edit" do + get :edit, id: error_template_attribute + expect(response.status).to eq(200) + end + + it "should update error_template_attribute" do + patch :update, id: error_template_attribute, error_template_attribute: { } + expect(response).to redirect_to(error_template_attribute_path(assigns(:error_template_attribute))) + end + + it "should destroy error_template_attribute" do + expect { delete :destroy, id: error_template_attribute }.to change(ErrorTemplateAttribute, :count).by(-1) + expect(response).to redirect_to(error_template_attributes_path) + end +end diff --git a/spec/controllers/error_templates_controller_spec.rb b/spec/controllers/error_templates_controller_spec.rb new file mode 100644 index 00000000..abff452f --- /dev/null +++ b/spec/controllers/error_templates_controller_spec.rb @@ -0,0 +1,43 @@ +require 'rails_helper' + +describe ErrorTemplatesController do + let!(:error_template) { FactoryBot.create(:error_template) } + let(:user) { FactoryBot.create(:admin) } + before(:each) { allow(controller).to receive(:current_user).and_return(user) } + + it "should get index" do + get :index + expect(response.status).to eq(200) + expect(assigns(:error_templates)).not_to be_nil + end + + it "should get new" do + get :new + expect(response.status).to eq(200) + end + + it "should create error_template" do + expect { post :create, error_template: { } }.to change(ErrorTemplate, :count).by(1) + expect(response).to redirect_to(error_template_path(assigns(:error_template))) + end + + it "should show error_template" do + get :show, id: error_template + expect(response.status).to eq(200) + end + + it "should get edit" do + get :edit, id: error_template + expect(response.status).to eq(200) + end + + it "should update error_template" do + patch :update, id: error_template, error_template: { } + expect(response).to redirect_to(error_template_path(assigns(:error_template))) + end + + it "should destroy error_template" do + expect { delete :destroy, id: error_template }.to change(ErrorTemplate, :count).by(-1) + expect(response).to redirect_to(error_templates_path) + end +end diff --git a/test/factories/error_template_attributes.rb b/spec/factories/error_template_attributes.rb similarity index 59% rename from test/factories/error_template_attributes.rb rename to spec/factories/error_template_attributes.rb index 2e867ec5..74d6e559 100644 --- a/test/factories/error_template_attributes.rb +++ b/spec/factories/error_template_attributes.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :error_template_attribute do - key "MyString" - regex "MyString" + key { "MyString" } + regex { "MyString" } end end diff --git a/spec/factories/error_templates.rb b/spec/factories/error_templates.rb new file mode 100644 index 00000000..222cf363 --- /dev/null +++ b/spec/factories/error_templates.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :error_template do + execution_environment { nil } + name { "MyString" } + signature { "MyString" } + end +end diff --git a/spec/factories/structured_error_attributes.rb b/spec/factories/structured_error_attributes.rb new file mode 100644 index 00000000..27d0330e --- /dev/null +++ b/spec/factories/structured_error_attributes.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :structured_error_attribute do + structured_error { nil } + error_template_attribute { nil } + value { "MyString" } + end +end diff --git a/test/factories/structured_errors.rb b/spec/factories/structured_errors.rb similarity index 55% rename from test/factories/structured_errors.rb rename to spec/factories/structured_errors.rb index 10fc3d23..33cab151 100644 --- a/test/factories/structured_errors.rb +++ b/spec/factories/structured_errors.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :structured_error do - error_template nil - submission nil + error_template { nil } + submission { nil } end end diff --git a/test/mailers/previews/user_mailer_preview.rb b/spec/mailers/previews/user_mailer_preview.rb similarity index 100% rename from test/mailers/previews/user_mailer_preview.rb rename to spec/mailers/previews/user_mailer_preview.rb diff --git a/test/controllers/error_template_attributes_controller_test.rb b/test/controllers/error_template_attributes_controller_test.rb deleted file mode 100644 index 7dd008ec..00000000 --- a/test/controllers/error_template_attributes_controller_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'test_helper' - -class ErrorTemplateAttributesControllerTest < ActionController::TestCase - setup do - @error_template_attribute = error_template_attributes(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:error_template_attributes) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create error_template_attribute" do - assert_difference('ErrorTemplateAttribute.count') do - post :create, error_template_attribute: { } - end - - assert_redirected_to error_template_attribute_path(assigns(:error_template_attribute)) - end - - test "should show error_template_attribute" do - get :show, id: @error_template_attribute - assert_response :success - end - - test "should get edit" do - get :edit, id: @error_template_attribute - assert_response :success - end - - test "should update error_template_attribute" do - patch :update, id: @error_template_attribute, error_template_attribute: { } - assert_redirected_to error_template_attribute_path(assigns(:error_template_attribute)) - end - - test "should destroy error_template_attribute" do - assert_difference('ErrorTemplateAttribute.count', -1) do - delete :destroy, id: @error_template_attribute - end - - assert_redirected_to error_template_attributes_path - end -end diff --git a/test/controllers/error_templates_controller_test.rb b/test/controllers/error_templates_controller_test.rb deleted file mode 100644 index 452ad134..00000000 --- a/test/controllers/error_templates_controller_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'test_helper' - -class ErrorTemplatesControllerTest < ActionController::TestCase - setup do - @error_template = error_templates(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:error_templates) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create error_template" do - assert_difference('ErrorTemplate.count') do - post :create, error_template: { } - end - - assert_redirected_to error_template_path(assigns(:error_template)) - end - - test "should show error_template" do - get :show, id: @error_template - assert_response :success - end - - test "should get edit" do - get :edit, id: @error_template - assert_response :success - end - - test "should update error_template" do - patch :update, id: @error_template, error_template: { } - assert_redirected_to error_template_path(assigns(:error_template)) - end - - test "should destroy error_template" do - assert_difference('ErrorTemplate.count', -1) do - delete :destroy, id: @error_template - end - - assert_redirected_to error_templates_path - end -end diff --git a/test/factories/error_templates.rb b/test/factories/error_templates.rb deleted file mode 100644 index 3a2637ca..00000000 --- a/test/factories/error_templates.rb +++ /dev/null @@ -1,7 +0,0 @@ -FactoryBot.define do - factory :error_template do - execution_environment nil - name "MyString" - signature "MyString" - end -end diff --git a/test/factories/structured_error_attributes.rb b/test/factories/structured_error_attributes.rb deleted file mode 100644 index 0b720b23..00000000 --- a/test/factories/structured_error_attributes.rb +++ /dev/null @@ -1,7 +0,0 @@ -FactoryBot.define do - factory :structured_error_attribute do - structured_error nil - error_template_attribute nil - value "MyString" - end -end diff --git a/test/models/error_template_attribute_test.rb b/test/models/error_template_attribute_test.rb deleted file mode 100644 index 187ae1b7..00000000 --- a/test/models/error_template_attribute_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class ErrorTemplateAttributeTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/error_template_test.rb b/test/models/error_template_test.rb deleted file mode 100644 index 538dc19a..00000000 --- a/test/models/error_template_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class ErrorTemplateTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/structured_error_attribute_test.rb b/test/models/structured_error_attribute_test.rb deleted file mode 100644 index 1dcb316b..00000000 --- a/test/models/structured_error_attribute_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class StructuredErrorAttributeTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/structured_error_test.rb b/test/models/structured_error_test.rb deleted file mode 100644 index 28b03689..00000000 --- a/test/models/structured_error_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class StructuredErrorTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end