2019-03-26 15:32:20 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require File.expand_path('../config/environment', __dir__)
|
2018-01-02 17:19:25 +00:00
|
|
|
require 'rails/test_help'
|
2018-04-27 18:48:26 +00:00
|
|
|
require 'open3'
|
2019-09-16 16:44:29 +00:00
|
|
|
require 'sucker_punch/testing/inline'
|
2019-07-26 00:36:33 +00:00
|
|
|
|
2019-09-17 21:27:51 +00:00
|
|
|
Rails.application.load_seed
|
|
|
|
|
2019-07-11 19:00:28 +00:00
|
|
|
# rubocop:disable Style/ClassAndModuleChildren
|
2018-01-02 17:19:25 +00:00
|
|
|
class ActiveSupport::TestCase
|
2019-07-11 19:00:28 +00:00
|
|
|
include FactoryBot::Syntax::Methods
|
2018-04-27 18:48:26 +00:00
|
|
|
# Resetear el repositorio a su estado original antes de leerlo
|
2019-07-11 19:00:28 +00:00
|
|
|
#
|
|
|
|
# TODO mover a Site.reset! cuando empecemos a trabajar con git
|
2018-04-27 18:48:26 +00:00
|
|
|
def reset_git_repo(path)
|
|
|
|
Dir.chdir(path) do
|
2019-03-26 15:32:20 +00:00
|
|
|
Open3.popen3('git reset --hard') do |_, _, _, thread|
|
2018-04-27 18:48:26 +00:00
|
|
|
# Wait for the process to finish
|
|
|
|
thread.value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-01-02 17:19:25 +00:00
|
|
|
end
|
2019-07-11 19:00:28 +00:00
|
|
|
# rubocop:enable Style/ClassAndModuleChildren
|