Skip to content

Commit

Permalink
Merge branch 'main' into v1.10_add_v2_features
Browse files Browse the repository at this point in the history
  • Loading branch information
tilo authored Mar 2, 2024
2 parents 7ec9774 + 2f264ca commit e04bb16
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
- add tests for all options processing
- 100% backwards compatibility when working in v1 mode


## 1.10.1 (2024-01-07)
* fix incorrect warning about UTF-8 (issue #268, thanks hirowatari)
## 1.10.2 (2024-02-11)
* improve error message for missing keys

## 1.10.1 (2024-01-07)
* fix incorrect warning about UTF-8 (issue #268, thanks hirowatari)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ A Big Thank you to everyone who filed issues, sent comments, and who contributed
* [Rahul Chaudhary](https://github.com/rahulch95)
* [Alessandro Fazzi](https://github.com/pioneerskies)
* [JP Camara](https://github.com/jpcamara)
* [Hiro Watari](https://github.com/hirowatari)
* [Kenton Hirowatari](https://github.com/hirowatari)
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@

* default branch is `main` for 1.x development

* 2.x development is on `2.0-development` (check this branch for 2.0 documentation)
- This is an EXPERIMENTAL branch - DO NOT USE in production

#### Work towards Future Version 2.x

* Work towards SmarterCSV 2.x is still ongoing, with improved features, and more streamlined options, but consider it as experimental at this time.
Please check the [2.0-develop branch](https://github.com/tilo/smarter_csv/tree/2.0-develop), open any issues and pull requests with mention of tag v2.0.
* 2.x development is [MOVED TO THIS PR](https://github.com/tilo/smarter_csv/pull/267)
- 2.x behavior is still EXPERIMENTAL - DO NOT USE in production

---------------

Expand Down
2 changes: 1 addition & 1 deletion lib/smarter_csv/header_validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def check_required_headers_v1(headers, options)
missing_keys = options[:required_keys].select { |k| !headers_set.include?(k) }

unless missing_keys.empty?
raise SmarterCSV::MissingKeys, "ERROR: missing attributes: #{missing_keys.join(',')}"
raise SmarterCSV::MissingKeys, "ERROR: missing attributes: #{missing_keys.join(',')}. Check `SmarterCSV.headers` for original headers."
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/features/header_handling/invalid_headers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
options = {required_keys: %i[lastname email employee_id firstname manager_email]} # order does not matter
SmarterCSV.process("#{fixture_path}/user_import.csv", options)
end.to raise_exception(
SmarterCSV::MissingKeys, "ERROR: missing attributes: employee_id"
SmarterCSV::MissingKeys, "ERROR: missing attributes: employee_id. Check `SmarterCSV.headers` for original headers."
)
end

Expand All @@ -46,7 +46,7 @@
expect do
SmarterCSV.process("#{fixture_path}/user_import.csv", options)
end.to raise_exception(
SmarterCSV::MissingKeys, "ERROR: missing attributes: email" # it was mapped, and is now missing
SmarterCSV::MissingKeys, /ERROR: missing attributes: email/ # it was mapped, and is now missing
)
end
end
Expand Down Expand Up @@ -115,7 +115,7 @@
expect{ process_file }.not_to raise_exception SmarterCSV::KeyMappingError
# still raises an error because :middle_name is required
expect{ process_file }.to raise_exception(
SmarterCSV::MissingKeys, "ERROR: missing attributes: middle_name"
SmarterCSV::MissingKeys, /ERROR: missing attributes: middle_name/
)
end
end
Expand All @@ -128,7 +128,7 @@
)
# still raises an error because :middle_name is required
expect{ process_file }.to raise_exception(
SmarterCSV::MissingKeys, "ERROR: missing attributes: middle_name"
SmarterCSV::MissingKeys, /ERROR: missing attributes: middle_name/
)
end

Expand Down

0 comments on commit e04bb16

Please sign in to comment.