baktainer/app/spec/support/coverage.rb
James Paterni 8db5004eea
Some checks are pending
Test and Build Docker Image / test (push) Waiting to run
Test and Build Docker Image / build (push) Blocked by required conditions
Add comprehensive RSpec testing infrastructure and enhance CI/CD pipeline
- Implement complete test suite with 63 examples (49 unit + 14 integration tests)
- Add RSpec, FactoryBot, WebMock, and SimpleCov testing dependencies
- Create mocked integration tests eliminating need for real Docker containers
- Fix SQLite method signature to accept login/password parameters
- Enhance container discovery to handle nil labels gracefully
- Add test coverage reporting and JUnit XML output for CI
- Update GitHub Actions workflow to run tests before Docker builds
- Add Ruby 3.3 setup with gem caching for faster CI execution
- Create CI test script and comprehensive testing documentation
- Ensure Docker builds only proceed when all tests pass

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-13 23:12:59 -04:00

48 lines
No EOL
1.3 KiB
Ruby

# frozen_string_literal: true
# Coverage configuration that can be required independently
require 'simplecov'
SimpleCov.start do
# Coverage configuration
add_filter '/spec/'
add_filter '/vendor/'
add_filter '/coverage/'
# Group files for better reporting
add_group 'Core Application', 'lib/baktainer.rb'
add_group 'Container Management', 'lib/baktainer/container.rb'
add_group 'Backup Commands', %w[
lib/baktainer/backup_command.rb
lib/baktainer/mysql.rb
lib/baktainer/mariadb.rb
lib/baktainer/postgres.rb
lib/baktainer/sqlite.rb
]
add_group 'Utilities', 'lib/baktainer/logger.rb'
# Coverage thresholds
minimum_coverage 80
minimum_coverage_by_file 70
# Refuse to decrease coverage
refuse_coverage_drop
# Track branches (Ruby 2.5+)
enable_coverage :branch if RUBY_VERSION >= '2.5'
# Coverage output formats
formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::SimpleFormatter
])
# Track coverage over time
track_files '{app,lib}/**/*.rb'
# Set command name for tracking
command_name ENV['COVERAGE_COMMAND'] || 'RSpec'
end
# Only start SimpleCov if COVERAGE environment variable is set
SimpleCov.start if ENV['COVERAGE'] || ENV['CI']