Class: DevSystem::SimpleGeneratorTest

Inherits:
GeneratorTest show all
Defined in:
lib/dev_system/sub/generator/generators/simple_generator_test.rb

Instance Method Summary collapse

Methods inherited from Liza::UnitTest

test_methods_defined

Methods inherited from Liza::Test

color, subsystem

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Instance Method Details

#assert_change(index, path, lines_count, first_line, kaller: nil) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/dev_system/sub/generator/generators/simple_generator_test.rb', line 29

def assert_change index, path, lines_count, first_line, kaller: nil
  kaller ||= caller
  unless assert subject.changes[index].path.to_s.end_with?(path), kaller: kaller
    puts stick :red, "#{subject.changes[index].path.inspect} does not end with #{path.inspect}"
  end
  assert_equality subject.changes[index].new_lines.count, lines_count, kaller: kaller
  assert_equality subject.changes[index].new_lines[0].strip, first_line, kaller: kaller
end

#assert_change_count(count, kaller: nil) ⇒ Object



24
25
26
27
# File 'lib/dev_system/sub/generator/generators/simple_generator_test.rb', line 24

def assert_change_count count, kaller: nil
  kaller ||= caller
  assert_equality subject.changes.count, count, kaller: kaller
end

#call_with(name, coil, placement, superklass, path) ⇒ Object

helper methods



13
14
15
16
17
18
19
20
21
22
# File 'lib/dev_system/sub/generator/generators/simple_generator_test.rb', line 13

def call_with(name, coil, placement, superklass, path)
  env = {}
  env[:name] = name.to_s
  env[:generator_coil] = coil.to_s
  env[:placement] = placement
  env[:superclass] = superklass
  env[:path] = path

  subject.call env
end