mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
3e0cdbeaf4
* require, require_relative, load by double quotes We're getting rid of all single quote usage, unless it serves a specific purpose, as per the general style guide.
26 lines
606 B
Ruby
26 lines
606 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "abstract_unit"
|
|
require "tmpdir"
|
|
|
|
module PluginTestHelper
|
|
def create_test_file(name, pass: true)
|
|
plugin_file "test/#{name}_test.rb", <<-RUBY
|
|
require "test_helper"
|
|
|
|
class #{name.camelize}Test < ActiveSupport::TestCase
|
|
def test_truth
|
|
puts "#{name.camelize}Test"
|
|
assert #{pass}, 'wups!'
|
|
end
|
|
end
|
|
RUBY
|
|
end
|
|
|
|
def plugin_file(path, contents, mode: "w")
|
|
FileUtils.mkdir_p File.dirname("#{plugin_path}/#{path}")
|
|
File.open("#{plugin_path}/#{path}", mode) do |f|
|
|
f.puts contents
|
|
end
|
|
end
|
|
end
|