Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create minitest template file #250

Merged
merged 1 commit into from
Jul 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ Copy rspec test to test for missing and unused translations as part of the suite
$ cp $(i18n-tasks gem-path)/templates/rspec/i18n_spec.rb spec/
```

Or for minitest:

```console
$ cp $(i18n-tasks gem-path)/templates/minitest/i18n_test.rb test/
```

## Usage

Run `i18n-tasks` to get the list of all the tasks with short descriptions.
Expand Down
21 changes: 21 additions & 0 deletions templates/minitest/i18n_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

require 'i18n/tasks'

class I18nTest < ActiveSupport::TestCase
def setup
@i18n = I18n::Tasks::BaseTask.new
@missing_keys = @i18n.missing_keys
@unused_keys = @i18n.unused_keys
end

def test_no_missing_keys
assert_empty @missing_keys,
"Missing #{@missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them"
end

def test_no_unused_keys
assert_empty @unused_keys,
"#{@unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them"
end
end