diff --git a/README.md b/README.md index feb3fbc..7fe4a53 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ A super simple Ruby starter project. -Rubocop and Solargraph are included for linting and code completion, respectively and are configured to be used with [Zed](https://zed.dev/). +Rubocop and Solargraph are included for linting and code completion, +respectively and are configured to be used with [Zed](https://zed.dev/). ## Prerequisites @@ -20,7 +21,9 @@ Rubocop and Solargraph are included for linting and code completion, respectivel Zed is a rough-around-the-edges editor in Beta. It's not very configurable yet, so we're locked into using Solargraph as our language server. Solargraph is -only officially compatible with [Rubocop](https://rubocop.org/) _(ACAB)_ for linting, but we use our ruleset of choice, [StandardRB] by configuring it in `.rubocop.yml`. +only officially compatible with [Rubocop](https://rubocop.org/) _(ACAB)_ for +linting, but we use our ruleset of choice, StandardRB by configuring it in +`.rubocop.yml`. For now, make sure that StandardRB is installed globally, as Zed can't yet reach into your local Gem's, as far as we are aware. @@ -45,4 +48,9 @@ inline diagnostics and formatting on save you must add the following to your Zed ## Documentation If you'd like to generate some user-friendly documentation, you can run -`rake` on the command line to generate some HTML docs in the `rdoc` directory, made up of your comments and some metadata from your code. +`rake rdoc` on the command line to generate some HTML docs in the `rdoc` directory, made up of your comments and some metadata from your code. + +## Testing + +An example unit test is included in `test/example_test.rb`. You can run the +tests with `rake test`. diff --git a/Rakefile b/Rakefile index 5499a7e..282f067 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,5 @@ require "rdoc/task" -task default: [:rdoc] +require 'rake/testtask' Rake::RDocTask.new do |rdoc| rdoc.rdoc_dir = "rdoc" @@ -7,3 +7,9 @@ Rake::RDocTask.new do |rdoc| rdoc.options << "--line-numbers" << "--inline-source" rdoc.rdoc_files.include("**/*.rb") end + +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList['tests/test*.rb'] + t.verbose = true +end diff --git a/tests/test_example.rb b/tests/test_example.rb new file mode 100644 index 0000000..50776de --- /dev/null +++ b/tests/test_example.rb @@ -0,0 +1,7 @@ +require "test/unit" + +class TestExample < Test::Unit::TestCase + def test_example + assert_equal(4, 2 + 2) + end +end