diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 4f90f0ac1..3b564cb05 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -7,10 +7,4 @@ class CaseLogsController < ApplicationController def show @case_log = CaseLog.find(params[:id]) end - - def edit - end - - def new - end end diff --git a/spec/controllers/case_logs_controller_spec.rb b/spec/controllers/case_logs_controller_spec.rb new file mode 100644 index 000000000..798074466 --- /dev/null +++ b/spec/controllers/case_logs_controller_spec.rb @@ -0,0 +1,41 @@ +require "rails_helper" + +RSpec.describe CaseLogsController, type: :controller do + let(:valid_session) { {} } + + context "Collection routes" do + describe "GET #index" do + it "returns a success response" do + get :index, params: {}, session: valid_session + expect(response).to be_successful + end + end + + describe "GET #new" do + it "returns a success response" do + get :new, params: {}, session: valid_session + expect(response).to be_successful + end + end + end + + context "Instance routes" do + let!(:case_log) { FactoryBot.create(:case_log) } + let(:id) { case_log.id } + + describe "GET #show" do + it "returns a success response" do + get :show, params: { id: id } + expect(response).to be_successful + end + end + + describe "GET #edit" do + it "returns a success response" do + get :edit, params: { id: id } + puts response + expect(response).to be_successful + end + end + end +end diff --git a/spec/controllers/test_controllers_spec.rb b/spec/controllers/test_controller_spec.rb similarity index 100% rename from spec/controllers/test_controllers_spec.rb rename to spec/controllers/test_controller_spec.rb diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index 4cbba23b2..644ce48c3 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -4,9 +4,15 @@ RSpec.describe "Test Features" do let(:id) { case_log.id } let(:status) { case_log.status } - it "Displays a tasklist header" do + it "displays a tasklist header" do visit("/case_logs/342351") expect(page).to have_content("Tasklist for log #{id}") expect(page).to have_content("This submission is #{status}") end + + it "has an edit form" do + visit("/case_logs/new") + expect(page).to have_field("age") + expect(page).to have_button("Continue") + end end diff --git a/spec/features/form_spec.rb b/spec/features/form_spec.rb deleted file mode 100644 index 6f7a623d3..000000000 --- a/spec/features/form_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -require "rails_helper" -RSpec.describe "Test Features" do - it "Displays the name of the app" do - visit("/case_logs/new") - expect(page).to have_field("age") - expect(page).to have_button("Continue") - end -end