mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Merge pull request #3954 from arjunsharma/master
Raise error if no ORM is found during install generator
This commit is contained in:
commit
0c46373c20
2 changed files with 11 additions and 2 deletions
|
@ -10,6 +10,7 @@ module Devise
|
|||
class_option :orm
|
||||
|
||||
def copy_initializer
|
||||
raise "An ORM must be set to install Devise" unless options[:orm]
|
||||
template "devise.rb", "config/initializers/devise.rb"
|
||||
end
|
||||
|
||||
|
|
|
@ -6,8 +6,16 @@ class InstallGeneratorTest < Rails::Generators::TestCase
|
|||
setup :prepare_destination
|
||||
|
||||
test "Assert all files are properly created" do
|
||||
run_generator
|
||||
assert_file "config/initializers/devise.rb"
|
||||
run_generator(['--orm=active_record'])
|
||||
assert_file "config/initializers/devise.rb", /devise\/orm\/active_record/
|
||||
assert_file "config/locales/devise.en.yml"
|
||||
end
|
||||
|
||||
test "Fail if no ORM is specified" do
|
||||
error = assert_raises RuntimeError do
|
||||
run_generator
|
||||
end
|
||||
|
||||
assert_match /An ORM must be set to install Devise/, error.message
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue