Permalink
Browse files

Add new aliases for predefined custom matchers

  • Loading branch information...
1 parent e4d56a6 commit 92feb8e6cd9e3978fa9a277cf793508aff923cdb @kana committed Oct 25, 2012
Showing with 16 additions and 4 deletions.
  1. +4 −2 autoload/vspec.vim
  2. +12 −2 t/builtin-matchers.vim
View
@@ -301,19 +301,21 @@ endfunction
-" Predefined custom matchers - toBeFalse "{{{2
+" Predefined custom matchers - to_be_false "{{{2
function! vspec#_matcher_false(value)
return type(a:value) == type(0) ? !(a:value) : s:FALSE
endfunction
+call vspec#customize_matcher('to_be_false', function('vspec#_matcher_false'))
call vspec#customize_matcher('toBeFalse', function('vspec#_matcher_false'))
-" Predefined custom matchers - toBeTrue "{{{2
+" Predefined custom matchers - to_be_true "{{{2
function! vspec#_matcher_true(value)
return type(a:value) == type(0) ? !!(a:value) : s:FALSE
endfunction
+call vspec#customize_matcher('to_be_true', function('vspec#_matcher_true'))
call vspec#customize_matcher('toBeTrue', function('vspec#_matcher_true'))
@@ -844,15 +844,25 @@ describe 'isnot?'
end
end
-describe 'be false'
+describe 'to_be_false'
it 'should succeed if a given value is false'
+ Expect 0 to_be_false
+ Expect 1 not to_be_false
+ end
+
+ it 'is still available as old style alias'
Expect 0 toBeFalse
Expect 1 not toBeFalse
end
end
-describe 'be true'
+describe 'to_be_true'
it 'should succeed if a given value is true'
+ Expect 0 not to_be_true
+ Expect 1 to_be_true
+ end
+
+ it 'is still available as old style alias'
Expect 0 not toBeTrue
Expect 1 toBeTrue
end

0 comments on commit 92feb8e

Please sign in to comment.