Add coverage

This commit is contained in:
Vasily Fedoseyev
2024-04-04 22:52:44 +03:00
parent f9d1f25cb8
commit 923b605c42
5 changed files with 55 additions and 21 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ gemfiles/*.lock
gemfiles/.bundle/
tmp/
.rubocop-*
/coverage/

7
.pryrc Normal file
View File

@@ -0,0 +1,7 @@
# Alieases for debugger.
if defined?(PryByebug) || defined?(PryDebugger)
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'f', 'finish'
end

View File

@@ -15,6 +15,7 @@ gem 'rails'
gem 'sidekiq'
gem 'test-unit'
gem 'simplecov', require: false
gem 'mocha'
gem 'thoughtbot-shoulda', '>= 2.9.0'

View File

@@ -3,7 +3,6 @@ require 'rake/testtask'
require 'rdoc/task'
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
require 'paperclip'
import 'lib/tasks/paperclip_tasks.rake'
@@ -19,7 +18,7 @@ Rake::TestTask.new(:test) do |t|
end
desc 'Start an IRB session with all necessary files required.'
task :shell do
task :shell => :load_paperclip do
chdir File.dirname(__FILE__)
exec 'irb -I lib/ -I lib/paperclip -r rubygems -r active_record -r tempfile -r init'
end
@@ -62,7 +61,11 @@ exclude_file_globs = ["test/s3.yml",
"test/pkg/*",
"test/tmp",
"test/tmp/*"]
spec = Gem::Specification.new do |s|
def spec
# TODO: require 'paperclip/version'
require 'paperclip'
Gem::Specification.new do |s|
s.name = "paperclip"
s.version = Paperclip::VERSION
s.author = "Jon Yurek"
@@ -79,6 +82,7 @@ spec = Gem::Specification.new do |s|
s.requirements << "ImageMagick"
s.add_development_dependency 'thoughtbot-shoulda'
s.add_development_dependency 'mocha'
end
end
desc "Print a list of the files to be put into the gem"

View File

@@ -1,6 +1,8 @@
# frozen_string_literal: true
require 'rubygems'
require 'bundler/setup'
require 'test/unit'
require 'shoulda'
require 'mocha/test_unit'
@@ -13,6 +15,24 @@ require 'active_record'
require 'active_support'
require 'rails'
if ENV['COVERAGE']
require 'simplecov'
SimpleCov.external_at_exit = true
Test::Unit.at_exit do
SimpleCov.at_exit_behavior
end
SimpleCov.command_name 'test:units'
SimpleCov.start do
load_profile "test_frameworks"
add_group "Storage", "lib/paperclip/storage/"
add_group "Libraries", "lib/"
track_files "{lib}/**/*.rb"
end
end
ROOT = File.expand_path('../', __dir__)
ENV['RAILS_ENV'] = 'test'
@@ -20,9 +40,10 @@ class TestRailsApp < Rails::Application; end
Rails.application.config.root = "#{ROOT}/tmp/rails"
$LOAD_PATH << File.join(ROOT, 'lib')
$LOAD_PATH << File.join(ROOT, 'lib', 'paperclip')
$LOAD_PATH << File.join(ROOT, 'lib/paperclip') # ??
require File.join(ROOT, 'lib', 'paperclip.rb')
require 'paperclip'
# require File.join(ROOT, 'lib/paperclip.rb')
require 'shoulda_macros/paperclip'