Skip to content

Commit

Permalink
Create minitest template file
Browse files Browse the repository at this point in the history
Supports the same tests as rspec template
  • Loading branch information
supremebeing7 committed Jul 24, 2017
1 parent ca08e29 commit 2a07309
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
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

0 comments on commit 2a07309

Please sign in to comment.