aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
authorAnnie-Claude Côté <hello@annie.codes>2018-06-22 12:43:32 -0400
committerAnnie-Claude Côté <hello@annie.codes>2018-07-04 14:30:11 -0400
commit21f7dadbffdf4532e4401f1cbfa1771a8e5750da (patch)
treedb88792eef2b40eee70e939c8656f90a2e18e23d /railties/test/commands
parent1996fbe2a3e46ff5698bfa3812afb7f42cdfa899 (diff)
downloadrails-21f7dadbffdf4532e4401f1cbfa1771a8e5750da.tar.gz
rails-21f7dadbffdf4532e4401f1cbfa1771a8e5750da.tar.bz2
rails-21f7dadbffdf4532e4401f1cbfa1771a8e5750da.zip
Adds support to register directories and extensions to NotesCommand
* Require the application and environnement in the notes command in order to load the config files * Adds tests for both register_directories and register_extensions added to a config file
Diffstat (limited to 'railties/test/commands')
-rw-r--r--railties/test/commands/notes_test.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/railties/test/commands/notes_test.rb b/railties/test/commands/notes_test.rb
index 927c55251e..d8647b3aca 100644
--- a/railties/test/commands/notes_test.rb
+++ b/railties/test/commands/notes_test.rb
@@ -77,6 +77,50 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
OUTPUT
end
+ test "displays results from additional directories added to the default directories from a config file" do
+ app_file "db/some_seeds.rb", "# FIXME: note in db directory"
+ app_file "lib/some_file.rb", "# TODO: note in lib directory"
+ app_file "spec/spec_helper.rb", "# TODO: note in spec"
+ app_file "spec/models/user_spec.rb", "# TODO: note in model spec"
+
+ add_to_config "config.annotations.register_directories \"spec\""
+
+ assert_equal <<~OUTPUT, run_notes_command
+ db/some_seeds.rb:
+ * [1] [FIXME] note in db directory
+
+ lib/some_file.rb:
+ * [1] [TODO] note in lib directory
+
+ spec/models/user_spec.rb:
+ * [1] [TODO] note in model spec
+
+ spec/spec_helper.rb:
+ * [1] [TODO] note in spec
+
+ OUTPUT
+ end
+
+ test "displays results from additional file extensions added to the default extensions from a config file" do
+ add_to_config "config.assets.precompile = []"
+ add_to_config %q{ config.annotations.register_extensions("scss", "sass") { |annotation| /\/\/\s*(#{annotation}):?\s*(.*)$/ } }
+ app_file "db/some_seeds.rb", "# FIXME: note in db directory"
+ app_file "app/assets/stylesheets/application.css.scss", "// TODO: note in scss"
+ app_file "app/assets/stylesheets/application.css.sass", "// TODO: note in sass"
+
+ assert_equal <<~OUTPUT, run_notes_command
+ app/assets/stylesheets/application.css.sass:
+ * [1] [TODO] note in sass
+
+ app/assets/stylesheets/application.css.scss:
+ * [1] [TODO] note in scss
+
+ db/some_seeds.rb:
+ * [1] [FIXME] note in db directory
+
+ OUTPUT
+ end
+
private
def run_notes_command(args = [])
rails "notes", args