Skip to content

Commit

Permalink
test: minor test suite improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
blocknotes committed Nov 2, 2023
1 parent 694df64 commit fdeb9b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/active_storage/service/db_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ module ActiveStorage
# Wraps a DB table as an Active Storage service. See ActiveStorage::Service
# for the generic API documentation that applies to all services.
class Service::DBService < Service
# :nocov:
if Rails::VERSION::MAJOR >= 7
include ActiveStorage::DBServiceRails70
elsif Rails::VERSION::MAJOR == 6 && Rails::VERSION::MINOR == 1
include ActiveStorage::DBServiceRails61
else
include ActiveStorage::DBServiceRails60
end
# :nocov:

def initialize(public: false, **)
@chunk_size = ENV.fetch('ASDB_CHUNK_SIZE') { 1.megabytes }
Expand Down
9 changes: 6 additions & 3 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@

SimpleCov.start :rails do
filters.clear

enable_coverage :branch

add_filter %r{^/lib/active_storage_db/version.rb}
add_filter %r{^/spec/}
add_filter %r{^/vendor/}

case ENV.fetch('RAILS', nil)
when '6.0' then add_filter /_rails61|_rails70/
when '6.1' then add_filter /_rails60|_rails70/
when '7.0' then add_filter /_rails60|_rails61/
when '6.1' then add_filter /_rails70|_rails71/
when '7.0' then add_filter /_rails61|_rails71/
when '7.1' then add_filter /_rails61|_rails70/
end
end

Expand Down
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# frozen_string_literal: true

RSpec.configure do |config|
config.color = true
config.default_formatter = :documentation
config.tty = true
config.order = :random

config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
Expand Down

0 comments on commit fdeb9b8

Please sign in to comment.