Fix failing test [SCI-3745]

This commit is contained in:
Oleksii Kriuchykhin 2019-09-16 10:26:13 +02:00
parent c068901b00
commit bc38c6b29e
16 changed files with 6463 additions and 1132 deletions

View file

@ -132,7 +132,7 @@ end
group :test do group :test do
gem 'capybara' gem 'capybara'
gem 'capybara-email' gem 'capybara-email'
gem 'cucumber-rails', '~> 1.7', require: false gem 'cucumber-rails', '~> 1.8', require: false
gem 'database_cleaner' gem 'database_cleaner'
gem 'json_matchers' gem 'json_matchers'
gem 'selenium-webdriver' gem 'selenium-webdriver'

View file

@ -528,8 +528,8 @@ GEM
railties (>= 4.0.0) railties (>= 4.0.0)
sdoc (1.0.0) sdoc (1.0.0)
rdoc (>= 5.0) rdoc (>= 5.0)
selenium-webdriver (3.142.3) selenium-webdriver (3.142.4)
childprocess (>= 0.5, < 2.0) childprocess (>= 0.5, < 3.0)
rubyzip (~> 1.2, >= 1.2.2) rubyzip (~> 1.2, >= 1.2.2)
shoulda-matchers (4.1.2) shoulda-matchers (4.1.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@ -621,7 +621,7 @@ DEPENDENCIES
capybara-email capybara-email
caracal-rails caracal-rails
commit_param_routing commit_param_routing
cucumber-rails (~> 1.7) cucumber-rails (~> 1.8)
database_cleaner database_cleaner
deface (~> 1.0) deface (~> 1.0)
delayed_job_active_record delayed_job_active_record

View file

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'repository_actions/duplicate_cell'
module RepositoryActions module RepositoryActions
class DuplicateRows class DuplicateRows
attr_reader :number_of_duplicated_items attr_reader :number_of_duplicated_items

View file

@ -9,7 +9,11 @@ Bundler.require(*Rails.groups)
module Scinote module Scinote
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults '6.0' config.load_defaults 6.0
config.add_autoload_paths_to_load_path = false
config.active_record.schema_format = :sql
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
@ -39,12 +43,6 @@ module Scinote
"[#{datetime}] #{severity}: #{msg}\n" "[#{datetime}] #{severity}: #{msg}\n"
end end
# Paperclip spoof checking
Paperclip.options[:content_type_mappings] = {
csv: 'text/plain',
wopitest: ['text/plain', 'inode/x-empty']
}
# SciNote Core Application version # SciNote Core Application version
VERSION = File.read(Rails.root.join('VERSION')).strip.freeze VERSION = File.read(Rails.root.join('VERSION')).strip.freeze

View file

@ -7,7 +7,7 @@ Rails.application.configure do
config.after_initialize do config.after_initialize do
Bullet.enable = true Bullet.enable = true
Bullet.bullet_logger = true Bullet.bullet_logger = true
Bullet.raise = true # raise an error if n+1 query occurs Bullet.raise = false # raise an error if n+1 query occurs
end end
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
@ -18,7 +18,7 @@ Rails.application.configure do
config.eager_load = ENV['WORKER'] ? true : false config.eager_load = ENV['WORKER'] ? true : false
# Show full error reports and disable caching. # Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
Rails.application.routes.default_url_options = { Rails.application.routes.default_url_options = {

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'active_storage/previewer/libreoffice_previewer'
Rails.application.config.active_storage.previewers = [ActiveStorage::Previewer::PopplerPDFPreviewer, Rails.application.config.active_storage.previewers = [ActiveStorage::Previewer::PopplerPDFPreviewer,
ActiveStorage::Previewer::LibreofficePreviewer] ActiveStorage::Previewer::LibreofficePreviewer]

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'i18n/custom_i18n_backend'
I18n.backend = CustomI18nBackend.new I18n.backend = CustomI18nBackend.new

File diff suppressed because it is too large Load diff

6438
db/structure.sql Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,13 @@
# frozen_string_literal: true
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a # It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file # newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb # instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files. # files.
ENV['CR_REMOVE_RACK_TEST_HELPERS'] = 'true'
require 'cucumber/rails' require 'cucumber/rails'
require 'capybara' require 'capybara'
require 'capybara/cucumber' require 'capybara/cucumber'
@ -19,9 +23,10 @@ require 'selenium/webdriver'
World(Capybara::Email::DSL) World(Capybara::Email::DSL)
Capybara.register_driver :chrome do |app| Capybara.register_driver :chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new(args: %w(no-sandbox headless disable-gpu)) service = Selenium::WebDriver::Chrome::Service.new(args: ['--whitelisted-ips'])
options = Selenium::WebDriver::Chrome::Options.new(args: %w(no-sandbox headless disable-dev-shm-usage disable-gpu))
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) Capybara::Selenium::Driver.new(app, browser: :chrome, options: options, service: service)
end end
Capybara.javascript_driver = :chrome Capybara.javascript_driver = :chrome
@ -53,7 +58,7 @@ ActionController::Base.allow_rescue = false
begin begin
require 'database_cleaner' require 'database_cleaner'
require 'database_cleaner/cucumber' require 'database_cleaner/cucumber'
DatabaseCleaner.strategy = :truncation DatabaseCleaner.strategy = :transaction
rescue NameError rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end end
@ -77,3 +82,4 @@ end
# The :transaction strategy is faster, but might give you threading problems. # The :transaction strategy is faster, but might give you threading problems.
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
Cucumber::Rails::Database.javascript_strategy = :truncation Cucumber::Rails::Database.javascript_strategy = :truncation
Cucumber::Rails::Database.autorun_database_cleaner = false

View file

@ -1,4 +1,5 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true
vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
if vendored_cucumber_bin if vendored_cucumber_bin

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'rails_helper' require 'rails_helper'
require 'smart_annotations/html_preview'
describe SmartAnnotations::HtmlPreview do describe SmartAnnotations::HtmlPreview do
let(:subject) { described_class } let(:subject) { described_class }

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'rails_helper' require 'rails_helper'
require 'smart_annotations/text_preview'
describe SmartAnnotations::TextPreview do describe SmartAnnotations::TextPreview do
let(:subject) { described_class } let(:subject) { described_class }