Permalink
Browse files

Add alias mustnt and optional will syntax.

  • Loading branch information...
1 parent d784367 commit f924d7d87689bf83d3b297abbaf4ce577bf23eb8 @trans trans committed Jun 18, 2012
Showing with 41 additions and 1 deletion.
  1. +5 −1 lib/fluidity/must.rb
  2. +36 −0 lib/fluidity/will.rb
@@ -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
View
@@ -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.