diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 82c5213..4d481ea 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -206,8 +206,14 @@ RSpec/ExpectChange: # Include: **/*_spec*rb*, **/spec/**/* RSpec/FilePath: Exclude: - - 'spec/importers/activity_insight/ai_integrate_data_spec.rb' - - 'spec/importers/yearly_data/yearly_data_importer_spec.rb' + - 'spec/integration/ai_backups_page_spec.rb' + - 'spec/integration/ai_integration/error_redirect_spec.rb' + - 'spec/integration/ai_integration/integration_in_progress_spec.rb' + - 'spec/integration/cv_parser_spec.rb' + - 'spec/integration/main_spec.rb' + +RSpec/SpecFilePathFormat: + Exclude: - 'spec/integration/ai_backups_page_spec.rb' - 'spec/integration/ai_integration/error_redirect_spec.rb' - 'spec/integration/ai_integration/integration_in_progress_spec.rb' diff --git a/Gemfile b/Gemfile index c0e3b76..7a85b6b 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ gem 'ed25519' # For scheduled tasks gem 'whenever' -gem 'rails', '~> 7.0.5.1' +gem 'rails', '~> 7.0.7.1' # Use mysql as the database for Active Record # ActiveRecord only works with specific versions of mysql2. gem 'mysql2', '~> 0.5.4' diff --git a/Gemfile.lock b/Gemfile.lock index 01b90da..de57e3b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,84 +2,84 @@ GEM remote: https://rubygems.org/ specs: Ascii85 (1.1.0) - actioncable (7.0.5.1) - actionpack (= 7.0.5.1) - activesupport (= 7.0.5.1) + actioncable (7.0.7.2) + actionpack (= 7.0.7.2) + activesupport (= 7.0.7.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.5.1) - actionpack (= 7.0.5.1) - activejob (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionmailbox (7.0.7.2) + actionpack (= 7.0.7.2) + activejob (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.5.1) - actionpack (= 7.0.5.1) - actionview (= 7.0.5.1) - activejob (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionmailer (7.0.7.2) + actionpack (= 7.0.7.2) + actionview (= 7.0.7.2) + activejob (= 7.0.7.2) + activesupport (= 7.0.7.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.5.1) - actionview (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionpack (7.0.7.2) + actionview (= 7.0.7.2) + activesupport (= 7.0.7.2) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.5.1) - actionpack (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + actiontext (7.0.7.2) + actionpack (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.5.1) - activesupport (= 7.0.5.1) + actionview (7.0.7.2) + activesupport (= 7.0.7.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.5.1) - activesupport (= 7.0.5.1) + activejob (7.0.7.2) + activesupport (= 7.0.7.2) globalid (>= 0.3.6) - activemodel (7.0.5.1) - activesupport (= 7.0.5.1) - activerecord (7.0.5.1) - activemodel (= 7.0.5.1) - activesupport (= 7.0.5.1) - activestorage (7.0.5.1) - actionpack (= 7.0.5.1) - activejob (= 7.0.5.1) - activerecord (= 7.0.5.1) - activesupport (= 7.0.5.1) + activemodel (7.0.7.2) + activesupport (= 7.0.7.2) + activerecord (7.0.7.2) + activemodel (= 7.0.7.2) + activesupport (= 7.0.7.2) + activestorage (7.0.7.2) + actionpack (= 7.0.7.2) + activejob (= 7.0.7.2) + activerecord (= 7.0.7.2) + activesupport (= 7.0.7.2) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.5.1) + activesupport (7.0.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.1) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) afm (0.2.2) - airbrussh (1.4.1) + airbrussh (1.5.1) sshkit (>= 1.6.1, != 1.7.0) - anystyle (1.3.14) - anystyle-data (~> 1.2) + anystyle (1.4.2) + anystyle-data (~> 1.3) bibtex-ruby (~> 6.0) namae (~> 1.0) - wapiti (~> 2.0) + wapiti (~> 2.1) anystyle-data (1.3.0) ast (2.4.2) - autoprefixer-rails (10.4.7.0) + autoprefixer-rails (10.4.16.0) execjs (~> 2) bcrypt_pbkdf (1.1.0) bibtex-ruby (6.0.0) @@ -96,7 +96,7 @@ GEM bundler (>= 1.2.0, < 3) thor (~> 1.0) byebug (11.1.3) - capistrano (3.17.1) + capistrano (3.18.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) @@ -105,7 +105,7 @@ GEM capistrano (~> 3.1) capistrano-passenger (0.2.1) capistrano (~> 3.0) - capistrano-rails (1.6.2) + capistrano-rails (1.6.3) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) capistrano-rbenv (2.2.0) @@ -114,7 +114,7 @@ GEM capistrano-rbenv-install (1.2.0) capistrano (>= 3.0) capistrano-rbenv (>= 2.0) - capybara (3.38.0) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -126,7 +126,7 @@ GEM capybara-webkit (1.15.1) capybara (>= 2.3, < 4.0) json - caxlsx (3.3.0) + caxlsx (4.0.0) htmlentities (~> 4.3, >= 4.3.4) marcel (~> 1.0) nokogiri (~> 1.10, >= 1.10.4) @@ -147,12 +147,12 @@ GEM crack (0.4.5) rexml crass (1.0.6) - creek (2.6.2) + creek (2.6.3) nokogiri (>= 1.10.0) rubyzip (>= 1.0.0) - database_cleaner (2.0.1) - database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.1) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.1.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) @@ -161,17 +161,17 @@ GEM docile (1.4.0) ed25519 (1.3.0) erubi (1.12.0) - execjs (2.8.1) + execjs (2.9.1) exiftool (1.2.4) json - exiftool_vendored (12.52.0) + exiftool_vendored (12.72.0) exiftool (>= 0.7.0) - factory_bot (6.2.1) + factory_bot (6.4.5) activesupport (>= 5.0.0) - ffi (1.15.5) + ffi (1.16.3) globalid (1.2.1) activesupport (>= 6.1) - hashdiff (1.0.1) + hashdiff (1.1.0) hashery (2.1.2) headless (2.3.1) htmlentities (4.3.4) @@ -187,10 +187,11 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.6.3) + json (2.7.1) + language_server-protocol (3.17.0.3) latex-decode (0.4.0) - libv8-node (16.10.0.0) - listen (3.7.1) + libv8-node (18.16.0.0) + listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.22.0) @@ -206,60 +207,64 @@ GEM method_source (1.0.0) mini_mime (1.1.5) mini_portile2 (2.8.5) - mini_racer (0.6.3) - libv8-node (~> 16.10.0.0) + mini_racer (0.8.0) + libv8-node (~> 18.16.0.0) minitest (5.20.0) multi_xml (0.6.0) - mysql2 (0.5.4) + mutex_m (0.2.0) + mysql2 (0.5.5) namae (1.1.1) - net-imap (0.4.5) + net-imap (0.4.9.1) date net-protocol - net-ldap (0.17.1) + net-ldap (0.19.0) net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout net-scp (4.0.0) net-ssh (>= 2.6.5, < 8.0.0) - net-smtp (0.4.0) + net-sftp (4.0.0) + net-ssh (>= 5.0.0, < 8.0.0) + net-smtp (0.4.0.1) net-protocol - net-ssh (7.0.1) + net-ssh (7.2.1) nio4r (2.5.8) - nokogiri (1.15.5) + nokogiri (1.16.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) - parallel (1.22.1) - parser (3.2.0.0) + parallel (1.24.0) + parser (3.3.0.2) ast (~> 2.4.1) - pdf-reader (2.11.0) + racc + pdf-reader (2.12.0) Ascii85 (~> 1.0) afm (~> 0.2.1) hashery (~> 2.0) ruby-rc4 ttfunk popper_js (1.16.1) - public_suffix (5.0.1) + public_suffix (5.0.4) puma (5.6.8) nio4r (~> 2.0) racc (1.6.2) rack (2.2.8) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.5.1) - actioncable (= 7.0.5.1) - actionmailbox (= 7.0.5.1) - actionmailer (= 7.0.5.1) - actionpack (= 7.0.5.1) - actiontext (= 7.0.5.1) - actionview (= 7.0.5.1) - activejob (= 7.0.5.1) - activemodel (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + rails (7.0.7.2) + actioncable (= 7.0.7.2) + actionmailbox (= 7.0.7.2) + actionmailer (= 7.0.7.2) + actionpack (= 7.0.7.2) + actiontext (= 7.0.7.2) + actionview (= 7.0.7.2) + activejob (= 7.0.7.2) + activemodel (= 7.0.7.2) + activerecord (= 7.0.7.2) + activestorage (= 7.0.7.2) + activesupport (= 7.0.7.2) bundler (>= 1.15.0) - railties (= 7.0.5.1) + railties (= 7.0.7.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -271,9 +276,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.5.1) - actionpack (= 7.0.5.1) - activesupport (= 7.0.5.1) + railties (7.0.7.2) + actionpack (= 7.0.7.2) + activesupport (= 7.0.7.2) method_source rake (>= 12.2) thor (~> 1.0) @@ -283,53 +288,55 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.6.1) - rexml (3.2.5) - rspec-core (3.12.0) + regexp_parser (2.9.0) + rexml (3.2.6) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.1) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.1) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (6.0.1) + rspec-rails (6.1.0) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.11) - rspec-expectations (~> 3.11) - rspec-mocks (~> 3.11) - rspec-support (~> 3.11) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.12.0) - rubocop (1.42.0) + rspec-support (3.12.1) + rubocop (1.59.0) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.1.2.1) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.24.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.24.1) - parser (>= 3.1.1.0) - rubocop-capybara (2.18.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.20.0) rubocop (~> 1.41) - rubocop-factory_bot (2.23.1) - rubocop (~> 1.33) - rubocop-rails (2.20.2) + rubocop-factory_bot (2.25.1) + rubocop (~> 1.41) + rubocop-rails (2.23.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.23.2) - rubocop (~> 1.33) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rspec (2.26.1) + rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) ruby-ole (1.2.12.2) - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) rubyzip (2.3.2) sass-rails (6.0.0) @@ -342,7 +349,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.7.1) + selenium-webdriver (4.16.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -355,22 +362,24 @@ GEM simplecov-html (0.10.2) spreadsheet (1.3.0) ruby-ole - spring (4.1.0) + spring (4.1.3) spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) spring (>= 4) - sprockets (4.2.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sshkit (1.21.3) + sshkit (1.22.0) + mutex_m net-scp (>= 1.1.2) + net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) thor (1.3.0) - tilt (2.0.11) + tilt (2.3.0) timeout (0.4.1) ttfunk (1.7.0) turbolinks (5.2.1) @@ -380,21 +389,21 @@ GEM concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) wapiti (2.1.0) builder (~> 3.2) rexml (~> 3.0) - web-console (4.2.0) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.18.1) + webmock (3.19.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.7.0) - websocket (1.2.9) + webrick (1.8.1) + websocket (1.2.10) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -441,7 +450,7 @@ DEPENDENCIES pdf-reader puma (~> 5.6) racc (= 1.6.2) - rails (~> 7.0.5.1) + rails (~> 7.0.7.1) rails-controller-testing rspec-rails (~> 6.0) rspec-retry diff --git a/app/importers/lionpath_data/lionpath_parser.rb b/app/importers/lionpath_data/lionpath_parser.rb index 4e224e3..d416ee6 100644 --- a/app/importers/lionpath_data/lionpath_parser.rb +++ b/app/importers/lionpath_data/lionpath_parser.rb @@ -61,11 +61,11 @@ def remove_duplicates def write_flagged_to_xl(filename = 'data/flagged_more_than_two.xls') wb = Spreadsheet::Workbook.new filename sheet = wb.create_worksheet - @flagged[0].each do |k, _v| + @flagged[0].each_key do |k| sheet.row(0).push(k) end @flagged.uniq.each_with_index do |row, index| - row.each do |_k, v| + row.each_value do |v| sheet.row(index + 1).push(v) end end diff --git a/app/importers/yearly_data/import_yearly_data.rb b/app/importers/yearly_data/import_yearly_data.rb index 7d2f16c..6d23794 100644 --- a/app/importers/yearly_data/import_yearly_data.rb +++ b/app/importers/yearly_data/import_yearly_data.rb @@ -23,9 +23,9 @@ def convert_xlsx_to_hash(yearly_data_book) yearly_data_book.each_with_index do |row, index| values = [] if index == 0 - row.each { |_k, v| keys << v } + row.each_value { |v| keys << v } else - row.each { |_k, v| values << v } + row.each_value { |v| values << v } data << values end counter += 1 diff --git a/config/deploy.rb b/config/deploy.rb index c5f2fa3..f449b12 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -53,7 +53,7 @@ namespace :deploy do task :symlink_shared do desc 'set up the shared directory to have the symbolic links to the appropriate directories shared between servers' - puts release_path.to_s + puts release_path on roles(:web) do execute "ln -sf /rubytools/#{fetch(:application)}/config_#{fetch(:stage)}/#{fetch(:partner)}database.yml #{release_path}/config/database.yml" execute "ln -sf /rubytools/#{fetch(:application)}/config_#{fetch(:stage)}/#{fetch(:partner)}secrets.yml #{release_path}/config/secrets.yml" diff --git a/spec/importers/activity_insight/get_user_data_spec.rb b/spec/importers/activity_insight/get_user_data_spec.rb index 14d897a..c81add5 100644 --- a/spec/importers/activity_insight/get_user_data_spec.rb +++ b/spec/importers/activity_insight/get_user_data_spec.rb @@ -21,7 +21,7 @@ expect(Faculty.find(faculty1.id)).to be_present allow(Spreadsheet).to receive_message_chain(:open, :worksheet) { fake_book } get_user_data_obj.call - expect(Faculty.all.count).to eq(1) + expect(Faculty.count).to eq(1) expect(Faculty.find_by(access_id: 'zzz999').f_name).to eq('Bill') expect(Faculty.find_by(access_id: 'zzz999').college).to eq('MD') expect(Faculty.find_by(access_id: 'zzz999').campus).to eq('UP') diff --git a/spec/importers/activity_insight/ai_integrate_data_spec.rb b/spec/importers/activity_insight/integrate_data_spec.rb similarity index 100% rename from spec/importers/activity_insight/ai_integrate_data_spec.rb rename to spec/importers/activity_insight/integrate_data_spec.rb diff --git a/spec/importers/com_data/com_effort_populate_db_spec.rb b/spec/importers/com_data/com_effort_populate_db_spec.rb index ccaacb5..8ec5654 100644 --- a/spec/importers/com_data/com_effort_populate_db_spec.rb +++ b/spec/importers/com_data/com_effort_populate_db_spec.rb @@ -45,7 +45,7 @@ com_effort_populate_db_obj.com_parser = ComData::ComParser.allocate com_effort_populate_db_obj.com_parser.csv_hash = fake_sheet com_effort_populate_db_obj.populate - expect(ComEffort.all.count).to eq(3) + expect(ComEffort.count).to eq(3) expect(ComEffort.where(com_id: 'hgranger').count).to eq(2) expect(ComEffort.find_by(com_id: 'hgranger').course).to eq('Dark Arts') expect(ComEffort.find_by(com_id: 'hgranger').course_year).to eq('2001-2002') diff --git a/spec/importers/com_data/com_quality_populate_db_spec.rb b/spec/importers/com_data/com_quality_populate_db_spec.rb index b882324..021c977 100644 --- a/spec/importers/com_data/com_quality_populate_db_spec.rb +++ b/spec/importers/com_data/com_quality_populate_db_spec.rb @@ -40,7 +40,7 @@ com_quality_populate_db_obj.com_parser = ComData::ComParser.allocate com_quality_populate_db_obj.com_parser.csv_hash = fake_sheet com_quality_populate_db_obj.populate - expect(ComQuality.all.count).to eq(3) + expect(ComQuality.count).to eq(3) expect(ComQuality.where(com_id: 'spiderman').count).to eq(2) expect(ComQuality.find_by(com_id: 'spiderman').course).to eq('Climbing') expect(ComQuality.find_by(com_id: 'batman').event_type).to eq('Lecture') diff --git a/spec/importers/ldap_data/import_ldap_data_spec.rb b/spec/importers/ldap_data/import_ldap_data_spec.rb index 2d4f196..90c59b8 100644 --- a/spec/importers/ldap_data/import_ldap_data_spec.rb +++ b/spec/importers/ldap_data/import_ldap_data_spec.rb @@ -1,6 +1,6 @@ require 'importers/importers_helper' -RSpec.describe LdapData::ImportLdapData, ldap: true do +RSpec.describe LdapData::ImportLdapData, :ldap do before do faculty2 = Faculty.create!(access_id: 'ajk5603') end diff --git a/spec/importers/lionpath_data/lionpath_populate_db_spec.rb b/spec/importers/lionpath_data/lionpath_populate_db_spec.rb index e28bc2c..47eee2e 100644 --- a/spec/importers/lionpath_data/lionpath_populate_db_spec.rb +++ b/spec/importers/lionpath_data/lionpath_populate_db_spec.rb @@ -47,10 +47,10 @@ lionpath_populate_db_obj.lionpath_parser = LionpathData::LionpathParser.allocate lionpath_populate_db_obj.lionpath_parser.csv_hash = fake_sheet lionpath_populate_db_obj.populate - expect(Course.all.count).to eq(3) - expect(Faculty.all.count).to eq(3) - expect(Section.all.count).to eq(4) - expect(Faculty.find_by(access_id: 'abc123').sections.all.count).to eq(2) + expect(Course.count).to eq(3) + expect(Faculty.count).to eq(3) + expect(Section.count).to eq(4) + expect(Faculty.find_by(access_id: 'abc123').sections.count).to eq(2) expect(Faculty.find_by(access_id: 'ghi789').sections.first.course.academic_course_id).to eq(2222) expect(Faculty.find_by(access_id: 'ghi789').sections.first.instructor_role).to eq('Primary Instructor') end diff --git a/spec/importers/osp_data/osp_importer_spec.rb b/spec/importers/osp_data/osp_importer_spec.rb index 849e6a7..2c80043 100644 --- a/spec/importers/osp_data/osp_importer_spec.rb +++ b/spec/importers/osp_data/osp_importer_spec.rb @@ -192,11 +192,11 @@ allow_any_instance_of(OspData::OspImporter).to receive(:is_good_date).and_return(true) allow_any_instance_of(OspData::OspImporter).to receive(:is_proper_status).and_return(true) osp_parser_obj.format_and_populate - expect(Sponsor.all.count).to eq(2) - expect(Contract.all.count).to eq(3) - expect(Faculty.all.count).to eq(6) - expect(ContractFacultyLink.all.count).to eq(4) - expect(Faculty.find_by(access_id: 'abc123').contract_faculty_links.all.count).to eq(2) + expect(Sponsor.count).to eq(2) + expect(Contract.count).to eq(3) + expect(Faculty.count).to eq(6) + expect(ContractFacultyLink.count).to eq(4) + expect(Faculty.find_by(access_id: 'abc123').contract_faculty_links.count).to eq(2) expect(Faculty.find_by(access_id: 'abc123').contract_faculty_links.first.contract.sponsor.sponsor_name).to eq('Cool Sponsor') expect(Contract.find_by(osp_key: 1234).notfunded).to eq(Date.parse('Sun, 02 Feb 2015')) end diff --git a/spec/importers/pub_data/pub_populate_db_spec.rb b/spec/importers/pub_data/pub_populate_db_spec.rb index 965d2d6..c7b5af9 100644 --- a/spec/importers/pub_data/pub_populate_db_spec.rb +++ b/spec/importers/pub_data/pub_populate_db_spec.rb @@ -38,7 +38,7 @@ pub_populate.populate(fake_data) - expect(Publication.all.count).to eq(3) + expect(Publication.count).to eq(3) expect(Publication.first.title).to eq('Test 1') expect(Publication.first.pure_ids).to eq(['1fj9184-j1ir-148']) expect(Publication.first.volume).to eq(1) @@ -53,7 +53,7 @@ expect(Publication.first.authors_et_al).to eq(nil) expect(Publication.first.ai_ids).to eq([]) expect(Faculty.find_by(access_id: 'abc123').publication_faculty_links.first.publication.external_authors.first.f_name).to eq('Alex') - expect(Faculty.find_by(access_id: 'abc123').publication_faculty_links.first.publication.external_authors.all.count).to eq(1) + expect(Faculty.find_by(access_id: 'abc123').publication_faculty_links.first.publication.external_authors.count).to eq(1) expect(Publication.first.publication_faculty_links.first.category).to eq('Academic Journal Article') expect(Publication.first.publication_faculty_links.first.dtm).to eq('January (1st Quarter/Winter)') expect(Publication.first.publication_faculty_links.first.status).to eq('Published') diff --git a/spec/importers/yearly_data/yearly_data_importer_spec.rb b/spec/importers/yearly_data/import_yearly_data_spec.rb similarity index 100% rename from spec/importers/yearly_data/yearly_data_importer_spec.rb rename to spec/importers/yearly_data/import_yearly_data_spec.rb diff --git a/spec/integration/ai_integration/com_effort_integration_spec.rb b/spec/integration/ai_integration/com_effort_integration_spec.rb index bdb671d..c9a4890 100644 --- a/spec/integration/ai_integration/com_effort_integration_spec.rb +++ b/spec/integration/ai_integration/com_effort_integration_spec.rb @@ -25,7 +25,7 @@ Rails.application.config_for(:integration_passcode)[:passcode] end - context 'when Com Effort Integration is selected', js: true, type: :feature do + context 'when Com Effort Integration is selected', :js, type: :feature do before do stub_request(:post, 'https://betawebservices.digitalmeasures.com/login/service/v4/SchemaData/INDIVIDUAL-ACTIVITIES-University') .with( diff --git a/spec/integration/ai_integration/com_quality_integration_spec.rb b/spec/integration/ai_integration/com_quality_integration_spec.rb index 401594c..9a794e1 100644 --- a/spec/integration/ai_integration/com_quality_integration_spec.rb +++ b/spec/integration/ai_integration/com_quality_integration_spec.rb @@ -25,7 +25,7 @@ Rails.application.config_for(:integration_passcode)[:passcode] end - context 'when COM Quality Integration is selected', js: true, type: :feature do + context 'when COM Quality Integration is selected', :js, type: :feature do before do stub_request(:post, 'https://betawebservices.digitalmeasures.com/login/service/v4/SchemaData/INDIVIDUAL-ACTIVITIES-University') .with( diff --git a/spec/integration/ai_integration/integration_in_progress_spec.rb b/spec/integration/ai_integration/integration_in_progress_spec.rb index d59fea2..7284fb0 100644 --- a/spec/integration/ai_integration/integration_in_progress_spec.rb +++ b/spec/integration/ai_integration/integration_in_progress_spec.rb @@ -3,14 +3,14 @@ RSpec.describe AiIntegrationController do let!(:integration) { FactoryBot.create(:integration) } - context 'when an integration is currently running', js: true, type: :feature do + context 'when an integration is currently running', :js, type: :feature do it 'does not render submit buttons and displays message' do allow(Integration).to receive(:running?).and_return true visit ai_integration_path select('Contract/Grant Integration', from: 'label_integration_type').select_option expect(page).to have_content 'An integration is currently in progress' - expect(page).not_to have_button 'Beta' - expect(page).not_to have_button 'Production' + expect(page).to have_no_button 'Beta' + expect(page).to have_no_button 'Production' end end end diff --git a/spec/integration/ai_integration/ldap_integration_spec.rb b/spec/integration/ai_integration/ldap_integration_spec.rb index 4ef8fa4..457e921 100644 --- a/spec/integration/ai_integration/ldap_integration_spec.rb +++ b/spec/integration/ai_integration/ldap_integration_spec.rb @@ -27,7 +27,7 @@ .to_return(status: 200, body: 'Success', headers: {}) end - context 'when Personal & Contact Integration is selected', js: true, type: :feature do + context 'when Personal & Contact Integration is selected', :js, type: :feature do it 'gets ldap data and sends data to activity insight' do visit ai_integration_path select('Personal & Contact Integration', from: 'label_integration_type').select_option diff --git a/spec/integration/ai_integration/lionpath_integration_spec.rb b/spec/integration/ai_integration/lionpath_integration_spec.rb index 30c1a0c..0d41629 100644 --- a/spec/integration/ai_integration/lionpath_integration_spec.rb +++ b/spec/integration/ai_integration/lionpath_integration_spec.rb @@ -22,7 +22,7 @@ Rails.application.config_for(:integration_passcode)[:passcode] end - context 'when Courses Taught Integration is selected', js: true, type: :feature do + context 'when Courses Taught Integration is selected', :js, type: :feature do before do @courses = fixture_file_upload('spec/fixtures/schteach.csv') diff --git a/spec/integration/ai_integration/osp_integration_spec.rb b/spec/integration/ai_integration/osp_integration_spec.rb index d1b8fd8..a87ada9 100644 --- a/spec/integration/ai_integration/osp_integration_spec.rb +++ b/spec/integration/ai_integration/osp_integration_spec.rb @@ -23,7 +23,7 @@ Rails.application.config_for(:integration_passcode)[:passcode] end - context 'when Contract/Grant Integration is selected', js: true, type: :feature do + context 'when Contract/Grant Integration is selected', :js, type: :feature do before do @contract_grants = fixture_file_upload('spec/fixtures/contract_grants.csv') @congrant_backup = fixture_file_upload('spec/fixtures/congrant_backup.csv') diff --git a/spec/integration/ai_integration/publications_integration_spec.rb b/spec/integration/ai_integration/publications_integration_spec.rb index 820d054..50bf464 100644 --- a/spec/integration/ai_integration/publications_integration_spec.rb +++ b/spec/integration/ai_integration/publications_integration_spec.rb @@ -23,7 +23,7 @@ Rails.application.config_for(:integration_passcode)[:passcode] end - context 'when RMD Publications Integration is selected', js: true, type: :feature do + context 'when RMD Publications Integration is selected', :js, type: :feature do before do @pubs = File.read('spec/fixtures/metadata_pub_json.json').to_s diff --git a/spec/integration/ai_integration/yearly_integration_spec.rb b/spec/integration/ai_integration/yearly_integration_spec.rb index 46ceb05..2461c7d 100644 --- a/spec/integration/ai_integration/yearly_integration_spec.rb +++ b/spec/integration/ai_integration/yearly_integration_spec.rb @@ -15,7 +15,7 @@ .to_return(status: 200, body: '', headers: {}) end - context 'when passcode is supplied and beta integration is clicked', js: true, type: :feature do + context 'when passcode is supplied and beta integration is clicked', :js, type: :feature do it 'integrates yearly data into AI beta' do visit ai_integration_path select('Yearly Integration', from: 'label_integration_type').select_option diff --git a/spec/integration/cv_parser_spec.rb b/spec/integration/cv_parser_spec.rb index 2d5d0c9..f3a75bd 100644 --- a/spec/integration/cv_parser_spec.rb +++ b/spec/integration/cv_parser_spec.rb @@ -46,7 +46,7 @@ it 'clicks link to delete publication listing' do visit publication_listings_path - expect { click_link '[Delete]' }.to change { PublicationListing.count }.by(-1) + expect { click_on '[Delete]' }.to change { PublicationListing.count }.by(-1) expect(page).to have_current_path(publication_listings_path) end end diff --git a/spec/integration/update_works_spec.rb b/spec/integration/update_works_spec.rb index a94bf52..ea2035a 100644 --- a/spec/integration/update_works_spec.rb +++ b/spec/integration/update_works_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'Updating works', js: true, type: :feature do +RSpec.describe 'Updating works', :js, type: :feature do let!(:faculty) { FactoryBot.create(:faculty) } let!(:publication_listing) { FactoryBot.create(:publication_listing) } let!(:work) { FactoryBot.create(:work, publication_listing:) } @@ -10,7 +10,7 @@ describe 'modifying and updating data' do it 'updates the data in db' do visit "publication_listings/#{publication_listing.id}/works" - click_link 'Add Author' + click_on 'Add Author' author_fields = all("input[name^='publication_listing[works_attributes][0][authors_attributes]']") author_fields[3].set('Test') author_fields[4].set('T.') @@ -19,7 +19,7 @@ find_by_id('publication_listing_works_attributes_0_date').set('September 23-30, 2010') all("i[class='fa remove-nested fa-close']").last.trigger('click') find_by_id('publication_listing_works_attributes_0_isbn').set('1234567890') - click_button 'Update Works' + click_on 'Update Works' sleep 1 expect(Author.count).to eq 2 expect(Author.second.m_name).to eq 'T.' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 30df229..2585016 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -66,7 +66,7 @@ DatabaseCleaner.strategy = :transaction end - config.before(:each, js: true) do + config.before(:each, :js) do DatabaseCleaner.strategy = :truncation end