lib/souls/generate/rspec_factory.rb in souls-0.28.5 vs lib/souls/generate/rspec_factory.rb in souls-0.28.6
- old
+ new
@@ -18,10 +18,10 @@
@on = false
File.open(file_path, "a") do |new_line|
File.open(path, "r") do |f|
f.each_line.with_index do |line, _i|
if @on
- new_line.write("\n" && break) if line.include?("end") || line.include?("t.index")
+ new_line.write("\n" && break) if line.include?("t.index") || line.strip == "end"
field = '["tag1", "tag2", "tag3"]' if line.include?("array: true")
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
field ||= get_test_type(type)
if type == "bigint" && name.include?("_id")
id_name = name.gsub("_id", "")