From 21b79a233aa80c004c1fa13a2b0b88704d77592c Mon Sep 17 00:00:00 2001 From: Tute Costa Date: Thu, 31 Mar 2022 15:06:44 -0300 Subject: [PATCH] Test on new Rubies, README updates - Fix link to Spanish version of the README - Test file renames following expected format by editor - Drop minitest reporters for nicer output within the editor - On second exercise return zero instead of - to make the else branches differ more --- .travis.yml | 4 ++-- .../{tests.rb => test_app.rb} | 0 2-special-case-objects/app.rb | 2 +- 2-special-case-objects/{tests.rb => test_app.rb} | 2 +- .../{tests.rb => test_app.rb} | 0 4-service-objects/{tests.rb => test_app.rb} | 0 Gemfile | 1 - README.es.md | 14 ++++++++++++-- README.md | 10 +++++----- Rakefile | 2 +- test_helper.rb | 2 -- 11 files changed, 22 insertions(+), 15 deletions(-) rename 1-intention-revealing-method/{tests.rb => test_app.rb} (100%) rename 2-special-case-objects/{tests.rb => test_app.rb} (87%) rename 3-replace-method-with-method-object/{tests.rb => test_app.rb} (100%) rename 4-service-objects/{tests.rb => test_app.rb} (100%) diff --git a/.travis.yml b/.travis.yml index 99a35fb..5257663 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: ruby rvm: - - 2.4 - - 2.5 + - 2.7 + - 3.0 - jruby-19mode diff --git a/1-intention-revealing-method/tests.rb b/1-intention-revealing-method/test_app.rb similarity index 100% rename from 1-intention-revealing-method/tests.rb rename to 1-intention-revealing-method/test_app.rb diff --git a/2-special-case-objects/app.rb b/2-special-case-objects/app.rb index b1e8e89..965e832 100644 --- a/2-special-case-objects/app.rb +++ b/2-special-case-objects/app.rb @@ -47,7 +47,7 @@ def last_trial_days(user) if user.last_subscription && user.last_subscription.respond_to?(:trial_days) user.last_subscription.trial_days else - '-' + '0' end end end diff --git a/2-special-case-objects/tests.rb b/2-special-case-objects/test_app.rb similarity index 87% rename from 2-special-case-objects/tests.rb rename to 2-special-case-objects/test_app.rb index 5c68abc..66944e9 100644 --- a/2-special-case-objects/tests.rb +++ b/2-special-case-objects/test_app.rb @@ -6,7 +6,7 @@ class TestApp < Minitest::Test def test_status_report_job response = { "Bob" => { name: "Monthly Subscription", status: "active", trial_days: 14}, - "Patricio" => { name: "none", status: "-", trial_days: "-"} + "Patricio" => { name: "none", status: "-", trial_days: "0"} } assert_equal response, StatusReportJob.new.perform end diff --git a/3-replace-method-with-method-object/tests.rb b/3-replace-method-with-method-object/test_app.rb similarity index 100% rename from 3-replace-method-with-method-object/tests.rb rename to 3-replace-method-with-method-object/test_app.rb diff --git a/4-service-objects/tests.rb b/4-service-objects/test_app.rb similarity index 100% rename from 4-service-objects/tests.rb rename to 4-service-objects/test_app.rb diff --git a/Gemfile b/Gemfile index 3263c01..d276072 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,3 @@ source 'https://rubygems.org' gem 'rake' gem 'minitest' -gem 'minitest-reporters' diff --git a/README.es.md b/README.es.md index e351a80..5a6c638 100644 --- a/README.es.md +++ b/README.es.md @@ -1,6 +1,6 @@ # Taller de Refactorización -Requerimientos: Ruby >= 2, git, bundler. +Requerimientos: Ruby >= 2.7, git, bundler. Cada carpeta lleva por nombre el patrón de refactoring a practicar, y los siguientes archivos: @@ -9,7 +9,7 @@ siguientes archivos: * `setup.rb` código de inicialización necesario para `app.rb` (sería el "framework", o el resto de la aplicación). No necesitamos conocerlo o editarlo, a no ser que sea por curiosidad. -* `tests.rb` el nombre lo explica. Necesarios para la vida, especialmente si +* `test_app.rb` el nombre lo explica. Necesarios para la vida, especialmente si pensamos refactorizar. Ejecutar `bundle` para asegurarse de tener las rubygems necesarias para correr @@ -42,3 +42,13 @@ Nota de implementación: contiene dos archivos adicionales necesarios para los tests: `fixtures/input.csv` y `fixtures/output.csv`, y no contiene `setup.rb`. ## 4. Service Object + + +# Slides + +* [Slides (English)](https://github.com/tute/refactoring-workshop-slides-sep-2015/) +* [Slides (Español)](https://www.tutecosta.com/refactoring-workshop-slides-sep-2015/#/) [repo](https://github.com/tute/refactoring-workshop-slides-sep-2015/tree/es) + +# In English + +[English version of this doc available](https://github.com/tute/refactoring-workshop/blob/master/README.md). diff --git a/README.md b/README.md index 0053ad5..253eb0e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Refactoring Workshop -Requirements: Ruby >= 2.0, git, `minitest` gem. +Requirements: Ruby >= 2.7, git, `minitest` gem. Each folder is named after the refactoring pattern they tackle, and contains: * `app.rb` code we'll refactor. * `setup.rb` necessary code for `app.rb` to run (mimicks a SUPER BASIC Rails) We don't need to see/edit it unless just curious. :-) -* `tests.rb` self explanatory. Necessary for daily life, specially for +* `test_app.rb` self explanatory. Necessary for daily life, specially for refactoring. Run `bundle` to make sure you have the gems needed for running tests (`rake` @@ -44,9 +44,9 @@ Implementation note: folder contains two fixture files needed for tests, # Slides -* [RubyConf Argentina Slides](http://es.slideshare.net/thoughtbot/refactoring-workshop-rubyconf-argentina-2014) -* [RailsConf Slides](http://www.slideshare.net/tutec/simplifying-code-monster-to-elegant-in-n-5-steps) +* [Slides (English)](https://github.com/tute/refactoring-workshop-slides-sep-2015/) +* [Slides (Español)](https://www.tutecosta.com/refactoring-workshop-slides-sep-2015/#/) [repo](https://github.com/tute/refactoring-workshop-slides-sep-2015/tree/es) # In Spanish -[Spanish version of this doc available](https://github.com/tute/refactoring-workshop/blob/master/README.md). +[Spanish version of this doc available](https://github.com/tute/refactoring-workshop/blob/master/README.es.md). diff --git a/Rakefile b/Rakefile index 94f63d7..497c491 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,7 @@ require 'rake/testtask' Rake::TestTask.new(:test) do |t| t.libs = FileList['*-*/'] - t.test_files = FileList['*/tests.rb'] + t.test_files = FileList['*/test_*.rb'] end task default: :test diff --git a/test_helper.rb b/test_helper.rb index 978b608..9a4ca35 100644 --- a/test_helper.rb +++ b/test_helper.rb @@ -1,3 +1 @@ require "minitest/autorun" -require "minitest/reporters" -Minitest::Reporters.use!