mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Added a test case for Devise Generator
This commit is contained in:
parent
970457f2c2
commit
6bd65209d5
1 changed files with 27 additions and 0 deletions
27
test/generators/devise_generator_test.rb
Normal file
27
test/generators/devise_generator_test.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require 'test_helper'
|
||||
|
||||
require "generators/devise/devise_generator"
|
||||
|
||||
class DeviseGeneratorTest < Rails::Generators::TestCase
|
||||
tests Devise::Generators::DeviseGenerator
|
||||
destination File.expand_path("../../tmp", __FILE__)
|
||||
|
||||
setup do
|
||||
prepare_destination
|
||||
copy_routes
|
||||
end
|
||||
|
||||
test "route generation for simple model names" do
|
||||
run_generator %w(monster name:string)
|
||||
assert_file "config/routes.rb", /devise_for :monsters/
|
||||
end
|
||||
|
||||
def copy_routes
|
||||
routes = File.expand_path("../../rails_app/config/routes.rb", __FILE__)
|
||||
destination = File.join(destination_root, "config")
|
||||
|
||||
FileUtils.mkdir_p(destination)
|
||||
FileUtils.cp routes, destination
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue