Class: ElixirTestHook

Inherits:
Mumukit::Templates::FileHook
  • Object
show all
Defined in:
lib/test_hook.rb

Instance Method Summary collapse

Instance Method Details

#command_line(filename) ⇒ Object



20
21
22
# File 'lib/test_hook.rb', line 20

def command_line(filename)
  "elixir #{filename}"
end

#compile_file_content(request) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/test_hook.rb', line 4

def compile_file_content(request)
<<elixir
ExUnit.start
defmodule ElixirServer do
#{request.extra}
#{request.content}
use ExUnit.Case, async: true
#{request.test}
end
elixir
end

#format_code(code) ⇒ Object



24
25
26
# File 'lib/test_hook.rb', line 24

def format_code(code)
  "```\n#{code}\n```"
end

#post_process_file(file, result, status) ⇒ Object



28
29
30
# File 'lib/test_hook.rb', line 28

def post_process_file(file, result, status)
  [format_code(result), status]
end

#tempfile_extensionObject



16
17
18
# File 'lib/test_hook.rb', line 16

def tempfile_extension
  '.exs'
end