Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

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 "Post #create" do
it "creates a new case log record" do
expect {
post :create, params: {}, session: valid_session
}.to change(CaseLog, :count).by(1)
end
3 years ago
it "redirects to that case log" do
post :create, params: {}, session: valid_session
expect(response.status).to eq(302)
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 }
expect(response).to be_successful
end
end
end
end