Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add alias mustnt and optional will syntax.
  • Loading branch information
trans committed Jun 18, 2012
1 parent d784367 commit f924d7d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/fluidity/must.rb
Expand Up @@ -28,7 +28,11 @@ def must_not(matcher=nil)
end
end

alias_method :musnt, :must_not
# Contraction do must not.
#
# 10.mustnt.be.kind_of?(Integer)
#
alias_method :mustnt, :must_not

end

36 changes: 36 additions & 0 deletions lib/fluidity/will.rb
@@ -0,0 +1,36 @@
require 'fluidity/grammer'

class Object #BasicObject

# Use `will` nomenclature for assertions.
#
# 10.will.be.kind_of(Integer)
#
def will(matcher=nil)
if matcher
matcher =~ self
else
::Fluidity::Grammer::Must.new(self)
end
end

# Also, `will_not` nomenclature for assertions.
#
# 10.will_not.be.kind_of?(Integer)
#
def must_not(matcher=nil)
if matcher
matcher !~ self
else
::Fluidity::Grammer::Must.new(self, true)
end
end

# Contraction of will not.
#
# 10.wont.be.kind_of?(Integer)
#
alias_method :wont, :will_not

end

0 comments on commit f924d7d

Please sign in to comment.