mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
added injection of markerb in Gemfile
This commit is contained in:
parent
72ba56b071
commit
8067022d98
2 changed files with 31 additions and 0 deletions
|
@ -77,6 +77,26 @@ module Devise
|
|||
def target_path
|
||||
"app/views/#{scope || :devise}/mailer"
|
||||
end
|
||||
|
||||
def inject_makerb_content
|
||||
if gemfile_exists?
|
||||
append_file gemfile_path, gemfile_content
|
||||
else
|
||||
create_file gemfile_path, gemfile_content
|
||||
end
|
||||
end
|
||||
|
||||
def gemfile_path
|
||||
@gemfile_path ||= File.join("Gemfile")
|
||||
end
|
||||
|
||||
def gemfile_exists?
|
||||
File.exists?(File.join(destination_root, gemfile_path))
|
||||
end
|
||||
|
||||
def gemfile_content
|
||||
'gem "markerb"'
|
||||
end
|
||||
end
|
||||
|
||||
class ViewsGenerator < Rails::Generators::Base
|
||||
|
|
|
@ -33,6 +33,17 @@ class ViewsGeneratorTest < Rails::Generators::TestCase
|
|||
assert_files nil, :mail_template_engine => "markerb"
|
||||
end
|
||||
|
||||
test "Assert Gemfile got gem markerb injected" do
|
||||
File.open(File.join(destination_root, "Gemfile"), 'w') {|f| f.write("gem 'rails'") }
|
||||
run_generator %w(--markerb)
|
||||
assert_file "Gemfile", /gem \"markerb\"/
|
||||
end
|
||||
|
||||
test "Assert Gemfile got created with markerb if no gemfile" do
|
||||
run_generator %w(--markerb)
|
||||
assert_file "Gemfile", /gem \"markerb\"/
|
||||
end
|
||||
|
||||
def assert_files(scope = nil, options={})
|
||||
scope = "devise" if scope.nil?
|
||||
default_template = "html.erb"
|
||||
|
|
Loading…
Add table
Reference in a new issue