lib/padrino-gen/generators/components/actions.rb in padrino-gen-0.13.1 vs lib/padrino-gen/generators/components/actions.rb in padrino-gen-0.13.2
- old
+ new
@@ -142,11 +142,11 @@
# @example
# insert_test_suite_setup('...CLASS_NAME...')
# => inject_into_file("test/test_config.rb", TEST.gsub(/CLASS_NAME/, @app_name), :after => "set :environment, :test")
#
def insert_test_suite_setup(suite_text, options={})
- options.reverse_merge!(:path => "test/test_config.rb")
+ options = { :path => "test/test_config.rb" }.update(options)
create_file(options[:path], suite_text.gsub(/CLASS_NAME/, "#{@project_name}::#{@app_name}"))
end
##
# Injects the mock library include into the test class in test_config
@@ -159,10 +159,10 @@
# @example
# insert_mocking_include('Mocha::API'):
# => inject_into_file("test/test_config.rb", " include Mocha::API\n", :after => /class.*?\n/)
#
def insert_mocking_include(library_name, options={})
- options.reverse_merge!(:indent => 2, :after => /class.*?\n/, :path => "test/test_config.rb")
+ options = { :indent => 2, :after => /class.*?\n/, :path => "test/test_config.rb" }.update(options)
return unless File.exist?(destination_root(options[:path]))
include_text = indent_spaces(2) + "include #{library_name}\n"
inject_into_file(options[:path], include_text, :after => options[:after])
end