Skip to content

Commit b9f9c44

Browse files
committed
Merge pull request #2 from joshuavial/master
Always run the last executed spec regardless of current filetype
2 parents a570836 + f4f6b2a commit b9f9c44

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

plugin/spec.vim

+4-6
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,13 @@ function! RunAllSpecs()
106106
else
107107
let l:spec = ""
108108
endif
109-
call SetLastSpecCommand(l:spec)
110109
call RunSpecs(l:spec)
111110
endfunction
112111

113112
" Current File
114113
function! RunCurrentSpecFile()
115114
if InSpecFile()
116115
let l:spec = @%
117-
call SetLastSpecCommand(l:spec)
118116
call RunSpecs(l:spec)
119117
else
120118
call RunLastSpec()
@@ -130,7 +128,6 @@ function! RunNearestSpec()
130128
call s:GetNearestTest()
131129
let l:spec = @% . " -g '" . s:nearestTest . "'"
132130
end
133-
call SetLastSpecCommand(l:spec)
134131
call RunSpecs(l:spec)
135132
else
136133
call RunLastSpec()
@@ -140,7 +137,7 @@ endfunction
140137
" Last Spec
141138
function! RunLastSpec()
142139
if exists("s:last_spec_command")
143-
call RunSpecs(s:last_spec_command)
140+
execute s:last_spec_command
144141
endif
145142
endfunction
146143

@@ -151,7 +148,7 @@ endfunction
151148

152149
" Cache Last Spec Command
153150
function! SetLastSpecCommand(spec)
154-
let s:last_spec_command = a:spec
151+
let s:last_spec_command = substitute(g:spec_command, "{spec}", a:spec, "g")
155152
endfunction
156153

157154
" Spec Runner
@@ -160,7 +157,8 @@ function! RunSpecs(spec)
160157
if g:spec_command ==? ""
161158
echom "No spec command specified."
162159
else
163-
execute substitute(g:spec_command, "{spec}", a:spec, "g")
160+
call SetLastSpecCommand(a:spec)
161+
execute s:last_spec_command
164162
end
165163
endfunction
166164

0 commit comments

Comments
 (0)