-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
70 lines (53 loc) · 1.69 KB
/
Copy pathRakefile
File metadata and controls
70 lines (53 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"
# Default RSpec task
RSpec::Core::RakeTask.new(:spec) do |t|
t.exclude_pattern = "spec/integration/**/*_spec.rb"
end
# Integration tests (require external services)
RSpec::Core::RakeTask.new(:integration) do |t|
t.pattern = "spec/integration/**/*_spec.rb"
t.rspec_opts = "--tag integration"
end
# All tests including integration
RSpec::Core::RakeTask.new(:spec_all) do |t|
# Run all specs
end
# RuboCop task
RuboCop::RakeTask.new
# Default task runs unit tests only
task default: [:spec, :rubocop]
# Task to run all tests
task all: [:spec_all, :rubocop]
desc "Run unit tests only"
task test: :spec
desc "Run all tests including integration tests"
task test_all: :spec_all
desc "Run integration tests only"
task test_integration: :integration
desc "Display test statistics"
task :test_stats do
puts "Test Statistics:"
puts "=" * 50
# Count spec files
unit_specs = Dir.glob("spec/**/*_spec.rb").reject { |f| f.include?("integration") }
integration_specs = Dir.glob("spec/integration/**/*_spec.rb")
puts "Unit test files: #{unit_specs.length}"
puts "Integration test files: #{integration_specs.length}"
puts "Total test files: #{unit_specs.length + integration_specs.length}"
# Count fixture files
fixtures = Dir.glob("spec/fixtures/**/*.rb")
puts "Fixture files: #{fixtures.length}"
# Count mock files
mocks = Dir.glob("spec/mocks/**/*.rb")
puts "Mock files: #{mocks.length}"
puts "=" * 50
end
desc "Clean up generated files"
task :clean do
FileUtils.rm_rf("coverage")
FileUtils.rm_rf(".rspec_status")
puts "Cleaned up generated files"
end