Skip to content
Snippets Groups Projects
Commit ca144190 authored by Erin Fahy's avatar Erin Fahy
Browse files

creates routes and builds systems basic controller and view

parent 9901bcec
Branches models
No related tags found
No related merge requests found
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/
class SystemsController < ApplicationController
def index
@systems = System.all
end
end
module SystemsHelper
end
<h1>Systems</h1>
<table>
<tr>
<th>Hostname</th>
<th>OS</th>
</tr>
<% @systems.each do |system| %>
<tr>
<td><%= system.hostname %></td>
<td><%= system.os %></td>
</tr>
<% end %>
</table>
Rails.application.routes.draw do
get 'systems/index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
......@@ -53,4 +55,9 @@ Rails.application.routes.draw do
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
resources :systems
resources :packages
resources :vulnerabilities
root 'systems#index'
end
require 'rails_helper'
RSpec.describe SystemsController, type: :controller do
describe "GET #index" do
it "returns http success" do
get :index
expect(response).to have_http_status(:success)
end
end
end
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the SystemsHelper. For example:
#
# describe SystemsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe SystemsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
require 'rails_helper'
RSpec.describe "system/index.html.erb", type: :view do
pending "add some examples to (or delete) #{__FILE__}"
end
require 'rails_helper'
RSpec.describe "systems/index.html.erb", type: :view do
pending "add some examples to (or delete) #{__FILE__}"
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment