diff --git a/test/railtie_test.rb b/test/railtie_test.rb new file mode 100644 index 0000000..9e1d669 --- /dev/null +++ b/test/railtie_test.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'test_helper' + +class RailtieTest < Test::Unit::TestCase + should "load processors" do + FileUtils.mkdir_p('tmp/rails/lib/paperclip_processors') + File.write(Rails.root.join('lib/paperclip_processors/some_custom_processor.rb'), <<~RUBY) + class Paperclip::SomeCustomProcessor < Paperclip::Processor + end + RUBY + Paperclip::Railtie.initializers.each(&:run) + assert defined?(Paperclip::SomeCustomProcessor) + end + + should "load rake tasks" do + require 'rake' + require 'rake/testtask' + + Rails.application.load_tasks + assert_equal Rake::Task, Rake.application["paperclip:refresh:thumbnails"].class + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index cfdd5cf..97252fd 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -30,6 +30,7 @@ if ENV['COVERAGE'] add_group "Libraries", "lib/" track_files "{lib}/**/*.rb" + add_filter "lib/tasks/paperclip_tasks.rake" # TODO: вообще по-хорошема надо и его покрыть end end