aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-04-15 17:46:07 -0400
committerGitHub <noreply@github.com>2019-04-15 17:46:07 -0400
commit81c8f18d849a1538c4b838187280a572a5ff15e8 (patch)
treeb08b98c9fb8b28ea7286af087ea4e82643de49fb /railties/test/commands
parentc2fcc6ac18f102d7650a416ec87bd65db6078a9d (diff)
parent6463cc05730d25ef591fd361a67ac10a1884c3de (diff)
downloadrails-81c8f18d849a1538c4b838187280a572a5ff15e8.tar.gz
rails-81c8f18d849a1538c4b838187280a572a5ff15e8.tar.bz2
rails-81c8f18d849a1538c4b838187280a572a5ff15e8.zip
Merge pull request #35906 from yoones/notes-tags-registration
Notes tags registration
Diffstat (limited to 'railties/test/commands')
-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