From 1c43e0b96147cb3e83a99e527b2f00fb077dfed9 Mon Sep 17 00:00:00 2001 From: Pedro Gaspar Date: Mon, 25 Mar 2019 23:38:26 +0000 Subject: [PATCH] acronym: Update and exclude new tests We might want to consider supporting the "excluded_tests" pattern in the base ExerciseCase so it can be easily be used by other generators. --- exercises/acronym/.meta/generator/acronym_case.rb | 15 +++++++++++++++ exercises/acronym/acronym_test.rb | 2 +- lib/generator/test_template.erb | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/exercises/acronym/.meta/generator/acronym_case.rb b/exercises/acronym/.meta/generator/acronym_case.rb index 0ad0419376..e746aeb892 100644 --- a/exercises/acronym/.meta/generator/acronym_case.rb +++ b/exercises/acronym/.meta/generator/acronym_case.rb @@ -4,4 +4,19 @@ class AcronymCase < Generator::ExerciseCase def workload assert_equal(expected, "Acronym.abbreviate('#{phrase}')") end + + def to_s(*args) + super unless excluded_tests.include?(test_name) + end + + private + + # We exclude these tests because they currently don't fit the purpose + # we have for Acronym on the Ruby track. + def excluded_tests + %w( + test_apostrophes + test_underscore_emphasis + ) + end end diff --git a/exercises/acronym/acronym_test.rb b/exercises/acronym/acronym_test.rb index 44c3512d55..afdea3107b 100644 --- a/exercises/acronym/acronym_test.rb +++ b/exercises/acronym/acronym_test.rb @@ -1,7 +1,7 @@ require 'minitest/autorun' require_relative 'acronym' -# Common test data version: 1.5.0 787d24e +# Common test data version: 1.7.0 cacf1f1 class AcronymTest < Minitest::Test def test_basic # skip diff --git a/lib/generator/test_template.erb b/lib/generator/test_template.erb index ce536d9e60..d7bd7d5ee1 100644 --- a/lib/generator/test_template.erb +++ b/lib/generator/test_template.erb @@ -6,5 +6,5 @@ class <%= exercise_test_classname %> < Minitest::Test <%= test_cases.map.with_index do |test_case, index| test_case.to_s(index.zero?) - end.join("\n") + end.compact.join("\n") %>end