mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Adding tests for Active Record generator
This commit is contained in:
parent
fe4eaf2d12
commit
60be68436b
2 changed files with 21 additions and 0 deletions
20
test/generators/active_record_generator_test.rb
Normal file
20
test/generators/active_record_generator_test.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require File.expand_path("../generators_test_helper", __FILE__)
|
||||
|
||||
class ActiveRecordGeneratorTest < Rails::Generators::TestCase
|
||||
tests ActiveRecord::Generators::DeviseGenerator
|
||||
destination File.expand_path("../../tmp", __FILE__)
|
||||
setup :prepare_destination
|
||||
|
||||
test "all files are properly created" do
|
||||
run_generator %w(monster)
|
||||
assert_file "app/models/monster.rb", /devise/, /attr_accessible (:[a-z_]+(, )?)+/
|
||||
assert_migration "db/migrate/devise_create_monsters.rb"
|
||||
end
|
||||
|
||||
test "all files are properly deleted" do
|
||||
run_generator %w(monster)
|
||||
run_generator %w(monster), :behavior => :revoke
|
||||
assert_no_file "app/models/monster.rb"
|
||||
assert_no_migration "db/migrate/devise_create_monsters.rb"
|
||||
end
|
||||
end
|
|
@ -2,3 +2,4 @@ require "rubygems"
|
|||
require "rails/generators/test_case"
|
||||
require File.expand_path("../../../lib/generators/devise/install_generator", __FILE__)
|
||||
require File.expand_path("../../../lib/generators/devise/views_generator", __FILE__)
|
||||
require File.expand_path("../../../lib/generators/active_record/devise_generator", __FILE__)
|
||||
|
|
Loading…
Reference in a new issue