aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorYounes SERRAJ <younes.serraj@gmail.com>2019-04-09 10:00:21 +0200
committerYounes SERRAJ <younes.serraj@gmail.com>2019-04-12 08:55:42 +0200
commit6463cc05730d25ef591fd361a67ac10a1884c3de (patch)
tree0d2210a87fb3d68ba4810be9724a77521f263f47 /railties/test
parent63ca58ae7bbafa0983ed8968ea6310ef33956261 (diff)
downloadrails-6463cc05730d25ef591fd361a67ac10a1884c3de.tar.gz
rails-6463cc05730d25ef591fd361a67ac10a1884c3de.tar.bz2
rails-6463cc05730d25ef591fd361a67ac10a1884c3de.zip
Adds `register_tags`
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/commands/notes_test.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/railties/test/commands/notes_test.rb b/railties/test/commands/notes_test.rb
index 147019e299..9182541413 100644
--- a/railties/test/commands/notes_test.rb
+++ b/railties/test/commands/notes_test.rb
@@ -121,6 +121,47 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
OUTPUT
end
+ test "displays results from additional tags added to the default tags from a config file" do
+ app_file "app/models/profile.rb", "# TESTME: some method to test"
+ app_file "app/controllers/hello_controller.rb", "# DEPRECATEME: this action is no longer needed"
+ app_file "db/some_seeds.rb", "# TODO: default tags such as TODO are still present"
+
+ add_to_config 'config.annotations.register_tags "TESTME", "DEPRECATEME"'
+
+ assert_equal <<~OUTPUT, run_notes_command
+ app/controllers/hello_controller.rb:
+ * [1] [DEPRECATEME] this action is no longer needed
+
+ app/models/profile.rb:
+ * [1] [TESTME] some method to test
+
+ db/some_seeds.rb:
+ * [1] [TODO] default tags such as TODO are still present
+
+ OUTPUT
+ end
+
+ test "does not display results from tags that are neither default nor registered" do
+ app_file "app/models/profile.rb", "# TESTME: some method to test"
+ app_file "app/controllers/hello_controller.rb", "# DEPRECATEME: this action is no longer needed"
+ app_file "db/some_seeds.rb", "# TODO: default tags such as TODO are still present"
+ app_file "db/some_other_seeds.rb", "# BAD: this note should not be listed"
+
+ add_to_config 'config.annotations.register_tags "TESTME", "DEPRECATEME"'
+
+ assert_equal <<~OUTPUT, run_notes_command
+ app/controllers/hello_controller.rb:
+ * [1] [DEPRECATEME] this action is no longer needed
+
+ app/models/profile.rb:
+ * [1] [TESTME] some method to test
+
+ db/some_seeds.rb:
+ * [1] [TODO] default tags such as TODO are still present
+
+ OUTPUT
+ end
+
private
def run_notes_command(args = [])
rails "notes", args