Skip to content

Commit

Permalink
Fix chewy:journal:clean task for ruby 3.x (#874)
Browse files Browse the repository at this point in the history
* with double splat operator

* add test case for rake task `chewy:journal:clean`

* :gear: fix Style/StringLiterals

* update CHANGELOG
  • Loading branch information
muk-ai authored Apr 5, 2023
1 parent 8b886d7 commit 8e3fa9a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

* [#874](https://github.com/toptal/chewy/pull/874): Fix `chewy:journal:clean` task for ruby 3.x. ([@muk-ai](https://github.com/muk-ai))

## 7.3.0 (2023-04-03)

### New Features
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/chewy.rake
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace :chewy do
task clean: :environment do |_task, args|
delete_options = Chewy::RakeHelper.delete_by_query_options_from_env(ENV)
Chewy::RakeHelper.journal_clean(
[
**[
parse_journal_args(args.extras),
{delete_by_query_options: delete_options}
].reduce({}, :merge)
Expand Down
12 changes: 12 additions & 0 deletions spec/chewy/rake_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'rake'

describe Chewy::RakeHelper, :orm do
before { Chewy.massacre }
Expand Down Expand Up @@ -456,6 +457,17 @@
Total: \\d+s\\Z
OUTPUT
end

context 'execute "chewy:journal:clean" rake task' do
subject(:task) { Rake.application['chewy:journal:clean'] }
before do
Rake::DefaultLoader.new.load('lib/tasks/chewy.rake')
Rake::Task.define_task(:environment)
end
it 'does not raise error' do
expect { task.invoke }.to_not raise_error
end
end
end

describe '.reindex' do
Expand Down

0 comments on commit 8e3fa9a

Please sign in to comment.