Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions app/admin/admin_health_rating_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ActiveAdmin.register HealthRatingType do
permit_params :name, :score, :weight, :threshold_min, :threshold_max, :created_by_id, :updated_by_id

index do
selectable_column
id_column
column :name
column :score
column :weight
column :threshold_min
column :threshold_max
column :created_at
actions
end

filter :name
filter :created_at

form do |f|
f.inputs do
f.input :name
f.input :score
f.input :weight
f.input :threshold_min
f.input :threshold_max
# f.hidden_field :created_by_id, value: User.first.id # FIXME
# f.hidden_field :updated_by_id, value: User.first.id # FIXME

f.input :created_by_id, :input_html => { :value => User.first.id }, as: :hidden
f.input :updated_by_id, :input_html => { :value => User.first.id }, as: :hidden
end
f.actions
end
end
25 changes: 25 additions & 0 deletions spec/features/health_rating_type_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'rails_helper'

feature 'Health rating type management', js: true do
before do
sign_in(create(:user, admin: true))
end

describe 'health rating types' do
it 'admins can create health rating types' do
visit root_path

page.find('.user-dropdown').hover
click_link 'Admin'
click_link 'Health Rating Types'

click_link 'New Health Rating Type', visible: false
fill_in 'Name', with: 'New Health Rating Type!'
click_button 'Create Health rating type'

expect(page.find('.flash_notice')).to have_content "Health rating type was successfully created."

# expect(page).to have_css('table#records tbody tr', count: 1)
end
end
end