Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,24 @@ jobs:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
gemfile:
- gemfiles/Gemfile.rails61
- gemfiles/Gemfile.rails70
# Rails 7.1.2 conflicts with latest ndr_support 5.10.0 default to_s handling.
#- gemfiles/Gemfile.rails71
- gemfiles/Gemfile.rails71
- gemfiles/Gemfile.rails72
- gemfiles/Gemfile.rails80
exclude:
# rails 7.0 requires ruby >= 2.7
# rails 7.2 requires ruby >= 3.1
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
- ruby-version: '2.6'
gemfile: 'gemfiles/Gemfile.rails70'
- ruby-version: '3.0'
gemfile: 'gemfiles/Gemfile.rails72'
# rails 8.0 requires ruby >= 3.2
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
- ruby-version: '3.0'
gemfile: 'gemfiles/Gemfile.rails80'
- ruby-version: '3.1'
gemfile: 'gemfiles/Gemfile.rails80'

name: Ruby ${{ matrix.ruby-version }} / Bundle ${{ matrix.gemfile }}

Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [Unreleased]
=======
* no unreleased changes *
### Fixed
* Support Ruby 3.2 and 3.3, Rails 7.1, 7.2 and 8.0

## 11.2.0 / 2024-04-10
### Added
Expand Down
5 changes: 5 additions & 0 deletions gemfiles/Gemfile.rails72
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gemspec path: '..'

gem 'activesupport', '~> 7.2.0'
5 changes: 5 additions & 0 deletions gemfiles/Gemfile.rails80
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gemspec path: '..'

gem 'activesupport', '~> 8.0.0'
6 changes: 5 additions & 1 deletion lib/ndr_import/csv_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ def read_csv_from_file(filepath)

private

def deprecator
@deprecator ||= ActiveSupport::Deprecation.new(NdrImport::VERSION, 'NdrImport')
end

def deprecate(additional_message = nil)
ActiveSupport::Deprecation.warn(<<~MESSAGE)
deprecator.warn(<<~MESSAGE)
CSVLibrary is deprecated, and will be removed in a future version of ndr_import.
Please use standard functionality provided by Ruby's CSV library (#{additional_message}).
MESSAGE
Expand Down
3 changes: 2 additions & 1 deletion ndr_import.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']

spec.add_dependency 'activemodel'
spec.add_dependency 'activesupport', '>= 6.1', '< 7.1'
spec.add_dependency 'activesupport', '>= 6.1', '< 8.1'
spec.add_dependency 'ndr_support', '>= 5.3.2', '< 6'

spec.add_dependency 'rubyzip', '~> 2.0'
spec.add_dependency 'roo', '~> 2.0'

spec.add_dependency 'avro', '~> 1.11.0'
spec.add_dependency 'bio-vcf', '~> 0.9.5'
spec.add_dependency 'csv'
spec.add_dependency 'docx', '~> 0.3'
spec.add_dependency 'msworddoc-extractor', '0.2.0'
spec.add_dependency 'nokogiri', '~> 1.8', '>= 1.8.5'
Expand Down
6 changes: 4 additions & 2 deletions test/csv_library_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ class CSVLibraryTest < ActiveSupport::TestCase
end

test 'raises deprecation warnings' do
assert_deprecated(/will be removed in a future version of ndr_import/) do
deprecator = CSVLibrary.send(:deprecator)
assert_deprecated(/will be removed in a future version of ndr_import/, deprecator) do
assert CSVLibrary.fastercsv?, '::CSV unexpectedly was the _old_ standard library'
end
end

test 'defines functional legacy methods' do
assert_deprecated(/write_csv_to_string -> generate/) do
deprecator = CSVLibrary.send(:deprecator)
assert_deprecated(/write_csv_to_string -> generate/, deprecator) do
assert_equal "1,2,3\n", CSVLibrary.write_csv_to_string([%w[1 2 3]])
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/file/zip_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def setup
File.open(fname, 'w') { |f| f.write "test #{fname}" }
end

::Zip::File.open(zip_name, Zip::File::CREATE) do |zipfile|
::Zip::File.open(zip_name, create: true) do |zipfile|
files.each do |fname|
zipfile.add(File.basename(fname.to_s), fname.to_s)
end
Expand Down
7 changes: 4 additions & 3 deletions test/standard_mappings_test.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# encoding: UTF-8
require 'test_helper'

# This tests the StandardMappings configuration class
class StandardMappingsTest < ActiveSupport::TestCase
test 'should not raise exception on reconfiguring NdrImport::StandardMappings' do
NdrImport::StandardMappings.mappings =
YAML.load_file(SafePath.new('permanent_test_files').join('standard_mappings.yml'))
assert_nothing_raised do
NdrImport::StandardMappings.mappings =
YAML.load_file(SafePath.new('permanent_test_files').join('standard_mappings.yml'))
end
end

test 'should raise exception on setting non-hash standard mappings' do
Expand Down
4 changes: 3 additions & 1 deletion test/xml/table_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def setup
end

test 'test should not raise exception on forced slurp' do
NdrImport::Xml::Table.new(klass: 'SomeTestKlass', slurp: true, columns: xml_column_mapping)
assert_nothing_raised do
NdrImport::Xml::Table.new(klass: 'SomeTestKlass', slurp: true, columns: xml_column_mapping)
end
end

test 'test should augment columns for repeating sections' do
Expand Down