diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index f3564c2..62e9d46 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -12,14 +12,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - bundler_version: [2.1.1] + bundler_version: [2.2.8] faraday_version: ['~> 2.0'] steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2 + ruby-version: 3.3.1 - name: Install bundler run: gem install bundler -v ${{ matrix.bundler_version }} - name: Install dependencies @@ -33,9 +33,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby_version: ["3.2"] - rails_version: [7.0.4.2, 6.1.7.2] - bundler_version: [2.1.1] + ruby_version: [3.3.1] + rails_version: [7.1.3.2, 7.0.8.1] + bundler_version: [2.2.8] faraday_version: ['~> 2.0'] name: test ruby ${{ matrix.ruby_version }} / rails ${{ matrix.rails_version }} / faraday ${{ matrix.faraday_version }} diff --git a/geoblacklight_sidecar_images.gemspec b/geoblacklight_sidecar_images.gemspec index a7b66b8..03e330d 100644 --- a/geoblacklight_sidecar_images.gemspec +++ b/geoblacklight_sidecar_images.gemspec @@ -22,18 +22,18 @@ Gem::Specification.new do |s| s.add_dependency "image_processing", "~> 1.6" s.add_dependency "mimemagic", "~> 0.3" s.add_dependency "mini_magick", "~> 4.9.4" - s.add_dependency "rails", ">= 5.2", "< 7.1" + s.add_dependency "rails", ">= 5.2", "< 8.0" s.add_dependency "statesman", ">= 3.4" s.add_development_dependency "byebug" s.add_development_dependency "capybara" s.add_development_dependency "webdrivers" - s.add_development_dependency "database_cleaner", "~> 1.3" - s.add_development_dependency "engine_cart", "~> 2.2" - s.add_development_dependency "rspec-rails", "~> 3.0" + s.add_development_dependency "database_cleaner", "~> 2.0" + s.add_development_dependency "engine_cart", "~> 2.0" + s.add_development_dependency "rspec-rails", "~> 6.0" s.add_development_dependency "selenium-webdriver" s.add_development_dependency "simplecov", "~> 0.22" s.add_development_dependency "solr_wrapper", "~> 4.0" s.add_development_dependency "sprockets", "< 4" - s.add_development_dependency "standard", "~> 1.24" + s.add_development_dependency "standard", "~> 1.0" end diff --git a/lib/generators/geoblacklight_sidecar_images/config_generator.rb b/lib/generators/geoblacklight_sidecar_images/config_generator.rb index 705160c..e20e5f8 100644 --- a/lib/generators/geoblacklight_sidecar_images/config_generator.rb +++ b/lib/generators/geoblacklight_sidecar_images/config_generator.rb @@ -12,7 +12,7 @@ class ConfigGenerator < Rails::Generators::Base DESCRIPTION def set_active_storage_processor - app_config = <<-"APP" + app_config = <<-APP config.active_storage.variant_processor = :mini_magick APP diff --git a/lib/generators/geoblacklight_sidecar_images/jobs_generator.rb b/lib/generators/geoblacklight_sidecar_images/jobs_generator.rb index 262af31..0f2060b 100644 --- a/lib/generators/geoblacklight_sidecar_images/jobs_generator.rb +++ b/lib/generators/geoblacklight_sidecar_images/jobs_generator.rb @@ -12,7 +12,7 @@ class JobsGenerator < Rails::Generators::Base DESCRIPTION def config_development_jobs_queue_adapter - job_config = <<-"JOBS" + job_config = <<-JOBS config.active_job.queue_adapter = :inline JOBS diff --git a/lib/generators/geoblacklight_sidecar_images/models_generator.rb b/lib/generators/geoblacklight_sidecar_images/models_generator.rb index 4c5c713..58dc2a8 100644 --- a/lib/generators/geoblacklight_sidecar_images/models_generator.rb +++ b/lib/generators/geoblacklight_sidecar_images/models_generator.rb @@ -22,7 +22,7 @@ def copy_migrations end def include_sidecar_solrdocument - sidecar = <<-"SIDECAR" + sidecar = <<-SIDECAR def sidecar # Find or create, and set version sidecar = SolrDocumentSidecar.where( diff --git a/lib/generators/geoblacklight_sidecar_images/templates/helpers/blacklight/layout_helper_behavior.rb b/lib/generators/geoblacklight_sidecar_images/templates/helpers/blacklight/layout_helper_behavior.rb index cc7e04c..2dbbc04 100644 --- a/lib/generators/geoblacklight_sidecar_images/templates/helpers/blacklight/layout_helper_behavior.rb +++ b/lib/generators/geoblacklight_sidecar_images/templates/helpers/blacklight/layout_helper_behavior.rb @@ -55,8 +55,8 @@ def container_classes # # @param [Hash] options # @return [String] - def render_nav_actions(options = {}, &block) - render_filtered_partials(blacklight_config.navbar.partials, options, &block) + def render_nav_actions(options = {}, &) + render_filtered_partials(blacklight_config.navbar.partials, options, &) end ## diff --git a/lib/generators/geoblacklight_sidecar_images/templates/views/catalog/_index_split_default.html.erb b/lib/generators/geoblacklight_sidecar_images/templates/views/catalog/_index_split_default.html.erb index 44d4172..9c58adf 100644 --- a/lib/generators/geoblacklight_sidecar_images/templates/views/catalog/_index_split_default.html.erb +++ b/lib/generators/geoblacklight_sidecar_images/templates/views/catalog/_index_split_default.html.erb @@ -5,7 +5,7 @@
<% if document.sidecar.image.attached? %> <% if document.sidecar.image.variable? %> - <%= image_tag document.sidecar.image.variant(resize: "200") %> + <%= image_tag document.sidecar.image.variant(resize_to_fit: [200, 200]) %> <% else %> <%= image_tag document.sidecar.image %> <% end %> diff --git a/spec/jobs/store_image_job_spec.rb b/spec/jobs/store_image_job_spec.rb index 4819017..6fa1c0c 100644 --- a/spec/jobs/store_image_job_spec.rb +++ b/spec/jobs/store_image_job_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "rails_helper" +require "spec_helper" describe GeoblacklightSidecarImages::StoreImageJob, type: :job do let(:document) { SolrDocument.new(document_attributes) } diff --git a/spec/lib/tasks/geoblacklight_sidecar_images_spec.rb b/spec/lib/tasks/geoblacklight_sidecar_images_spec.rb index 18c3e3c..0fb0c9c 100644 --- a/spec/lib/tasks/geoblacklight_sidecar_images_spec.rb +++ b/spec/lib/tasks/geoblacklight_sidecar_images_spec.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "rails_helper" require "spec_helper" require "rake" diff --git a/spec/models/solr_document_sidecar_spec.rb b/spec/models/solr_document_sidecar_spec.rb index 2b251fe..2182272 100644 --- a/spec/models/solr_document_sidecar_spec.rb +++ b/spec/models/solr_document_sidecar_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "rails_helper" +require "spec_helper" describe SolrDocumentSidecar do let(:document) { SolrDocument.new(document_attributes) } diff --git a/spec/models/solr_document_spec.rb b/spec/models/solr_document_spec.rb index 7730fa4..107874e 100644 --- a/spec/models/solr_document_spec.rb +++ b/spec/models/solr_document_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "rails_helper" +require "spec_helper" describe Geoblacklight::SolrDocument do let(:document) { SolrDocument.new(document_attributes) } diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb deleted file mode 100644 index 65668f1..0000000 --- a/spec/rails_helper.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -ENV["RAILS_ENV"] ||= "test" - -require "spec_helper" -require "database_cleaner" -require "engine_cart" -EngineCart.load_application! - -require "rspec/rails" -# Add additional requires below this line. Rails is not loaded until this point! - -require "geoblacklight_sidecar_images" - -# Requires supporting ruby files with custom matchers and macros, etc, in -# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are -# run as spec files by default. This means that files in spec/support that end -# in _spec.rb will both be required and run as specs, causing the specs to be -# run twice. It is recommended that you do not name files matching this glob to -# end with _spec.rb. You can configure this pattern with the --pattern -# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. -# -# The following line is provided for convenience purposes. It has the downside -# of increasing the boot-up time by auto-requiring all files in the support -# directory. Alternatively, in the individual `*_spec.rb` files, manually -# require only the support files necessary. -# -# Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } - -# require 'capybara/poltergeist' -# Capybara.javascript_driver = :poltergeist - -RSpec.configure do |config| - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" - - config.before(:suite) do - DatabaseCleaner.clean_with :truncation - end - - config.before do - DatabaseCleaner.strategy = if Capybara.current_driver == :rack_test - :transaction - else - :truncation - end - DatabaseCleaner.start - end - - config.after do - DatabaseCleaner.clean - end - - config.infer_spec_type_from_file_location! -end - -def main_app - Rails.application.class.routes.url_helpers -end diff --git a/spec/services/image_service_spec.rb b/spec/services/image_service_spec.rb index c5bf630..dd70065 100644 --- a/spec/services/image_service_spec.rb +++ b/spec/services/image_service_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "rails_helper" +require "spec_helper" describe GeoblacklightSidecarImages::ImageService do # Dynamic Map Layer diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3ff14a3..5e3a6b7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,23 +1,29 @@ # frozen_string_literal: true -ENV["RAILS_ENV"] = "test" +ENV["RAILS_ENV"] ||= "test" -require "simplecov" -SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter +# require "simplecov" +# SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter -SimpleCov.start "rails" do - # @TODO - # refuse_coverage_drop -end +# SimpleCov.start "rails" do +# @TODO +# refuse_coverage_drop +# end require "database_cleaner" +require "capybara/rspec" +require "selenium-webdriver" +require "webdrivers" + +require "rails/all" +require "blacklight" +require "geoblacklight" +require "geoblacklight_sidecar_images" + require "engine_cart" EngineCart.load_application! require "rspec/rails" -require "capybara/rspec" -require "selenium-webdriver" -require "webdrivers" def json_data(filename) file_content = file_fixture("#{filename}.json").read @@ -25,6 +31,9 @@ def json_data(filename) end RSpec.configure do |config| + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.use_transactional_fixtures = false config.before do @@ -36,3 +45,7 @@ def json_data(filename) DatabaseCleaner.clean end end + +def main_app + Rails.application.class.routes.url_helpers +end diff --git a/spec/test_app_templates/Gemfile.extra b/spec/test_app_templates/Gemfile.extra index 904235f..152c792 100644 --- a/spec/test_app_templates/Gemfile.extra +++ b/spec/test_app_templates/Gemfile.extra @@ -1 +1,2 @@ -gem 'faraday', ENV["FARADAY_VERSION"].to_s != "" ? ENV["FARADAY_VERSION"] : '>= 1.0' \ No newline at end of file +gem 'faraday', ENV["FARADAY_VERSION"].to_s != "" ? ENV["FARADAY_VERSION"] : '>= 1.0' +gem 'devise' \ No newline at end of file