From da36dacd8b35efc043d9b66420b1b8c45f92fe0f Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 14 Jan 2016 21:32:31 -0800 Subject: [PATCH 01/29] updated gemfile, enviromentdeve seed --- Gemfile | 3 +- config/environments/development.rb | 2 +- db/seeds.rb | 63 +++++++++++++++++------------- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/Gemfile b/Gemfile index 2a863a898..71a1f3076 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,8 @@ source 'https://rubygems.org' -ruby '2.1.8' +# ruby '2.1.8' +ruby '2.2.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.3' diff --git a/config/environments/development.rb b/config/environments/development.rb index b8567d031..3d29b28ed 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -44,7 +44,7 @@ # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. config.assets.raise_runtime_errors = true - + config.action_mailer.delivery_method = :sendmail # Raises error for missing translations # config.action_view.raise_on_missing_translations = true config.action_mailer.default_url_options = { :host => 'localhost', :port => '3000'} diff --git a/db/seeds.rb b/db/seeds.rb index c4ce6c293..63db89d08 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -49,31 +49,58 @@ # user.confirmed_at = DateTime.now # end - +#incase rerun comes in. not necessary +JobSeekerStatus.delete_all Job.delete_all Company.delete_all +Address.delete_all +CompanyPerson.delete_all +JobCategory.delete_all cp1 = Company.create(:ein => '12-2123244', :phone=> '721-234-4646', email: 'casemanager@gmail.com', website: 'http://www.wallmart.com', :name=> 'Walmart') cp2 = Company.create(:ein => '13-1244445', :phone=> '721-234-1010', email: 'casemanager2@gmail.com', website: 'http://www.target.com', :name=> 'Target') cp3 = Company.create(:ein => '12-1252445', :phone=> '865-234-4646', email: 'casemanager3@gmail.com', website: 'http://www.Food4less.com',:name=> 'Food4less') cp4 = Company.create(:ein => '15-1342447', :phone=> '971-234-4646', email: 'casemanager4@gmail.com', website: 'http://www.macy.com', :name=> 'Macy') +address1 = Address.create(:street => "1234 East Maripos Avenu", city: "San Diego", zipcode: "92105") +address2 = Address.create(:street => "1234 East Main Street", city: "Los Angeles", zipcode: "92108") +address1.update_attribute(:location, cp1) +address2.update_attribute(:location, cp2) + +cperson = CompanyPerson.create(company_id: cp1.id, address_id: address1.id, status: "Active", title: "General Manager", + email: "salemamba@gmail.com", :password => "secrete", first_name: "salem", :last_name => "Ali") +cperson2 = CompanyPerson.create(company_id: cp2.id, address_id: address2.id, status: "Active", title: "Day Manager", + email: "salemamba1@gmail.com", :password => "secrete", first_name: "Kalem", :last_name => "Kli") + + +# Job Categories +jcategory = JobCategory.create(name: 'SW Developer - RoR', + description: 'Ruby on Rails backend developer') +jcategory1 = JobCategory.create(name: 'SW Developer - JS', + description: 'Javascript frontend developer') +jcategory2 = JobCategory.create(name: 'SW Developer - Java', + description: 'Java backend developer') +jcategory3 = JobCategory.create(name: 'SW Project Manager - Agile', + description: 'Manages Agile SW development projects') +Jjcategory4 = JobCategory.create(name: 'SW Project Manager - Waterfall', + description: 'Manages SW development projects using waterfall SDLC') +jcategory5 = JobCategory.create(name: 'Product Manager - SaaS', + description: 'Manages SaaS product development and commecialization') Job.create(:title => 'Software Developer', :description => 'Looking for a software developer intern.', :company_id => cp1.id, - :company_person_id => '1', :job_category_id => '1' ) + :company_person_id => cperson.id, :job_category_id =>jcategory1.id ) Job.create(:title => 'Cashier', :description => 'Looking for well qualified cashier with 5 years experience', :company_id => cp2.id, - :company_person_id => '2', :job_category_id => '2' ) + :company_person_id => cperson2.id, :job_category_id => jcategory.id ) Job.create(:title => 'Driver', :description => 'Looking for a truck driver with class A license', :company_id => cp3.id, - :company_person_id => '3', :job_category_id => '3' ) + :company_person_id => cperson.id, :job_category_id => jcategory.id ) Job.create(:title => 'Security Personel', :description => 'If you have Security Guard license, and love to work third shift, than call us.', :company_id => cp4.id, - :company_person_id => '4', :job_category_id => '4' ) + :company_person_id => cperson.id, :job_category_id => jcategory1.id) + -#incase rerun comes in. not necessary -JobSeekerStatus.delete_all ['Unemployedlooking', 'Employedlooking', 'Employednotlooking'].each do |status| case status - when 'Unemployedlooking' + when 'Unemployedlooking' @jss1 = JobSeekerStatus.find_or_create_by(:value => status, description: "A jobseeker Without any work and looking for a job.") when 'Employedlooking' @@ -184,23 +211,6 @@ "1990", confirmed_at: Time.now) - -# Job Categories -JobCategory.create(name: 'SW Developer - RoR', - description: 'Ruby on Rails backend developer') -JobCategory.create(name: 'SW Developer - JS', - description: 'Javascript frontend developer') -JobCategory.create(name: 'SW Developer - Java', - description: 'Java backend developer') -JobCategory.create(name: 'SW Project Manager - Agile', - description: 'Manages Agile SW development projects') -JobCategory.create(name: 'SW Project Manager - Waterfall', - description: 'Manages SW development projects using waterfall SDLC') -JobCategory.create(name: 'Product Manager - SaaS', - description: 'Manages SaaS product development and commecialization') - - - jobseeker = JobSeeker.create(first_name: 'abc',last_name:'def',email:'vijaya.karumudi1@gmail.com', password:'dfg123',password_confirmation:'dfg123',phone:'345-890-7890',year_of_birth: "1990", confirmed_at: Time.now) @@ -216,6 +226,3 @@ email: 'frank@gmail.com', password: 'qwerty123', year_of_birth: '1970', resume: 'text', job_seeker_status: @jss3, confirmed_at: Time.now) - - - From e1562da995b1a717d498248aecf5ef0cca77deab Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 14 Jan 2016 22:50:52 -0800 Subject: [PATCH 02/29] edited gemfile/developmentenv --- Gemfile | 4 ++-- config/environments/development.rb | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 71a1f3076..12039a38a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -# ruby '2.1.8' -ruby '2.2.2' +ruby '2.1.8' +# ruby '2.2.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.3' diff --git a/config/environments/development.rb b/config/environments/development.rb index 3d29b28ed..5f51fe55a 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -44,7 +44,6 @@ # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. config.assets.raise_runtime_errors = true - config.action_mailer.delivery_method = :sendmail # Raises error for missing translations # config.action_view.raise_on_missing_translations = true config.action_mailer.default_url_options = { :host => 'localhost', :port => '3000'} From 7bcb07e404272dca30a0f15d7e338c91de18c309 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Fri, 15 Jan 2016 19:19:21 -0800 Subject: [PATCH 03/29] change email setup for heroku --- config/environment.rb | 28 ++++++++++++++-------------- config/environments/production.rb | 13 ++++++++++++- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/config/environment.rb b/config/environment.rb index 0a0adaacd..07ced95bd 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,16 +1,16 @@ -# Load the Rails application. -require File.expand_path('../application', __FILE__) +# # Load the Rails application. +# require File.expand_path('../application', __FILE__) -# Initialize the Rails application. -Rails.application.initialize! +# # Initialize the Rails application. +# Rails.application.initialize! -# ActionMailer SMTP settings (see config/application.yml for values) -ActionMailer::Base.smtp_settings = { - user_name: ENV['SMTP_USERNAME'], - password: ENV['SMTP_PASSWORD'], - domain: ENV['SMTP_DOMAIN'], - address: ENV['SMTP_ADDRESS'], - port: ENV['SMTP_PORT'] || 587, - authentication: :plain, - enable_starttls_auto: true -} \ No newline at end of file +# # ActionMailer SMTP settings (see config/application.yml for values) +# ActionMailer::Base.smtp_settings = { +# user_name: ENV['SMTP_USERNAME'], +# password: ENV['SMTP_PASSWORD'], +# domain: ENV['SMTP_DOMAIN'], +# address: ENV['SMTP_ADDRESS'], +# port: ENV['SMTP_PORT'] || 587, +# authentication: :plain, +# enable_starttls_auto: true +# } \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index 4c0acdb44..0ad8bc750 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -77,7 +77,18 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - config.action_mailer.delivery_method = :sendmail + config.action_mailer.delivery_method = :smtp #this will take care of devise setup default url in production config.action_mailer.default_url_options = { :host => 'metplus.org' } + + ActionMailer::Base.smtp_settings = { + :address => 'smtp.sendgrid.net', + :port => '587', + :authentication => :plain, + :user_name => ENV['SENDGRID_USERNAME'], + :password => ENV['SENDGRID_PASSWORD'], + :domain => 'heroku.com', + :enable_starttls_auto => true + } + end From c045d61949de38bfc2bbe00d48b28a4bc0e68782 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Fri, 15 Jan 2016 19:30:50 -0800 Subject: [PATCH 04/29] change ruby verson --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 12039a38a..71a1f3076 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -ruby '2.1.8' -# ruby '2.2.2' +# ruby '2.1.8' +ruby '2.2.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.3' From d822cf07efb877b5491356ec81ab960a1388cfa6 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Fri, 15 Jan 2016 19:52:18 -0800 Subject: [PATCH 05/29] deleted features file --- features/agency_admin.feature | 185 -------------------------- features/company_registration.feature | 86 ------------ 2 files changed, 271 deletions(-) delete mode 100644 features/agency_admin.feature delete mode 100644 features/company_registration.feature diff --git a/features/agency_admin.feature b/features/agency_admin.feature deleted file mode 100644 index 5de7a21d1..000000000 --- a/features/agency_admin.feature +++ /dev/null @@ -1,185 +0,0 @@ -Feature: agency admin logs in and performs admin functions - - As an agency admin - I want to login to PETS - And perform various administrative functions - -Background: seed data added to database and log in as agency admim - - Given the following agency roles exist: - | role | - | AA | - | CM | - | JD | - - Given the following agencies exist: - | name | website | phone | email | fax | - | MetPlus | metplus.org | 555-111-2222 | pets_admin@metplus.org | 617-555-1212 | - - Given the following agency people exist: - | agency | role | first_name | last_name | email | password | - | MetPlus | AA | John | Smith | aa@metplus.org | qwerty123 | - | MetPlus | CM | Jane | Jones | jane@metplus.org | qwerty123 | - - Given the following agency branches exist: - | agency | city | street | zipcode | code | - | MetPlus | Detroit | 123 Main Street | 48201 | 001 | - | MetPlus | Detroit | 456 Sullivan Street | 48204 | 002 | - | MetPlus | Detroit | 3 Auto Drive | 48206 | 003 | - - Given I am on the home page - And I login as "aa@metplus.org" with password "qwerty123" - Then I should see "Signed in successfully." - And I should see "Admin" - And I click the "Admin" link - -Scenario: edit agency information - Then I should see "PETS Administration" - Then I click the "Edit Agency" button - Then I should see "MetPlus" - And I fill in "Name" with "MetPlus Two" - And I click "Update Agency" button - Then I should see "Agency was successfully updated." - And I should see "MetPlus Two" - -Scenario: cancel edit agency information - Then I click the "Edit Agency" button - Then I should see "MetPlus" - And I fill in "Name" with "MetPlus Two" - And I click the "Cancel" link - Then I should not see "Agency was successfully updated." - And I should not see "MetPlus Two" - -Scenario: errors for edit agency information - Then I click the "Edit Agency" button - Then I should see "MetPlus" - And I fill in "Phone" with "" - And I fill in "Website" with "nodomain" - And I click "Update Agency" button - Then I should see "errors prevented this record from being saved:" - And I should see "Phone can't be blank" - And I should see "Phone incorrect format" - And I should see "Website is not a valid website address" - -Scenario: edit branch - Then I should see "Agency Branches" - And I click the "001" link - Then I should see "Branch Code:" - And I should see "001" - Then I click the "Edit Branch" button - Then I should see "Edit Branch" - And I fill in "Branch Code" with "004" - And I click the "Update" button - Then I should see "Branch was successfully updated." - -Scenario: cancel edit branch - And I click the "001" link - Then I click the "Edit Branch" button - Then I should see "Edit Branch" - And I fill in "Branch Code" with "004" - Then I click the "Cancel" link - Then I should see "Agency Branch" - And I should not see "004" - -Scenario: error for edit branch - And I click the "001" link - Then I click the "Edit Branch" button - And I fill in "Branch Code" with "002" - And I fill in "Zipcode" with "1234567" - And I click the "Update" button - Then I should see "2 errors prevented this record from being saved:" - And I should see "Code has already been taken" - And I should see "Address zipcode should be in form of 12345 or 12345-1234" - -Scenario: new agency branch - And I click the "Add Branch" button - Then I fill in "Branch Code" with "004" - And I fill in "Street" with "10 Ford Way" - And I fill in "City" with "Detroit" - And I fill in "Zipcode" with "48208" - And I click the "Create" button - Then I should see "Branch was successfully created." - And I should see "004" - -@selenium -Scenario: delete agency branch - And I click the "003" link - Then I click and accept the "Delete Branch" button - Then I should see "Branch '003' deleted." - -Scenario: edit agency person - Then I should see "Agency Personnel" - And I click the "Jones, Jane" link - Then I click the "Edit Person" button - And I should see "Edit Agency Person: Jane Jones" - Then I select "002" in select list "Branch" - And I check "Agency Admin" - And I click the "Update" button - Then I should see "Agency person was successfully updated." - And I should see "Jane Jones" - And I should see "002" - And I should see "Agency Admin" - -Scenario: cancel agency person edit - And I click the "Jones, Jane" link - Then I click the "Edit Person" button - And I should see "Edit Agency Person: Jane Jones" - Then I select "002" in select list "Branch" - Then I click the "Cancel" link - Then I should see "Jane Jones" - And I should not see "002" - -@selenium -Scenario: delete agency person - And I click the "Jones, Jane" link - Then I click and accept the "Delete Person" button - Then I should see "Person 'Jane Jones' deleted." - -Scenario: cannot remove sole agency admin - And I click the "Smith, John" link - Then I click the "Edit Person" button - And I should see "Edit Agency Person: John Smith" - And I should see "Agency Admin" - And the selection "Agency Admin" should be disabled - -Scenario: invite (and reinvite) new agency person - Then I click the "Invite Person" link - And I should see "Send invitation" - And I fill in "Email" with "adam@metplus.org" - And I fill in "First name" with "Adam" - And I fill in "Last name" with "Powell" - And I click the "Send an invitation" button - And I should see "An invitation email has been sent to adam@metplus.org." - And I should see "Edit Agency Person: Adam Powell" - And I click the "Cancel" link - Then I should see "Agency Person" - And I click the "Invite Again" link - And I should see "An invitation email has been sent to adam@metplus.org." - Then "adam@metplus.org" should receive 2 emails with subject "Invitation instructions" - When "adam@metplus.org" opens the email - Then they should see "MetPlus has invited you confirm your account in PETS" in the email body - -Scenario: agency person accepts invitation in email - Then I click the "Invite Person" link - And I fill in "Email" with "adam@metplus.org" - And I fill in "First name" with "Adam" - And I fill in "Last name" with "Powell" - And I click the "Send an invitation" button - And I should see "An invitation email has been sent to adam@metplus.org." - And I log out - Then "adam@metplus.org" should receive 1 email with subject "Invitation instructions" - When "adam@metplus.org" opens the email - Then they should see "Accept invitation" in the email body - And "adam@metplus.org" follows "Accept invitation" in the email - Then they should see "Set your password" - And they fill in "Password" with "qwerty123" - And they fill in "Password confirmation" with "qwerty123" - And they click the "Set my password" button - Then they should see "Your password was set successfully. You are now signed in." - -Scenario: non-admin does not see 'admin' in menu - Given I log out - Given I am on the home page - And I login as "jane@metplus.org" with password "qwerty123" - Then I should see "Signed in successfully." - And I should not see "Admin" diff --git a/features/company_registration.feature b/features/company_registration.feature deleted file mode 100644 index d78fe4668..000000000 --- a/features/company_registration.feature +++ /dev/null @@ -1,86 +0,0 @@ -Feature: management of company registrations - - As a visitor to PETS - I want to request registration of my company as a partner with the agency - And as an agency admin - I want to manage registration requests - -Background: seed data added to database - - Given the following agency roles exist: - | role | - | AA | - - Given the following agencies exist: - | name | website | phone | email | fax | - | MetPlus | metplus.org | 555-111-2222 | pets_admin@metplus.org | 617-555-1212 | - - Given the following agency people exist: - | agency | role | first_name | last_name | email | password | - | MetPlus | AA | John | Smith | aa@metplus.org | qwerty123 | - - Given I am on the home page - And I click the "Become a hiring partner!" link - Then I should see "Company Registration" - And I fill in the fields: - | Company Name | Widgets, Inc. | - | Company Address | 12 Main Street | - | City | Detroit | - | Zipcode | 02034 | - | Email | contact@widgets.com | - | Phone | 222-333-4567 | - | Company Website | www.widgets.com | - | Employer Identification Number | 12-3456789 | - | Description | Widgets are us! | - | Title | HR Director | - | First Name | Hugh | - | Last Name | Jobs | - | Contact Phone | 555-555-1212 | - | Contact Email | hughjobs@widgets.com| - | Password | qwerty123 | - | Password Confirmation | qwerty123 | - And I click the "Submit" button - -Scenario: company registration request - Then I should see "You have successfully registered your company!" - And I should see "We also sent you an email with more information" - Then "hughjobs@widgets.com" should receive 1 email with subject "Pending approval" - When "hughjobs@widgets.com" opens the email - Then they should see "Thank you for registering Widgets, Inc. in PETS." in the email body - -Scenario: company registration approval - Given I am logged in as agency admin - And I click the "Admin" link - Then I click the "Widgets, Inc." link - Then I should see "Pending Registration" - And I click the "Approve" link - Then I should see "Company contact has been notified of registration approval." - Then "hughjobs@widgets.com" should receive an email with subject "Registration approved" - When "hughjobs@widgets.com" opens the email with subject "Registration approved" - Then they should see "Your registration of Widgets, Inc. in PETS has been approved." in the email body - And "hughjobs@widgets.com" should receive an email with subject "Confirmation instructions" - When "hughjobs@widgets.com" opens the email with subject "Confirmation instructions" - Then they should see "You can confirm your account email through the link below:" in the email body - -@selenium -Scenario: company registration delete - Given I am logged in as agency admin - And I click the "Admin" link - Then I click the "Widgets, Inc." link - And I should see "Pending Registration" - Then I click and accept the "Delete Registration" button - Then I should see "Registration for 'Widgets, Inc.' deleted." - -@selenium -Scenario: company registration rejection - Given I am logged in as agency admin - And I click the "Admin" link - Then I click the "Widgets, Inc." link - And I should see "Pending Registration" - And I click the "Deny" button - Then I should see "Explanation for registration denial" - And I fill in "Explanation:" with "We are not accepting additional partners at this time." - And I click the "Send email" button - And I wait for 3 seconds - Then I should see "Registration Denied" - Then "hughjobs@widgets.com" should receive an email with subject "Registration denied" From 7f4d70906988645883d9d06a74e7acd534d4fa33 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Fri, 15 Jan 2016 19:56:45 -0800 Subject: [PATCH 06/29] updated the gemfile --- Gemfile.lock | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a1c8d2bc7..b048ee332 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/thoughtbot/shoulda-matchers - revision: c89e9f389f3327fc825e853de8b7b809e8e25193 + revision: 15f53cd50b7680b093cca0491be67e8ce71c8650 specs: shoulda-matchers (3.1.0) activesupport (>= 4.0.0) @@ -99,9 +99,10 @@ GEM devise (>= 3.2.0) diff-lcs (1.2.5) docile (1.1.5) - email_spec (1.6.0) + email_spec (2.0.0) + htmlentities (~> 4.3.3) launchy (~> 2.1) - mail (~> 2.2) + mail (~> 2.6.3) erubis (2.7.0) execjs (2.6.0) factory_girl (4.5.0) @@ -129,11 +130,12 @@ GEM haml (~> 4.0.0) nokogiri (~> 1.6.0) ruby_parser (~> 3.5) + htmlentities (4.3.4) i18n (0.7.0) jbuilder (2.4.0) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) - jquery-rails (4.0.5) + jquery-rails (4.1.0) rails-dom-testing (~> 1.0) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -190,7 +192,7 @@ GEM activesupport (= 4.2.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.4.2) + rake (10.5.0) rdoc (4.2.1) json (~> 1.4) responders (2.1.1) @@ -215,7 +217,7 @@ GEM ruby_parser (3.7.2) sexp_processor (~> 4.1) rubyzip (1.1.7) - sass (3.4.20) + sass (3.4.21) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) sass (~> 3.1) @@ -225,7 +227,7 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - selenium-webdriver (2.48.1) + selenium-webdriver (2.49.0) childprocess (~> 0.5) multi_json (~> 1.0) rubyzip (~> 1.0) @@ -305,3 +307,6 @@ DEPENDENCIES turbolinks uglifier (>= 1.3.0) web-console (~> 2.0) + +BUNDLED WITH + 1.10.6 From 589a2731fc2a60ad1b7262b46a7b3ac70392e976 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Fri, 15 Jan 2016 20:01:12 -0800 Subject: [PATCH 07/29] modified the production env --- config/environments/production.rb | 42 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 0ad8bc750..d2a5418c5 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,6 +1,25 @@ + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. + config.action_mailer.raise_delivery_errors = true + config.action_mailer.delivery_method = :smtp + host = 'metplus.org' + config.action_mailer.default_url_options = { host: host } + + ActionMailer::Base.smtp_settings = { + :address => 'smtp.sendgrid.net', + :port => '587', + :authentication => :plain, + :user_name => ENV['SENDGRID_USERNAME'], + :password => ENV['SENDGRID_PASSWORD'], + :domain => 'heroku.com', + :enable_starttls_auto => true + } + + + + # Code is not reloaded between requests. config.cache_classes = true @@ -28,6 +47,11 @@ config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass + #Force all access to the app over SSL, use Strickt-Transportation-Security, + #and user secure cookies. + config.force_ssl = true + + # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false @@ -62,7 +86,7 @@ # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. - config.action_mailer.raise_delivery_errors = true + # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). @@ -76,19 +100,5 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - - config.action_mailer.delivery_method = :smtp - #this will take care of devise setup default url in production - config.action_mailer.default_url_options = { :host => 'metplus.org' } - - ActionMailer::Base.smtp_settings = { - :address => 'smtp.sendgrid.net', - :port => '587', - :authentication => :plain, - :user_name => ENV['SENDGRID_USERNAME'], - :password => ENV['SENDGRID_PASSWORD'], - :domain => 'heroku.com', - :enable_starttls_auto => true - } - end + From 9b907d87c0f3734a85e4c14c5214897d0d0049c3 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Fri, 15 Jan 2016 20:03:03 -0800 Subject: [PATCH 08/29] modified the env and features file --- config/environments/production.rb | 44 +++--- features/agency_admin.feature | 185 ++++++++++++++++++++++++++ features/company_registration.feature | 86 ++++++++++++ 3 files changed, 290 insertions(+), 25 deletions(-) create mode 100644 features/agency_admin.feature create mode 100644 features/company_registration.feature diff --git a/config/environments/production.rb b/config/environments/production.rb index d2a5418c5..5585c025c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,25 +1,6 @@ - Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.action_mailer.raise_delivery_errors = true - config.action_mailer.delivery_method = :smtp - host = 'metplus.org' - config.action_mailer.default_url_options = { host: host } - - ActionMailer::Base.smtp_settings = { - :address => 'smtp.sendgrid.net', - :port => '587', - :authentication => :plain, - :user_name => ENV['SENDGRID_USERNAME'], - :password => ENV['SENDGRID_PASSWORD'], - :domain => 'heroku.com', - :enable_starttls_auto => true - } - - - - # Code is not reloaded between requests. config.cache_classes = true @@ -47,11 +28,6 @@ config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass - #Force all access to the app over SSL, use Strickt-Transportation-Security, - #and user secure cookies. - config.force_ssl = true - - # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false @@ -86,7 +62,7 @@ # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. - # config.action_mailer.raise_delivery_errors = false + config.action_mailer.raise_delivery_errors = true # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). @@ -100,5 +76,23 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + config.action_mailer.delivery_method = :smtp + #this will take care of devise setup default url in production + config.action_mailer.default_url_options = { :host => 'metplus.org' } + + ActionMailer::Base.smtp_settings = { + :address => 'smtp.sendgrid.net', + :port => '587', + :authentication => :plain, + :user_name => ENV['SENDGRID_USERNAME'], + :password => ENV['SENDGRID_PASSWORD'], + :domain => 'heroku.com', + :enable_starttls_auto => true + } + end + + + diff --git a/features/agency_admin.feature b/features/agency_admin.feature new file mode 100644 index 000000000..5de7a21d1 --- /dev/null +++ b/features/agency_admin.feature @@ -0,0 +1,185 @@ +Feature: agency admin logs in and performs admin functions + + As an agency admin + I want to login to PETS + And perform various administrative functions + +Background: seed data added to database and log in as agency admim + + Given the following agency roles exist: + | role | + | AA | + | CM | + | JD | + + Given the following agencies exist: + | name | website | phone | email | fax | + | MetPlus | metplus.org | 555-111-2222 | pets_admin@metplus.org | 617-555-1212 | + + Given the following agency people exist: + | agency | role | first_name | last_name | email | password | + | MetPlus | AA | John | Smith | aa@metplus.org | qwerty123 | + | MetPlus | CM | Jane | Jones | jane@metplus.org | qwerty123 | + + Given the following agency branches exist: + | agency | city | street | zipcode | code | + | MetPlus | Detroit | 123 Main Street | 48201 | 001 | + | MetPlus | Detroit | 456 Sullivan Street | 48204 | 002 | + | MetPlus | Detroit | 3 Auto Drive | 48206 | 003 | + + Given I am on the home page + And I login as "aa@metplus.org" with password "qwerty123" + Then I should see "Signed in successfully." + And I should see "Admin" + And I click the "Admin" link + +Scenario: edit agency information + Then I should see "PETS Administration" + Then I click the "Edit Agency" button + Then I should see "MetPlus" + And I fill in "Name" with "MetPlus Two" + And I click "Update Agency" button + Then I should see "Agency was successfully updated." + And I should see "MetPlus Two" + +Scenario: cancel edit agency information + Then I click the "Edit Agency" button + Then I should see "MetPlus" + And I fill in "Name" with "MetPlus Two" + And I click the "Cancel" link + Then I should not see "Agency was successfully updated." + And I should not see "MetPlus Two" + +Scenario: errors for edit agency information + Then I click the "Edit Agency" button + Then I should see "MetPlus" + And I fill in "Phone" with "" + And I fill in "Website" with "nodomain" + And I click "Update Agency" button + Then I should see "errors prevented this record from being saved:" + And I should see "Phone can't be blank" + And I should see "Phone incorrect format" + And I should see "Website is not a valid website address" + +Scenario: edit branch + Then I should see "Agency Branches" + And I click the "001" link + Then I should see "Branch Code:" + And I should see "001" + Then I click the "Edit Branch" button + Then I should see "Edit Branch" + And I fill in "Branch Code" with "004" + And I click the "Update" button + Then I should see "Branch was successfully updated." + +Scenario: cancel edit branch + And I click the "001" link + Then I click the "Edit Branch" button + Then I should see "Edit Branch" + And I fill in "Branch Code" with "004" + Then I click the "Cancel" link + Then I should see "Agency Branch" + And I should not see "004" + +Scenario: error for edit branch + And I click the "001" link + Then I click the "Edit Branch" button + And I fill in "Branch Code" with "002" + And I fill in "Zipcode" with "1234567" + And I click the "Update" button + Then I should see "2 errors prevented this record from being saved:" + And I should see "Code has already been taken" + And I should see "Address zipcode should be in form of 12345 or 12345-1234" + +Scenario: new agency branch + And I click the "Add Branch" button + Then I fill in "Branch Code" with "004" + And I fill in "Street" with "10 Ford Way" + And I fill in "City" with "Detroit" + And I fill in "Zipcode" with "48208" + And I click the "Create" button + Then I should see "Branch was successfully created." + And I should see "004" + +@selenium +Scenario: delete agency branch + And I click the "003" link + Then I click and accept the "Delete Branch" button + Then I should see "Branch '003' deleted." + +Scenario: edit agency person + Then I should see "Agency Personnel" + And I click the "Jones, Jane" link + Then I click the "Edit Person" button + And I should see "Edit Agency Person: Jane Jones" + Then I select "002" in select list "Branch" + And I check "Agency Admin" + And I click the "Update" button + Then I should see "Agency person was successfully updated." + And I should see "Jane Jones" + And I should see "002" + And I should see "Agency Admin" + +Scenario: cancel agency person edit + And I click the "Jones, Jane" link + Then I click the "Edit Person" button + And I should see "Edit Agency Person: Jane Jones" + Then I select "002" in select list "Branch" + Then I click the "Cancel" link + Then I should see "Jane Jones" + And I should not see "002" + +@selenium +Scenario: delete agency person + And I click the "Jones, Jane" link + Then I click and accept the "Delete Person" button + Then I should see "Person 'Jane Jones' deleted." + +Scenario: cannot remove sole agency admin + And I click the "Smith, John" link + Then I click the "Edit Person" button + And I should see "Edit Agency Person: John Smith" + And I should see "Agency Admin" + And the selection "Agency Admin" should be disabled + +Scenario: invite (and reinvite) new agency person + Then I click the "Invite Person" link + And I should see "Send invitation" + And I fill in "Email" with "adam@metplus.org" + And I fill in "First name" with "Adam" + And I fill in "Last name" with "Powell" + And I click the "Send an invitation" button + And I should see "An invitation email has been sent to adam@metplus.org." + And I should see "Edit Agency Person: Adam Powell" + And I click the "Cancel" link + Then I should see "Agency Person" + And I click the "Invite Again" link + And I should see "An invitation email has been sent to adam@metplus.org." + Then "adam@metplus.org" should receive 2 emails with subject "Invitation instructions" + When "adam@metplus.org" opens the email + Then they should see "MetPlus has invited you confirm your account in PETS" in the email body + +Scenario: agency person accepts invitation in email + Then I click the "Invite Person" link + And I fill in "Email" with "adam@metplus.org" + And I fill in "First name" with "Adam" + And I fill in "Last name" with "Powell" + And I click the "Send an invitation" button + And I should see "An invitation email has been sent to adam@metplus.org." + And I log out + Then "adam@metplus.org" should receive 1 email with subject "Invitation instructions" + When "adam@metplus.org" opens the email + Then they should see "Accept invitation" in the email body + And "adam@metplus.org" follows "Accept invitation" in the email + Then they should see "Set your password" + And they fill in "Password" with "qwerty123" + And they fill in "Password confirmation" with "qwerty123" + And they click the "Set my password" button + Then they should see "Your password was set successfully. You are now signed in." + +Scenario: non-admin does not see 'admin' in menu + Given I log out + Given I am on the home page + And I login as "jane@metplus.org" with password "qwerty123" + Then I should see "Signed in successfully." + And I should not see "Admin" diff --git a/features/company_registration.feature b/features/company_registration.feature new file mode 100644 index 000000000..d78fe4668 --- /dev/null +++ b/features/company_registration.feature @@ -0,0 +1,86 @@ +Feature: management of company registrations + + As a visitor to PETS + I want to request registration of my company as a partner with the agency + And as an agency admin + I want to manage registration requests + +Background: seed data added to database + + Given the following agency roles exist: + | role | + | AA | + + Given the following agencies exist: + | name | website | phone | email | fax | + | MetPlus | metplus.org | 555-111-2222 | pets_admin@metplus.org | 617-555-1212 | + + Given the following agency people exist: + | agency | role | first_name | last_name | email | password | + | MetPlus | AA | John | Smith | aa@metplus.org | qwerty123 | + + Given I am on the home page + And I click the "Become a hiring partner!" link + Then I should see "Company Registration" + And I fill in the fields: + | Company Name | Widgets, Inc. | + | Company Address | 12 Main Street | + | City | Detroit | + | Zipcode | 02034 | + | Email | contact@widgets.com | + | Phone | 222-333-4567 | + | Company Website | www.widgets.com | + | Employer Identification Number | 12-3456789 | + | Description | Widgets are us! | + | Title | HR Director | + | First Name | Hugh | + | Last Name | Jobs | + | Contact Phone | 555-555-1212 | + | Contact Email | hughjobs@widgets.com| + | Password | qwerty123 | + | Password Confirmation | qwerty123 | + And I click the "Submit" button + +Scenario: company registration request + Then I should see "You have successfully registered your company!" + And I should see "We also sent you an email with more information" + Then "hughjobs@widgets.com" should receive 1 email with subject "Pending approval" + When "hughjobs@widgets.com" opens the email + Then they should see "Thank you for registering Widgets, Inc. in PETS." in the email body + +Scenario: company registration approval + Given I am logged in as agency admin + And I click the "Admin" link + Then I click the "Widgets, Inc." link + Then I should see "Pending Registration" + And I click the "Approve" link + Then I should see "Company contact has been notified of registration approval." + Then "hughjobs@widgets.com" should receive an email with subject "Registration approved" + When "hughjobs@widgets.com" opens the email with subject "Registration approved" + Then they should see "Your registration of Widgets, Inc. in PETS has been approved." in the email body + And "hughjobs@widgets.com" should receive an email with subject "Confirmation instructions" + When "hughjobs@widgets.com" opens the email with subject "Confirmation instructions" + Then they should see "You can confirm your account email through the link below:" in the email body + +@selenium +Scenario: company registration delete + Given I am logged in as agency admin + And I click the "Admin" link + Then I click the "Widgets, Inc." link + And I should see "Pending Registration" + Then I click and accept the "Delete Registration" button + Then I should see "Registration for 'Widgets, Inc.' deleted." + +@selenium +Scenario: company registration rejection + Given I am logged in as agency admin + And I click the "Admin" link + Then I click the "Widgets, Inc." link + And I should see "Pending Registration" + And I click the "Deny" button + Then I should see "Explanation for registration denial" + And I fill in "Explanation:" with "We are not accepting additional partners at this time." + And I click the "Send email" button + And I wait for 3 seconds + Then I should see "Registration Denied" + Then "hughjobs@widgets.com" should receive an email with subject "Registration denied" From 1076eac2f2e75734a181e4f0478bf2e088933ad9 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Fri, 15 Jan 2016 20:06:06 -0800 Subject: [PATCH 09/29] add initilize precompile to false --- config/environments/production.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/environments/production.rb b/config/environments/production.rb index 5585c025c..c50868a47 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -73,6 +73,7 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + config.assets.initialize_on_precompile = false # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false From 540246804f9d6efebdb9b3be03aa5b9a59abb557 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Fri, 15 Jan 2016 20:14:41 -0800 Subject: [PATCH 10/29] edited database.yml --- config/database.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/database.yml b/config/database.yml index 84b85ead6..197b6d505 100644 --- a/config/database.yml +++ b/config/database.yml @@ -4,6 +4,10 @@ # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # +production: + url: <%= ENV['DATABASE_URL'] %> + + default: &default adapter: sqlite3 pool: 5 From 5859e623284a73a98ed9960eed58c7fe34b1e646 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Sun, 17 Jan 2016 09:35:53 -0800 Subject: [PATCH 11/29] modified to originally setup --- config/database.yml | 4 ---- config/environments/production.rb | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/config/database.yml b/config/database.yml index 197b6d505..84b85ead6 100644 --- a/config/database.yml +++ b/config/database.yml @@ -4,10 +4,6 @@ # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # -production: - url: <%= ENV['DATABASE_URL'] %> - - default: &default adapter: sqlite3 pool: 5 diff --git a/config/environments/production.rb b/config/environments/production.rb index c50868a47..fae6144a3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -73,7 +73,7 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new - config.assets.initialize_on_precompile = false + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false From 4f3fa41439ae970814f6a6925e798ad4e8a31da5 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Mon, 18 Jan 2016 17:17:27 -0800 Subject: [PATCH 12/29] add email configuration --- config/environments/production.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index fae6144a3..abe96a35e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -80,7 +80,9 @@ config.action_mailer.delivery_method = :smtp #this will take care of devise setup default url in production - config.action_mailer.default_url_options = { :host => 'metplus.org' } + host = 'secret-savannah-8218.herokuapp.com' + # config.action_mailer.default_url_options = { :host => 'metplus.org' } + config.action_mailer.default_url_options = { host: host } ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', From b833f0848c2c25be82d291ae8367abbef417e1a0 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Mon, 18 Jan 2016 17:26:34 -0800 Subject: [PATCH 13/29] modified gemfilelock --- Gemfile.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b048ee332..73a08efd9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/thoughtbot/shoulda-matchers - revision: 15f53cd50b7680b093cca0491be67e8ce71c8650 + revision: a4b18fcc3830d4b461ee1318e70aca20fa05a1db specs: shoulda-matchers (3.1.0) activesupport (>= 4.0.0) @@ -54,7 +54,8 @@ GEM builder (3.2.2) byebug (8.2.1) cancancan (1.13.1) - capybara (2.5.0) + capybara (2.6.0) + addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -87,7 +88,7 @@ GEM rails (>= 3, < 5) database_cleaner (1.5.1) debug_inspector (0.0.2) - devise (3.5.3) + devise (3.5.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) From c6ab72514b895f8bfc41042d414c06184fa2d85e Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Mon, 18 Jan 2016 17:51:30 -0800 Subject: [PATCH 14/29] modified gemfile and env --- Gemfile | 4 ++-- config/environments/production.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 71a1f3076..12039a38a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -# ruby '2.1.8' -ruby '2.2.2' +ruby '2.1.8' +# ruby '2.2.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.3' diff --git a/config/environments/production.rb b/config/environments/production.rb index abe96a35e..c0a546b9c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -47,6 +47,7 @@ # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug + # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] From 7c5cf1b3b95b58accc2f828bd25f822e96e192c4 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Mon, 18 Jan 2016 18:01:51 -0800 Subject: [PATCH 15/29] modified gemfile --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 73a08efd9..83c6fd263 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -310,4 +310,4 @@ DEPENDENCIES web-console (~> 2.0) BUNDLED WITH - 1.10.6 + 1.11.2 From 3311453046f2ab40cbc3f19b500dbb42c0653292 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 21 Jan 2016 14:00:01 -0800 Subject: [PATCH 16/29] restored env file for production. --- app/controllers/job_seekers_controller.rb | 1 + config/environment.rb | 28 +++++++++++------------ config/environments/production.rb | 24 +++---------------- 3 files changed, 18 insertions(+), 35 deletions(-) diff --git a/app/controllers/job_seekers_controller.rb b/app/controllers/job_seekers_controller.rb index ea8db1206..f8a3f2de5 100644 --- a/app/controllers/job_seekers_controller.rb +++ b/app/controllers/job_seekers_controller.rb @@ -28,6 +28,7 @@ def update person_params.delete('password') person_params.delete('password_confirmation') end + if @jobseeker.update_attributes(person_params) sign_in :user, @jobseeker.user, bypass: true flash[:notice] = "Jobseeker was updated successfully." diff --git a/config/environment.rb b/config/environment.rb index 07ced95bd..0a0adaacd 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,16 +1,16 @@ -# # Load the Rails application. -# require File.expand_path('../application', __FILE__) +# Load the Rails application. +require File.expand_path('../application', __FILE__) -# # Initialize the Rails application. -# Rails.application.initialize! +# Initialize the Rails application. +Rails.application.initialize! -# # ActionMailer SMTP settings (see config/application.yml for values) -# ActionMailer::Base.smtp_settings = { -# user_name: ENV['SMTP_USERNAME'], -# password: ENV['SMTP_PASSWORD'], -# domain: ENV['SMTP_DOMAIN'], -# address: ENV['SMTP_ADDRESS'], -# port: ENV['SMTP_PORT'] || 587, -# authentication: :plain, -# enable_starttls_auto: true -# } \ No newline at end of file +# ActionMailer SMTP settings (see config/application.yml for values) +ActionMailer::Base.smtp_settings = { + user_name: ENV['SMTP_USERNAME'], + password: ENV['SMTP_PASSWORD'], + domain: ENV['SMTP_DOMAIN'], + address: ENV['SMTP_ADDRESS'], + port: ENV['SMTP_PORT'] || 587, + authentication: :plain, + enable_starttls_auto: true +} \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index c0a546b9c..54ef009ca 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,5 +1,4 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. +# Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true @@ -47,7 +46,6 @@ # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug - # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] @@ -74,29 +72,13 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - config.action_mailer.delivery_method = :smtp + config.action_mailer.delivery_method = :sendmail #this will take care of devise setup default url in production - host = 'secret-savannah-8218.herokuapp.com' - # config.action_mailer.default_url_options = { :host => 'metplus.org' } - config.action_mailer.default_url_options = { host: host } - - ActionMailer::Base.smtp_settings = { - :address => 'smtp.sendgrid.net', - :port => '587', - :authentication => :plain, - :user_name => ENV['SENDGRID_USERNAME'], - :password => ENV['SENDGRID_PASSWORD'], - :domain => 'heroku.com', - :enable_starttls_auto => true - } - -end - + config.action_mailer.default_url_options = { :host => 'metplus.org' } From dc6d78d81c9cf32e0d9920bfcd4e02c3acd0489c Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 21 Jan 2016 14:03:20 -0800 Subject: [PATCH 17/29] restored Gemfile.lock file --- Gemfile.lock | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 83c6fd263..8e382adc1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/thoughtbot/shoulda-matchers - revision: a4b18fcc3830d4b461ee1318e70aca20fa05a1db + revision: c89e9f389f3327fc825e853de8b7b809e8e25193 specs: shoulda-matchers (3.1.0) activesupport (>= 4.0.0) @@ -54,8 +54,7 @@ GEM builder (3.2.2) byebug (8.2.1) cancancan (1.13.1) - capybara (2.6.0) - addressable + capybara (2.5.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -88,7 +87,7 @@ GEM rails (>= 3, < 5) database_cleaner (1.5.1) debug_inspector (0.0.2) - devise (3.5.4) + devise (3.5.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) @@ -100,10 +99,9 @@ GEM devise (>= 3.2.0) diff-lcs (1.2.5) docile (1.1.5) - email_spec (2.0.0) - htmlentities (~> 4.3.3) + email_spec (1.6.0) launchy (~> 2.1) - mail (~> 2.6.3) + mail (~> 2.2) erubis (2.7.0) execjs (2.6.0) factory_girl (4.5.0) @@ -131,12 +129,11 @@ GEM haml (~> 4.0.0) nokogiri (~> 1.6.0) ruby_parser (~> 3.5) - htmlentities (4.3.4) i18n (0.7.0) jbuilder (2.4.0) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) - jquery-rails (4.1.0) + jquery-rails (4.0.5) rails-dom-testing (~> 1.0) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -193,7 +190,7 @@ GEM activesupport (= 4.2.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.5.0) + rake (10.4.2) rdoc (4.2.1) json (~> 1.4) responders (2.1.1) @@ -218,7 +215,7 @@ GEM ruby_parser (3.7.2) sexp_processor (~> 4.1) rubyzip (1.1.7) - sass (3.4.21) + sass (3.4.20) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) sass (~> 3.1) @@ -228,7 +225,7 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - selenium-webdriver (2.49.0) + selenium-webdriver (2.48.1) childprocess (~> 0.5) multi_json (~> 1.0) rubyzip (~> 1.0) @@ -308,6 +305,4 @@ DEPENDENCIES turbolinks uglifier (>= 1.3.0) web-console (~> 2.0) - -BUNDLED WITH - 1.11.2 +Status API Training Shop Blog About Pricing From 6ba74df19bfb4ed4c1fcfb108b01e3de6b3d8ded Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 21 Jan 2016 14:05:43 -0800 Subject: [PATCH 18/29] restored application.rb file --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index bf8103c90..bb8e4f458 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,4 +23,4 @@ class Application < Rails::Application # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true end -end +end \ No newline at end of file From 743be39a4e3a90e7d6fa4309cf717d07845f29b8 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 21 Jan 2016 14:08:58 -0800 Subject: [PATCH 19/29] restored Gemfile.lock file --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8e382adc1..5848441cc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -305,4 +305,4 @@ DEPENDENCIES turbolinks uglifier (>= 1.3.0) web-console (~> 2.0) -Status API Training Shop Blog About Pricing + From 5133ea0b07a59cf505e4c6a4ca667f8f05662d8c Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Sun, 24 Jan 2016 17:00:16 -0800 Subject: [PATCH 20/29] edited production env file. --- Gemfile.lock | 2 ++ config/environments/production.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 5848441cc..754a98ae7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -306,3 +306,5 @@ DEPENDENCIES uglifier (>= 1.3.0) web-console (~> 2.0) +BUNDLED WITH + 1.11.2 diff --git a/config/environments/production.rb b/config/environments/production.rb index 54ef009ca..bd579a4ba 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,4 @@ +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. From 2c973fab5fb41063334580cbd25d8cf9b2461925 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Wed, 27 Jan 2016 19:31:14 -0800 Subject: [PATCH 21/29] updated production file --- config/environments/production.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index bd579a4ba..b3ee13df8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -80,6 +80,4 @@ config.action_mailer.delivery_method = :sendmail #this will take care of devise setup default url in production config.action_mailer.default_url_options = { :host => 'metplus.org' } - - - +end From dd8aed37b70ddbd014db9c7baed6b860b7b5e444 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 28 Jan 2016 03:20:52 -0800 Subject: [PATCH 22/29] edited seed file --- db/seeds.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 63db89d08..43fa9f5bd 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -68,9 +68,9 @@ address2.update_attribute(:location, cp2) cperson = CompanyPerson.create(company_id: cp1.id, address_id: address1.id, status: "Active", title: "General Manager", - email: "salemamba@gmail.com", :password => "secrete", first_name: "salem", :last_name => "Ali") + email: "example@gmail.com", :password => "secrete", first_name: "salem", :last_name => "Ali", confirmed_at: DateTime.now) cperson2 = CompanyPerson.create(company_id: cp2.id, address_id: address2.id, status: "Active", title: "Day Manager", - email: "salemamba1@gmail.com", :password => "secrete", first_name: "Kalem", :last_name => "Kli") + email: "example1@gmail.com", :password => "secrete", first_name: "Kalem", :last_name => "Kli", confirmed_at: DateTime.now) # Job Categories From 8fa448c258d6feb4d96f8958be06f3294b7b215e Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 28 Jan 2016 03:56:54 -0800 Subject: [PATCH 23/29] puma as webserver in production --- Gemfile | 5 +++-- Gemfile.lock | 3 +++ Procfile | 1 + config/puma.rb | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 Procfile create mode 100644 config/puma.rb diff --git a/Gemfile b/Gemfile index 12039a38a..941f6352a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -ruby '2.1.8' -# ruby '2.2.2' + +ruby '2.2.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.3' @@ -88,4 +88,5 @@ group :production do # Use Postgres as the database for Active Record gem 'pg' gem 'rails_12factor' + gem 'puma' end diff --git a/Gemfile.lock b/Gemfile.lock index 754a98ae7..14eaa0d60 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -158,6 +158,8 @@ GEM cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) + puma (2.11.3) + rack (>= 1.1, < 2.0) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -293,6 +295,7 @@ DEPENDENCIES launchy pg poltergeist + puma rails (= 4.2.3) rails_12factor rspec-rails (~> 3.0) diff --git a/Procfile b/Procfile new file mode 100644 index 000000000..528ca4bfb --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bundle exec puma -C config/puma.rb \ No newline at end of file diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 000000000..60dbdb20e --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,15 @@ +workers Integer(ENV['WEB_CONCURRENCY'] || 2) +threads_count = Integer(ENV['MAX_THREADS'] || 5) +threads threads_count, threads_count + +preload_app! + +rackup DefaultRackup +port ENV['PORT'] || 3000 +environment ENV['RACK_ENV'] || 'development' + +on_worker_boot do + # Worker specific setup for Rails 4.1+ + # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot + ActiveRecord::Base.establish_connection +end \ No newline at end of file From e77ada66bcbaffc975eb0e9afae85442291d336e Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 28 Jan 2016 04:04:52 -0800 Subject: [PATCH 24/29] spiking on email function in production --- config/environments/production.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index b3ee13df8..fa0247398 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -79,5 +79,6 @@ config.action_mailer.delivery_method = :sendmail #this will take care of devise setup default url in production - config.action_mailer.default_url_options = { :host => 'metplus.org' } + host = 'evening-cove-51018.herokuapp.com' + config.action_mailer.default_url_options = { :host => host} end From 8aca09b2ae13ebe106b86339598845bf44828423 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 28 Jan 2016 04:22:14 -0800 Subject: [PATCH 25/29] restored the production file --- config/environments/production.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index fa0247398..b3ee13df8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -79,6 +79,5 @@ config.action_mailer.delivery_method = :sendmail #this will take care of devise setup default url in production - host = 'evening-cove-51018.herokuapp.com' - config.action_mailer.default_url_options = { :host => host} + config.action_mailer.default_url_options = { :host => 'metplus.org' } end From e3cfcace5868648f56d7641f6ce13a101de230b6 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 28 Jan 2016 04:37:37 -0800 Subject: [PATCH 26/29] updated seed file --- db/seeds.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index 43fa9f5bd..44bdf7771 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -226,3 +226,7 @@ email: 'frank@gmail.com', password: 'qwerty123', year_of_birth: '1970', resume: 'text', job_seeker_status: @jss3, confirmed_at: Time.now) + + + +# Think we have enough users(JS, AA, JD, CM, CP). We can login in productin env with created creditials. From 0f2a7ff046c8e4fe9940ecc00caf06a4f15d1883 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 28 Jan 2016 04:50:51 -0800 Subject: [PATCH 27/29] commented ruby version out --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 941f6352a..721e775a9 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -ruby '2.2.2' +# ruby '2.2.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.3' From 5d728fda023e3e1ab6febca0c9297479d6ec32e5 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 28 Jan 2016 09:58:19 -0800 Subject: [PATCH 28/29] temporary line will remove --- app/views/layouts/_menu.html.haml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/_menu.html.haml b/app/views/layouts/_menu.html.haml index 7c90a84d7..bdc8cc84d 100644 --- a/app/views/layouts/_menu.html.haml +++ b/app/views/layouts/_menu.html.haml @@ -28,12 +28,26 @@ %li %div{:class => 'navbar-text'} Hello, - -if current_user.actable_type == 'JobSeeker' - = link_to current_user.first_name, edit_job_seeker_path(current_user.actable_id) - -else - = link_to current_user.first_name, edit_user_registration_path(current_user) + / -if current_user.actable_type == 'JobSeeker' + / = link_to current_user.first_name, edit_job_seeker_path(current_user.actable_id) + / -else + / = link_to current_user.first_name, edit_user_registration_path(current_user) + =link_to current_user.first_name.capitalize, {controller: current_user.actable_type.underscore.pluralize,action: 'edit', id: current_user.actable_id} if !current_user.actable_type.nil? + =link_to current_user.first_name.capitalize, edit_user_registration_path(current_user) if current_user.actable_type.nil? %li %div{:class => 'button-menu'} = link_to 'Log out', logout_path, :role => 'button', method: :delete, :class => 'btn btn-default btn-xs', :id => 'logout_button' + + + + + + + + + + + =link_to current_user.first_name.capitalize, {controller: current_user.actable_type.underscore.pluralize,action: 'edit', id: current_user.actable_id} if !current_user.actable_type.nil? + =link_to current_user.first_name.capitalize, edit_user_registration_path(current_user) if current_user.actable_type.nil? \ No newline at end of file From 68576ed71721ff6f6aa4f14d4c34db67a6fe94a3 Mon Sep 17 00:00:00 2001 From: Salem Amba Date: Thu, 28 Jan 2016 10:05:13 -0800 Subject: [PATCH 29/29] restored to original form --- app/views/layouts/_menu.html.haml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/app/views/layouts/_menu.html.haml b/app/views/layouts/_menu.html.haml index bdc8cc84d..7c90a84d7 100644 --- a/app/views/layouts/_menu.html.haml +++ b/app/views/layouts/_menu.html.haml @@ -28,26 +28,12 @@ %li %div{:class => 'navbar-text'} Hello, - / -if current_user.actable_type == 'JobSeeker' - / = link_to current_user.first_name, edit_job_seeker_path(current_user.actable_id) - / -else - / = link_to current_user.first_name, edit_user_registration_path(current_user) - =link_to current_user.first_name.capitalize, {controller: current_user.actable_type.underscore.pluralize,action: 'edit', id: current_user.actable_id} if !current_user.actable_type.nil? - =link_to current_user.first_name.capitalize, edit_user_registration_path(current_user) if current_user.actable_type.nil? + -if current_user.actable_type == 'JobSeeker' + = link_to current_user.first_name, edit_job_seeker_path(current_user.actable_id) + -else + = link_to current_user.first_name, edit_user_registration_path(current_user) %li %div{:class => 'button-menu'} = link_to 'Log out', logout_path, :role => 'button', method: :delete, :class => 'btn btn-default btn-xs', :id => 'logout_button' - - - - - - - - - - - =link_to current_user.first_name.capitalize, {controller: current_user.actable_type.underscore.pluralize,action: 'edit', id: current_user.actable_id} if !current_user.actable_type.nil? - =link_to current_user.first_name.capitalize, edit_user_registration_path(current_user) if current_user.actable_type.nil? \ No newline at end of file