Skip to content

Commit

Permalink
Merge pull request #56 from grosser/grosser/cov
Browse files Browse the repository at this point in the history
fix test-coverage
  • Loading branch information
grosser authored Aug 11, 2024
2 parents d215869 + a8647b5 commit a0354a9
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 179 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2']
rails: ['5.2', '6.0', '6.1', '7.0', '7.1']
ruby: ['3.1', '3.2', '3.3']
rails: ['6.1', '7.0', '7.1']
exclude:
- ruby: '3.0'
rails: '5.2'
- ruby: '3.1'
rails: '5.2'
- ruby: '3.1'
rails: '6.0'
- ruby: '3.2'
rails: '5.2'
- ruby: '3.2'
rails: '6.0'
- ruby: '3.2'
rails: '6.1'
- ruby: '3.3'
rails: '6.1'
name: ruby${{ matrix.ruby }} rails${{ matrix.rails }} rake
env:
BUNDLE_GEMFILE: gemfiles/rails${{ matrix.rails }}.gemfile
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GEM
ruby2_keywords
i18n (1.14.1)
concurrent-ruby (~> 1.0)
mini_portile2 (2.8.5)
mini_portile2 (2.8.7)
minitest (5.20.0)
mutex_m (0.2.0)
rake (13.1.0)
Expand All @@ -59,7 +59,7 @@ GEM
rspec-support (3.12.1)
ruby2_keywords (0.0.5)
single_cov (1.11.0)
sqlite3 (1.6.8)
sqlite3 (1.7.3)
mini_portile2 (~> 2.8.0)
timeout (0.4.1)
tzinfo (2.0.6)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ desc "Bundle all gemfiles"
task :bundle_all do
Bundler.with_original_env do
Dir["gemfiles/*.gemfile"].each do |gemfile|
sh "BUNDLE_GEMFILE=#{gemfile} bundle"
sh "BUNDLE_GEMFILE=#{gemfile} bundle #{ENV["CMD"]}"
end
end
end
5 changes: 0 additions & 5 deletions gemfiles/rails5.2.gemfile

This file was deleted.

70 changes: 0 additions & 70 deletions gemfiles/rails5.2.gemfile.lock

This file was deleted.

6 changes: 0 additions & 6 deletions gemfiles/rails6.0.gemfile

This file was deleted.

70 changes: 0 additions & 70 deletions gemfiles/rails6.0.gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/rails6.1.gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

gem "activerecord", "~> 6.1.0"
gem "sqlite3", "~> 1.4"
gem "sqlite3", "~> 1.7"

gemspec path: "../"
6 changes: 4 additions & 2 deletions gemfiles/rails6.1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ GEM
diff-lcs (1.5.0)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
mini_portile2 (2.8.7)
minitest (5.15.0)
rake (13.0.6)
rspec (3.11.0)
Expand All @@ -46,7 +47,8 @@ GEM
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
single_cov (1.7.0)
sqlite3 (1.4.2)
sqlite3 (1.7.3)
mini_portile2 (~> 2.8.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
zeitwerk (2.5.4)
Expand All @@ -63,7 +65,7 @@ DEPENDENCIES
rspec (~> 3.5)
single_cov
soft_deletion!
sqlite3 (~> 1.4)
sqlite3 (~> 1.7)

BUNDLED WITH
2.3.12
2 changes: 1 addition & 1 deletion gemfiles/rails7.0.gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

gem "activerecord", "~> 7.0.0"
gem "sqlite3", "~> 1.4"
gem "sqlite3", "~> 1.7"

gemspec path: "../"
6 changes: 4 additions & 2 deletions gemfiles/rails7.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GEM
diff-lcs (1.5.0)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
mini_portile2 (2.8.7)
minitest (5.15.0)
rake (13.0.6)
rspec (3.11.0)
Expand All @@ -45,7 +46,8 @@ GEM
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
single_cov (1.7.0)
sqlite3 (1.4.2)
sqlite3 (1.7.3)
mini_portile2 (~> 2.8.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)

Expand All @@ -61,7 +63,7 @@ DEPENDENCIES
rspec (~> 3.5)
single_cov
soft_deletion!
sqlite3 (~> 1.4)
sqlite3 (~> 1.7)

BUNDLED WITH
2.3.12
2 changes: 1 addition & 1 deletion gemfiles/rails7.1.gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

gem "activerecord", "~> 7.1.0"
gem "sqlite3", "~> 1.4"
gem "sqlite3", "~> 1.7"

gemspec path: "../"
6 changes: 4 additions & 2 deletions gemfiles/rails7.1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ GEM
rspec-support (3.12.1)
ruby2_keywords (0.0.5)
single_cov (1.11.0)
sqlite3 (1.6.8-x86_64-linux)
sqlite3 (1.7.3-arm64-darwin)
sqlite3 (1.7.3-x86_64-linux)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)

PLATFORMS
arm64-darwin-23
x86_64-linux

DEPENDENCIES
Expand All @@ -75,7 +77,7 @@ DEPENDENCIES
rspec (~> 3.5)
single_cov
soft_deletion!
sqlite3 (~> 1.4)
sqlite3 (~> 1.7)

BUNDLED WITH
2.4.21
5 changes: 2 additions & 3 deletions lib/soft_deletion/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ def soft_delete_dependencies
def update_soft_delete_counter_caches(value)
each_counter_cached_associations do |association|
association.load_target unless association.loaded?
if association.target
target = association.target
if (target = association.target) # uncovered TODO: add test coverage for target not existing
target.class.update_counters(target.id, association.reflection.counter_cache_column => value)
end
end
Expand All @@ -115,7 +114,7 @@ def _run_soft_delete(method, *args, **kwargs, &block)
end

def _run_soft_undelete(&block)
raise "#{self.class} is not deleted" unless deleted_at
raise "#{self.class} is not deleted" unless deleted_at # uncovered TODO: add test coverage

result = false
limit = deleted_at - 1.hour
Expand Down
2 changes: 1 addition & 1 deletion spec/soft_deletion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

SingleCov.covered!
SingleCov.covered! file: 'lib/soft_deletion/setup.rb'
SingleCov.covered! file: 'lib/soft_deletion/core.rb', uncovered: 3 # TODO: fix
SingleCov.covered! file: 'lib/soft_deletion/core.rb'
SingleCov.covered! file: 'lib/soft_deletion/dependency.rb'

describe SoftDeletion do
Expand Down

0 comments on commit a0354a9

Please sign in to comment.