forked from heartcombo/devise
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test case for Devise Generator
- Loading branch information
1 parent
970457f
commit 6bd6520
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |