Sha256: f12db73dd2f05364ac58778eeebe52907624899f033f80a99edcb7e3b30ed19a
Contents?: true
Size: 995 Bytes
Versions: 7
Compression:
Stored size: 995 Bytes
Contents
module TestHelpers APP_NAME = "dummy_app" def remove_project_directory FileUtils.rm_rf(project_path) end def recreate_tmp_directory FileUtils.rm_rf(project_path) FileUtils.mkdir_p(tmp_path) end def run_generator(arguments = nil) Dir.chdir(tmp_path) do Bundler.with_clean_env do ENV['TESTING'] = '1' %x(#{generator_bin} #{APP_NAME} #{arguments}) fail 'Application generation failed' unless $?.exitstatus == 0 end end end def drop_dummy_database if File.exist?(project_path) Dir.chdir(project_path) do Bundler.with_clean_env do %x(rake db:drop) end end end end def project_path @project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}") end private def tmp_path @tmp_path ||= Pathname.new("#{root_path}/tmp") end def generator_bin File.join(root_path, 'bin', 'spark') end def root_path File.expand_path('../../../', __FILE__) end end
Version data entries
7 entries across 7 versions & 1 rubygems