forked from thoughtbot/vim-rspec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use `vspec` for RSpec-like syntax * `vspec` relies on `vim-flavor` to run the specs * Move command setup to a local function for testability Closes thoughtbot#42
- Loading branch information
Greg Lazarev
committed
Dec 9, 2014
1 parent
65735f6
commit 102821b
Showing
6 changed files
with
136 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.vim-flavor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flavor 'kana/vim-vspec' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kana/vim-vspec (1.4.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
source plugin/rspec.vim | ||
|
||
call vspec#hint({"scope": "rspec#testScope()", "sid": "rspec#sid()"}) | ||
|
||
describe "SetupCommand" | ||
it "sets the default command" | ||
Expect Ref("s:rspec_command") == "!clear && echo rspec {spec} && rspec {spec}" | ||
end | ||
|
||
context "when g:rspec_command is not defined" | ||
context "when in GUI" | ||
context "when g:rspec_runner is defined" | ||
before | ||
call Set("s:forceGUI", 1) | ||
let s:original_runner = g:rspec_runner | ||
let g:rspec_runner = "iterm" | ||
end | ||
|
||
after | ||
let g:rspec_runner = s:original_runner | ||
call Set("s:forceGUI", 0) | ||
end | ||
|
||
it "sets the command with provided runner" | ||
call Call("s:SetupCommand") | ||
|
||
Expect Ref("s:rspec_command") =~ "^silent !\.\*/bin/iterm 'rspec {spec}'$" | ||
end | ||
end | ||
|
||
context "when rspec_runner is not defined" | ||
before | ||
call Set("s:forceGUI", 1) | ||
end | ||
|
||
after | ||
call Set("s:forceGUI", 0) | ||
end | ||
|
||
it "sets the command with default runner" | ||
call Call("s:SetupCommand") | ||
|
||
Expect Ref("s:rspec_command") =~ "^silent !\.\*/bin/os_x_terminal 'rspec {spec}'$" | ||
end | ||
end | ||
end | ||
end | ||
|
||
context "when g:rspec_command is defined" | ||
before | ||
call Set("s:forceGUI", 0) | ||
let g:rspec_command = "Dispatch rspec {spec}" | ||
end | ||
|
||
after | ||
unlet g:rspec_command | ||
end | ||
|
||
context "when not in GUI" | ||
it "sets the provided command" | ||
call Call("s:SetupCommand") | ||
|
||
Expect Ref("s:rspec_command") == "Dispatch rspec {spec}" | ||
end | ||
end | ||
|
||
context "when in GUI" | ||
before | ||
call Set("s:forceGUI", 1) | ||
end | ||
|
||
after | ||
call Set("s:forceGUI", 0) | ||
end | ||
|
||
it "sets the provided GUI command" | ||
call Call("s:SetupCommand") | ||
|
||
Expect Ref("s:rspec_command") =~ "^silent !\.\*/bin/os_x_terminal 'Dispatch rspec {spec}'$" | ||
end | ||
end | ||
end | ||
end |