Skip to content

Commit

Permalink
Added a test case for Devise Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
vinibaggio committed Feb 23, 2011
1 parent 970457f commit 6bd6520
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/generators/devise_generator_test.rb
@@ -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

0 comments on commit 6bd6520

Please sign in to comment.