Skip to content

Commit

Permalink
Merge pull request #27 from camsys/quarter2
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mathmerized authored Jun 26, 2018
2 parents 86cdd81 + bec04b6 commit e424870
Show file tree
Hide file tree
Showing 27 changed files with 947 additions and 899 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ pickle-email-*.html
rerun.txt
.DS_Store
*.idea
shadowed_views.log
12 changes: 12 additions & 0 deletions .hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# look for views that might be overriden in different transam engines/apps
files=`git status --porcelain | xargs -n1 basename | grep '\.haml\|erb$'`
for file in $files; do

find .. -path "../$(basename "$PWD")" -prune -o -name $file -print | while read f; do
echo "$file shadows or is shadowed by: $f"
echo "$file shadows or is shadowed by: $f" >> 'shadowed_views.log'
done

done
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ gemspec

# To use debugger
# gem 'debugger'
gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter1
gem 'mysql2', '~> 0.3.20' # lock gem for dummy app
gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter2
gem 'mysql2', "~> 0.5.1" # lock gem for dummy app
gem "capybara", '2.6.2' # lock gem for old capybara behavior on hidden element xpath
gem 'sass-rails'
gem 'rails-controller-testing'

# This gem allows us to share githooks. Githooks in the .hooks folder can be checked
# in, and when "bundle install" is run this gem automatically creates symlinks into
Expand Down
1 change: 0 additions & 1 deletion app/models/asset_auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def audit options={}
# audit table wth the results
#-----------------------------------------------------------------------------
def update_status a, start_date, end_date

errors = []
if a.nil?
Rails.logger.debug "Asset cannot be nil"
Expand Down
4 changes: 2 additions & 2 deletions app/views/audits/_audit_activity_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
.col-sm-3
= hidden_field_tag(:old_activity_start_date, format_as_date(i_f.object.start_date))
= i_f.input :start_date, :label => 'Audit Activity Start Date', :wrapper => :vertical_append do
= i_f.input_field :start_date, :class => "form-control", :as => :string, :data => {'behavior' => 'datepicker'}, :value => format_as_date(i_f.object.start_date)
= i_f.input_field :start_date, :class => "form-control datepicker", :as => :string, :data => {'date-container' => '#page'}, :value => format_as_date(i_f.object.start_date)
%span.input-group-addon
%i.fa.fa-calendar
.col-sm-3
= hidden_field_tag(:old_activity_end_date, format_as_date(i_f.object.end_date))
= i_f.input :end_date, :label => 'Audit Activity End Date', :wrapper => :vertical_append do
= i_f.input_field :end_date, :class => "form-control", :as => :string, :data => {'behavior' => 'datepicker'}, :value => format_as_date(i_f.object.end_date)
= i_f.input_field :end_date, :class => "form-control datepicker", :as => :string, :data => {'date-container' => '#page'}, :value => format_as_date(i_f.object.end_date)
%span.input-group-addon
%i.fa.fa-calendar
.col-sm-3
Expand Down
7 changes: 2 additions & 5 deletions app/views/audits/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
.col-sm-4
= hidden_field_tag(:old_start_date, format_as_date(f.object.start_date))
= f.input :start_date, :wrapper => :vertical_append, :label => "Data Update Start Date" do
= f.input_field :start_date, :as => :string, :class => 'form-control datepicker', :data => {'behavior' => 'datepicker'}, :value => format_as_date(f.object.start_date)
= f.input_field :start_date, :as => :string, :class => 'form-control datepicker', :data => {'date-container' => '#page'}, :value => format_as_date(f.object.start_date)
%span.input-group-addon
%i.fa.fa-calendar
.col-sm-4
= hidden_field_tag(:old_end_date, format_as_date(f.object.end_date))
= f.input :end_date, :wrapper => :vertical_append, :label => "Data Update End Date" do
= f.input_field :end_date, :as => :string, :class => 'form-control datepicker', :data => {'behavior' => 'datepicker'}, :value => format_as_date(f.object.end_date)
= f.input_field :end_date, :as => :string, :class => 'form-control datepicker', :data => {'date-container' => '#page'}, :value => format_as_date(f.object.end_date)
%span.input-group-addon
%i.fa.fa-calendar
.col-sm-4
Expand All @@ -56,9 +56,6 @@

$(document).ready(function() {

$('[data-behavior~=datepicker]').datepicker({
});

$('#audit_name').simplyCountable({
counter: '#name-counter',
maxCount: $('#audit_name').attr('maxlength'),
Expand Down
2 changes: 1 addition & 1 deletion app/views/audits/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2#page
.page-header
%h2 Update Audit

Expand Down
2 changes: 1 addition & 1 deletion lib/transam_audit/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TransamAudit
VERSION = "2.1.0"
VERSION = "2.2.1"
end
2 changes: 1 addition & 1 deletion spec/controllers/audit_results_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
test_result = create(:audit_result, :auditable => test_asset, :audit_result_type_id => 2, :organization => test_asset.organization)


get :index, :types_filter => ['Asset'], :audit_filter => test_result.audit.id
get :index, params: {:types_filter => ['Asset'], :audit_filter => test_result.audit.id}

expect(assigns(:types_filter)).to eq(['Asset'])
expect(assigns(:audit_filter)).to eq(test_result.audit.id.to_s)
Expand Down
14 changes: 7 additions & 7 deletions spec/controllers/audits_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:test_audit) { create(:audit) }

before(:each) do
sign_in FactoryGirl.create(:admin)
sign_in FactoryBot.create(:admin)
end

it 'GET index' do
Expand All @@ -15,7 +15,7 @@
end

it 'GET show' do
get :show, :id => test_audit.object_key
get :show, params: {:id => test_audit.object_key}

expect(assigns(:audit)).to eq(test_audit)
end
Expand All @@ -26,33 +26,33 @@
expect(assigns(:audit).to_json).to eq(Audit.new.to_json)
end
it 'GET edit' do
get :edit, :id => test_audit.object_key
get :edit, params:{:id => test_audit.object_key}

expect(assigns(:audit)).to eq(test_audit)
end

it 'POST create' do
Audit.destroy_all
post :create, :audit => attributes_for(:audit, :activity_id => create(:activity).id, :start_date => Date.today.beginning_of_month.strftime('%m/%d/%Y'), :end_date => Date.today.end_of_month.strftime('%m/%d/%Y'))
post :create, params: {:audit => attributes_for(:audit, :activity_id => create(:activity).id, :start_date => Date.today.beginning_of_month.strftime('%m/%d/%Y'), :end_date => Date.today.end_of_month.strftime('%m/%d/%Y'))}

expect(Audit.count).to eq(1)
end
it 'PUT update' do
put :update, :id => test_audit.object_key, :audit => {:instructions => 'new instructions 222'}
put :update, params: {:id => test_audit.object_key, :audit => {:instructions => 'new instructions 222'}}
test_audit.reload

expect(test_audit.instructions).to eq('new instructions 222')
end

it 'DELETE destroy' do
delete :destroy, :id => test_audit.object_key
delete :destroy, params: {:id => test_audit.object_key}

expect(Audit.find_by(:object_key => test_audit.object_key)).to be nil
end

describe 'negative tests' do
it 'audit does not exist' do
get :show, :id => 'ABCDEFGHIJ'
get :show, params: {:id => 'ABCDEFGHIJ'}

expect(response).to redirect_to('/404')
end
Expand Down
Loading

0 comments on commit e424870

Please sign in to comment.