lib/rgot/cli.rb in rgot-1.3.0 vs lib/rgot/cli.rb in rgot-1.4.0
- old
+ new
@@ -166,14 +166,16 @@
in [namespace, sym]
# module Foo::Bar
find_toplevel_name(namespace)
end
when :BLOCK
- module_node = node.children.find { |c| c.type == :MODULE }
- unless module_node
- raise "no module found"
+ module_nodes = node.children.select do |c|
+ c.type == :MODULE && find_toplevel_name(c).end_with?("Test")
end
- find_toplevel_name(module_node)
+ raise "no module found" if module_nodes.empty?
+ raise "*Test module should be one for each file" if 1 < module_nodes.length
+
+ find_toplevel_name(module_nodes.first)
else
raise node.type.to_s
end
end
end