baarkerlounger
3 years ago
9 changed files with 64 additions and 0 deletions
@ -0,0 +1,7 @@
|
||||
class CaseLogsController < ApplicationController |
||||
def index; end |
||||
|
||||
def show |
||||
@case_log = CaseLog.find(params[:id]) |
||||
end |
||||
end |
@ -0,0 +1,3 @@
|
||||
class CaseLog < ApplicationRecord |
||||
enum status: ["in progress", "submitted"] |
||||
end |
@ -0,0 +1,3 @@
|
||||
<h1 class="govuk-heading-xl">Tasklist for log <%= @case_log.id %></h1> |
||||
|
||||
<h2 class="govuk-heading-s govuk-!-margin-bottom-2">This submission is <%= @case_log.status %></h2> |
@ -0,0 +1,8 @@
|
||||
class AddCaseLog < ActiveRecord::Migration[6.1] |
||||
def change |
||||
create_table :case_logs do |t| |
||||
t.integer :status, default: 0 |
||||
t.timestamps |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,24 @@
|
||||
# This file is auto-generated from the current state of the database. Instead |
||||
# of editing this file, please use the migrations feature of Active Record to |
||||
# incrementally modify your database, and then regenerate this schema definition. |
||||
# |
||||
# This file is the source Rails uses to define your schema when running `bin/rails |
||||
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to |
||||
# be faster and is potentially less error prone than running all of your |
||||
# migrations from scratch. Old migrations may fail to apply correctly if those |
||||
# migrations use external dependencies or application code. |
||||
# |
||||
# It's strongly recommended that you check this file into your version control system. |
||||
|
||||
ActiveRecord::Schema.define(version: 2021_09_08_122819) do |
||||
|
||||
# These are extensions that must be enabled in order to support this database |
||||
enable_extension "plpgsql" |
||||
|
||||
create_table "case_logs", force: :cascade do |t| |
||||
t.integer "status", default: 0 |
||||
t.datetime "created_at", precision: 6, null: false |
||||
t.datetime "updated_at", precision: 6, null: false |
||||
end |
||||
|
||||
end |
@ -0,0 +1,6 @@
|
||||
FactoryBot.define do |
||||
factory :case_log do |
||||
id { 342351 } |
||||
status { 0 } |
||||
end |
||||
end |
@ -0,0 +1,11 @@
|
||||
require "rails_helper" |
||||
RSpec.describe "Test Features" do |
||||
let!(:case_log){ FactoryBot.create(:case_log) } |
||||
let(:id){ case_log.id } |
||||
let(:status) { case_log.status } |
||||
|
||||
it "Displays a tasklist header" do |
||||
visit("/case_logs/342351") |
||||
expect(page).to have_content("Tasklist for log 342351") |
||||
end |
||||
end |
Loading…
Reference in new issue