2010-12-18 02:22:01 -05:00
|
|
|
require "test_helper"
|
|
|
|
|
2011-08-04 15:40:42 -04:00
|
|
|
if DEVISE_ORM == :mongoid
|
|
|
|
require "generators/mongoid/devise_generator"
|
2010-12-10 09:51:28 -05:00
|
|
|
|
|
|
|
class MongoidGeneratorTest < Rails::Generators::TestCase
|
|
|
|
tests Mongoid::Generators::DeviseGenerator
|
|
|
|
destination File.expand_path("../../tmp", __FILE__)
|
|
|
|
setup :prepare_destination
|
2013-12-05 03:03:32 -05:00
|
|
|
|
2010-12-10 09:51:28 -05:00
|
|
|
test "all files are properly created" do
|
|
|
|
run_generator %w(monster)
|
|
|
|
assert_file "app/models/monster.rb", /devise/
|
|
|
|
end
|
2013-12-05 03:03:32 -05:00
|
|
|
|
2010-12-10 09:51:28 -05:00
|
|
|
test "all files are properly deleted" do
|
|
|
|
run_generator %w(monster)
|
2014-02-25 11:42:55 -05:00
|
|
|
run_generator %w(monster), behavior: :revoke
|
2010-12-10 09:51:28 -05:00
|
|
|
assert_no_file "app/models/monster.rb"
|
|
|
|
end
|
|
|
|
end
|
2011-08-04 15:40:42 -04:00
|
|
|
end
|
|
|
|
|