Skip to content

Commit e2be90d

Browse files
author
Josh Bodah
committed
micro optimizations for tests
1 parent 03d1486 commit e2be90d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

spec/spec_helper.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ def initialize(vim, type)
1313

1414
def reindent(content)
1515
with_file content do
16-
# remove all indentation
17-
@vim.normal 'ggVG999<<'
18-
# force vim to indent the file
19-
@vim.normal 'gg=G'
20-
# save the changes
21-
sleep 0.1 if ENV['CI']
16+
cmd = 'ggVG999<<' # remove all indentation
17+
cmd += 'gg=G' # force vim to indent the file
18+
@vim.normal cmd
2219
end
2320
end
2421

@@ -79,14 +76,12 @@ def with_file(content = nil)
7976

8077
yield if block_given?
8178

82-
@vim.write
83-
@vim.command 'redraw'
79+
@vim.normal ":w<CR>:redraw<CR>"
8480
IO.read(@file)
8581
end
8682

8783
def edit_file(content)
8884
File.write(@file, content) if content
89-
9085
@vim.edit @file
9186
end
9287
end

0 commit comments

Comments
 (0)