mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Add generator support for test_unit/minitest.
This commit is contained in:
parent
a0be3e179f
commit
ab536852e0
2 changed files with 30 additions and 0 deletions
11
lib/generators/test_unit/policy_generator.rb
Normal file
11
lib/generators/test_unit/policy_generator.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
module TestUnit
|
||||
module Generators
|
||||
class PolicyGenerator < ::Rails::Generators::NamedBase
|
||||
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
||||
|
||||
def create_policy_test
|
||||
template 'policy_test.rb', File.join('test/policies', class_path, "#{file_name}_policy_test.rb")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
19
lib/generators/test_unit/templates/policy_test.rb
Normal file
19
lib/generators/test_unit/templates/policy_test.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
require 'test_helper'
|
||||
|
||||
class <%= class_name %>PolicyTest < ActiveSupport::TestCase
|
||||
|
||||
def test_scope
|
||||
end
|
||||
|
||||
def test_create
|
||||
end
|
||||
|
||||
def test_show
|
||||
end
|
||||
|
||||
def test_update
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue