ae 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{HISTORY → HISTORY.rdoc} +34 -0
 - data/NOTICE +14 -0
 - data/expo/cucumber/features/cucumber.feature +10 -0
 - data/expo/cucumber/features/step_definitions/cucumber_steps.rb +11 -0
 - data/expo/cucumber/features/support/env.rb +1 -0
 - data/lib/ae.rb +4 -10
 - data/lib/ae/assert.rb +14 -10
 - data/lib/ae/assertor.rb +31 -11
 - data/lib/ae/basic_object.rb +116 -0
 - data/lib/ae/core_ext.rb +14 -1
 - data/lib/ae/dot.rb +21 -0
 - data/lib/ae/meta/data.rb +29 -0
 - data/lib/ae/meta/package +8 -0
 - data/{PROFILE → lib/ae/meta/profile} +0 -0
 - data/lib/ae/pry.rb +35 -0
 - data/lib/ae/subjunctive.rb +3 -3
 - data/lib/ae/subjunctive/should.rb +2 -2
 - data/{demo → qed}/01_overview.rdoc +0 -0
 - data/{demo → qed}/02_assertion.rdoc +0 -0
 - data/{demo → qed}/03_assert.rdoc +3 -2
 - data/{demo → qed}/04_subjunctive.rdoc +0 -0
 - data/{demo → qed}/05_expect.rdoc +0 -0
 - data/{demo → qed}/06_counts.rdoc +1 -1
 - data/qed/07_matchers.rdoc +34 -0
 - metadata +24 -18
 - data/PACKAGE +0 -5
 - data/REQUIRE +0 -5
 - data/lib/ae/package.yml +0 -5
 - data/lib/ae/profile.yml +0 -18
 
    
        data/{HISTORY → HISTORY.rdoc}
    RENAMED
    
    | 
         @@ -1,9 +1,43 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            = RELEASE HISTORY
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            == 1.4.0 / 2010-09-02
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Version 1.4 brings Ruby 1.9 compatibility. The Assertor class is now a
         
     | 
| 
      
 6 
     | 
    
         
            +
            subclass of BasicObject. This fixes an issues Assertor would had
         
     | 
| 
      
 7 
     | 
    
         
            +
            applying to methods defined both in a class and Kernel.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Changes:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            * Assertor is a subclass of BasicObject.
         
     | 
| 
      
 12 
     | 
    
         
            +
            * Use custom BasicObject when using Ruby 1.8.
         
     | 
| 
      
 13 
     | 
    
         
            +
            * Add #assert= which works like `assert ==`.
         
     | 
| 
      
 14 
     | 
    
         
            +
            * Add #refute= which works like `refute ==`.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            == 1.3.0 / 2010-06-17
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            New release of AE adds support for RSpec-style matchers. This means
         
     | 
| 
      
 20 
     | 
    
         
            +
            it should be usable with Shoulda 3.0 and any other matchers library.
         
     | 
| 
      
 21 
     | 
    
         
            +
            This release also cleans up the underlying code, which is now
         
     | 
| 
      
 22 
     | 
    
         
            +
            extremely clean. Lastly a smal API change allows #asser to compare
         
     | 
| 
      
 23 
     | 
    
         
            +
            it's argument to the return of it's block using #==, just as #expect
         
     | 
| 
      
 24 
     | 
    
         
            +
            does using #===.
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            Changes:
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            * Add RSpec-style matchers support.
         
     | 
| 
      
 29 
     | 
    
         
            +
            * Move #expect code to Assertor.
         
     | 
| 
      
 30 
     | 
    
         
            +
            * #assert method can do equality camparison.
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       3 
33 
     | 
    
         
             
            == 1.2.3 / 2010-06-07
         
     | 
| 
       4 
34 
     | 
    
         | 
| 
       5 
35 
     | 
    
         
             
            This release is a quick fix, which adds a missing `require 'yaml'`.
         
     | 
| 
       6 
36 
     | 
    
         | 
| 
      
 37 
     | 
    
         
            +
            Changes:
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            * Add missing require 'yaml'.
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       7 
41 
     | 
    
         | 
| 
       8 
42 
     | 
    
         
             
            == 1.2.2 / 2010-06-06
         
     | 
| 
       9 
43 
     | 
    
         | 
    
        data/NOTICE
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = COPYRIGHT NOTICES
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            == BasicObject
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            BasicObject is based on Jim Weirich's BlankSlate.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                BlankSlate
         
     | 
| 
      
 8 
     | 
    
         
            +
                Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org).
         
     | 
| 
      
 9 
     | 
    
         
            +
                All rights reserved.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                Permission is granted for use, copying, modification, distribution,
         
     | 
| 
      
 12 
     | 
    
         
            +
                and distribution of modified versions of this work as long as the
         
     | 
| 
      
 13 
     | 
    
         
            +
                above copyright notice is included.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            Given /^(\w+) = (\w+)$/ do |var, value|
         
     | 
| 
      
 3 
     | 
    
         
            +
              instance_variable_set("@#{var}", value)
         
     | 
| 
      
 4 
     | 
    
         
            +
            end
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Then /^I can assert that (\w+).assert == (\w+)$/ do |var_a, var_b|
         
     | 
| 
      
 7 
     | 
    
         
            +
              a = instance_variable_get("@#{var_a}")
         
     | 
| 
      
 8 
     | 
    
         
            +
              b = instance_variable_get("@#{var_b}")
         
     | 
| 
      
 9 
     | 
    
         
            +
              a.assert == b
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'ae'
         
     | 
    
        data/lib/ae.rb
    CHANGED
    
    | 
         @@ -3,21 +3,15 @@ require 'yaml' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module AE
         
     | 
| 
       4 
4 
     | 
    
         
             
              DIRECTORY = File.dirname(__FILE__) + '/ae'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              PROFILE = YAML.load(File.new(DIRECTORY + '/profile 
     | 
| 
       7 
     | 
    
         
            -
              PACKAGE = YAML.load(File.new(DIRECTORY + '/package 
     | 
| 
      
 6 
     | 
    
         
            +
              PROFILE = YAML.load(File.new(DIRECTORY + '/meta/profile')) rescue {}
         
     | 
| 
      
 7 
     | 
    
         
            +
              PACKAGE = YAML.load(File.new(DIRECTORY + '/meta/package')) rescue {}
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
              VERSION = PACKAGE 
     | 
| 
      
 9 
     | 
    
         
            +
              VERSION = PACKAGE['version']
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              #
         
     | 
| 
       12 
12 
     | 
    
         
             
              def self.const_missing(name)
         
     | 
| 
       13 
13 
     | 
    
         
             
                key = name.to_s.downcase
         
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                  PACKAGE[key]
         
     | 
| 
       16 
     | 
    
         
            -
                elsif PROFILE.key?(key)
         
     | 
| 
       17 
     | 
    
         
            -
                  PROFILE[key]
         
     | 
| 
       18 
     | 
    
         
            -
                else
         
     | 
| 
       19 
     | 
    
         
            -
                  super(name)
         
     | 
| 
       20 
     | 
    
         
            -
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
                PACAKGE[key] || PROFILE[key] || super(name)
         
     | 
| 
       21 
15 
     | 
    
         
             
              end
         
     | 
| 
       22 
16 
     | 
    
         
             
            end
         
     | 
| 
       23 
17 
     | 
    
         | 
    
        data/lib/ae/assert.rb
    CHANGED
    
    | 
         @@ -28,29 +28,33 @@ module AE 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                # Same as 'object.assert == other'.
         
     | 
| 
       30 
30 
     | 
    
         
             
                def assert=(cmp)
         
     | 
| 
       31 
     | 
    
         
            -
                  Assertor.new(self, :backtrace=>caller).assert 
     | 
| 
      
 31 
     | 
    
         
            +
                  Assertor.new(self, :backtrace=>caller).assert == cmp
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                # Assert not an operational relationship.
         
     | 
| 
       35 
35 
     | 
    
         
             
                # Read it as "assert not".
         
     | 
| 
       36 
36 
     | 
    
         
             
                #
         
     | 
| 
       37 
     | 
    
         
            -
                #   4. 
     | 
| 
      
 37 
     | 
    
         
            +
                #   4.refute == 4  #=> Assertion Error
         
     | 
| 
       38 
38 
     | 
    
         
             
                #
         
     | 
| 
       39 
39 
     | 
    
         
             
                # See #assert.
         
     | 
| 
       40 
     | 
    
         
            -
                 
     | 
| 
       41 
     | 
    
         
            -
                # AUHTOR'S NOTE: This method would not be necessary if Ruby would allow
         
     | 
| 
       42 
     | 
    
         
            -
                # +!=+ to be define as a method, or at least +!+ as a unary method. This
         
     | 
| 
       43 
     | 
    
         
            -
                # may be possible in Ruby 1.9.
         
     | 
| 
       44 
     | 
    
         
            -
                #
         
     | 
| 
       45 
     | 
    
         
            -
                def assert!(*args, &block)
         
     | 
| 
      
 40 
     | 
    
         
            +
                def refute(*args, &block)
         
     | 
| 
       46 
41 
     | 
    
         
             
                  Assertor.new(self, :backtrace=>caller).not.assert(*args, &block)
         
     | 
| 
       47 
42 
     | 
    
         
             
                end
         
     | 
| 
       48 
43 
     | 
    
         | 
| 
      
 44 
     | 
    
         
            +
                # Same as 'object.assert == other'.
         
     | 
| 
      
 45 
     | 
    
         
            +
                def refute=(cmp)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  Assertor.new(self, :backtrace=>caller).not.assert == cmp
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
       49 
49 
     | 
    
         
             
                # Alias for #assert!.
         
     | 
| 
       50 
50 
     | 
    
         
             
                #
         
     | 
| 
       51 
     | 
    
         
            -
                # 
     | 
| 
      
 51 
     | 
    
         
            +
                #   4.assert! == 4
         
     | 
| 
       52 
52 
     | 
    
         
             
                #
         
     | 
| 
       53 
     | 
    
         
            -
                 
     | 
| 
      
 53 
     | 
    
         
            +
                # NOTE: This method would not be necessary if Ruby would allow
         
     | 
| 
      
 54 
     | 
    
         
            +
                # +!=+ to be define as a method, or at least +!+ as a unary method.
         
     | 
| 
      
 55 
     | 
    
         
            +
                # This may be possible in Ruby 1.9.
         
     | 
| 
      
 56 
     | 
    
         
            +
                alias_method :assert!, :refute
         
     | 
| 
      
 57 
     | 
    
         
            +
               
         
     | 
| 
       54 
58 
     | 
    
         
             
              end
         
     | 
| 
       55 
59 
     | 
    
         | 
| 
       56 
60 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ae/assertor.rb
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'ae/assertion'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'ae/basic_object'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            # = Assertor (Assertion Functor)
         
     | 
| 
       4 
5 
     | 
    
         
             
            #
         
     | 
| 
         @@ -10,13 +11,17 @@ require 'ae/assertion' 
     | 
|
| 
       10 
11 
     | 
    
         
             
            # in most respects, but is conditioned on the operation applied,
         
     | 
| 
       11 
12 
     | 
    
         
             
            # rather then simply passing-off to an alternate reciever.
         
     | 
| 
       12 
13 
     | 
    
         
             
            #
         
     | 
| 
       13 
     | 
    
         
            -
            class Assertor
         
     | 
| 
      
 14 
     | 
    
         
            +
            class Assertor < AE::BasicObject
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
16 
     | 
    
         
             
              $assertions = 0
         
     | 
| 
       16 
17 
     | 
    
         
             
              $failures   = 0
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
              #
         
     | 
| 
       19 
     | 
    
         
            -
              instance_methods.each{ |m| protected m unless /^__/ =~ m.to_s }
         
     | 
| 
      
 20 
     | 
    
         
            +
              #instance_methods.each{ |m| protected m unless /^(__|object_id$)/ =~ m.to_s }
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              if ::RUBY_VERSION >= '1.9'
         
     | 
| 
      
 23 
     | 
    
         
            +
                eval "private :==, :!, :!="  # using eval here b/c it's a syntax error in 1.8-
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
       20 
25 
     | 
    
         | 
| 
       21 
26 
     | 
    
         
             
              # New Assertor.
         
     | 
| 
       22 
27 
     | 
    
         
             
              #
         
     | 
| 
         @@ -50,11 +55,11 @@ class Assertor 
     | 
|
| 
       50 
55 
     | 
    
         
             
              #   assert something, parameter
         
     | 
| 
       51 
56 
     | 
    
         
             
              #
         
     | 
| 
       52 
57 
     | 
    
         
             
              def assert(*args, &block)
         
     | 
| 
       53 
     | 
    
         
            -
                return self if args.empty? && ! 
     | 
| 
      
 58 
     | 
    
         
            +
                return self if args.empty? && !block
         
     | 
| 
       54 
59 
     | 
    
         | 
| 
       55 
60 
     | 
    
         
             
                target = block || args.shift
         
     | 
| 
       56 
61 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
                if Proc === target || target.respond_to?(:to_proc)
         
     | 
| 
      
 62 
     | 
    
         
            +
                if ::Proc === target || target.respond_to?(:to_proc)
         
     | 
| 
       58 
63 
     | 
    
         
             
                  block  = target.to_proc
         
     | 
| 
       59 
64 
     | 
    
         
             
                  match  = args.shift
         
     | 
| 
       60 
65 
     | 
    
         
             
                  result = block.arity > 0 ? block.call(@delegate) : block.call
         
     | 
| 
         @@ -86,15 +91,15 @@ class Assertor 
     | 
|
| 
       86 
91 
     | 
    
         
             
              # TODO: respond_to?(:exception) && match = exception if Exception === match
         
     | 
| 
       87 
92 
     | 
    
         
             
              #++
         
     | 
| 
       88 
93 
     | 
    
         
             
              def expect(*args, &block)
         
     | 
| 
       89 
     | 
    
         
            -
                # same as #assert 
     | 
| 
       90 
     | 
    
         
            -
                return self if args.empty? && !block_given?
         
     | 
| 
      
 94 
     | 
    
         
            +
                return self if args.empty? && !block_given?  # same as #assert
         
     | 
| 
       91 
95 
     | 
    
         | 
| 
       92 
96 
     | 
    
         
             
                target = block || args.shift
         
     | 
| 
       93 
97 
     | 
    
         | 
| 
       94 
     | 
    
         
            -
                if Proc === target || target.respond_to?(:to_proc)
         
     | 
| 
      
 98 
     | 
    
         
            +
                if ::Proc === target || target.respond_to?(:to_proc)
         
     | 
| 
       95 
99 
     | 
    
         
             
                  block = target.to_proc
         
     | 
| 
       96 
100 
     | 
    
         
             
                  match = args.shift || @delegate
         
     | 
| 
       97 
     | 
    
         
            -
                  if Exception === match || (Class===match && match.ancestors.include?(Exception))
         
     | 
| 
      
 101 
     | 
    
         
            +
                  if ::Exception === match || (::Class===match && match.ancestors.include?(::Exception))
         
     | 
| 
      
 102 
     | 
    
         
            +
                    $DEBUG, debug = false, $DEBUG  # b/c it always spits-out a NameError
         
     | 
| 
       98 
103 
     | 
    
         
             
                    begin
         
     | 
| 
       99 
104 
     | 
    
         
             
                      block.arity > 0 ? block.call(@delegate) : block.call
         
     | 
| 
       100 
105 
     | 
    
         
             
                      pass = false
         
     | 
| 
         @@ -105,6 +110,8 @@ class Assertor 
     | 
|
| 
       105 
110 
     | 
    
         
             
                    rescue Exception => error
         
     | 
| 
       106 
111 
     | 
    
         
             
                      pass = false
         
     | 
| 
       107 
112 
     | 
    
         
             
                      msg  = "#{match} expected but #{error.class} was raised"
         
     | 
| 
      
 113 
     | 
    
         
            +
                    ensure
         
     | 
| 
      
 114 
     | 
    
         
            +
                      $DEBUG = debug
         
     | 
| 
       108 
115 
     | 
    
         
             
                    end
         
     | 
| 
       109 
116 
     | 
    
         
             
                  else
         
     | 
| 
       110 
117 
     | 
    
         
             
                    result = block.arity > 0 ? block.call(@delegte) : block.call
         
     | 
| 
         @@ -126,7 +133,7 @@ class Assertor 
     | 
|
| 
       126 
133 
     | 
    
         
             
              #
         
     | 
| 
       127 
134 
     | 
    
         
             
              def flunk(msg=nil)
         
     | 
| 
       128 
135 
     | 
    
         
             
                $failures += 1
         
     | 
| 
       129 
     | 
    
         
            -
                fail Assertion.new(msg || @message, :backtrace=>@backtrace)
         
     | 
| 
      
 136 
     | 
    
         
            +
                fail ::Assertion.new(msg || @message, :backtrace=>@backtrace)
         
     | 
| 
       130 
137 
     | 
    
         
             
              end
         
     | 
| 
       131 
138 
     | 
    
         | 
| 
       132 
139 
     | 
    
         
             
              # Ruby seems to have a quark in it's implementation whereby
         
     | 
| 
         @@ -136,12 +143,18 @@ class Assertor 
     | 
|
| 
       136 
143 
     | 
    
         
             
                method_missing(:"=~", match)
         
     | 
| 
       137 
144 
     | 
    
         
             
              end
         
     | 
| 
       138 
145 
     | 
    
         | 
| 
      
 146 
     | 
    
         
            +
              #
         
     | 
| 
      
 147 
     | 
    
         
            +
              def send(op, *a, &b)
         
     | 
| 
      
 148 
     | 
    
         
            +
                method_missing(op, *a, &b)
         
     | 
| 
      
 149 
     | 
    
         
            +
              end
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
       139 
151 
     | 
    
         
             
              private
         
     | 
| 
       140 
152 
     | 
    
         | 
| 
       141 
153 
     | 
    
         
             
              # Converts a missing methods into an Assertion.
         
     | 
| 
       142 
154 
     | 
    
         
             
              #
         
     | 
| 
       143 
155 
     | 
    
         
             
              def method_missing(sym, *a, &b)
         
     | 
| 
       144 
156 
     | 
    
         
             
                pass = @delegate.__send__(sym, *a, &b)
         
     | 
| 
      
 157 
     | 
    
         
            +
                #pass = @delegate.public_send(sym, *a, &b)
         
     | 
| 
       145 
158 
     | 
    
         
             
                __assert__(pass, @message || __msg__(sym, *a, &b))
         
     | 
| 
       146 
159 
     | 
    
         
             
                #Assertor.count += 1
         
     | 
| 
       147 
160 
     | 
    
         
             
                #if (@negated ? pass : !pass)
         
     | 
| 
         @@ -154,10 +167,11 @@ class Assertor 
     | 
|
| 
       154 
167 
     | 
    
         
             
              # Puts together a suitable error message.
         
     | 
| 
       155 
168 
     | 
    
         
             
              #
         
     | 
| 
       156 
169 
     | 
    
         
             
              def __msg__(m, *a, &b)
         
     | 
| 
      
 170 
     | 
    
         
            +
                inspection = @delegate.send(:inspect)
         
     | 
| 
       157 
171 
     | 
    
         
             
                if @negated
         
     | 
| 
       158 
     | 
    
         
            -
                  "! #{ 
     | 
| 
      
 172 
     | 
    
         
            +
                  "! #{inspection} #{m} #{a.collect{|x| x.inspect}.join(',')}"
         
     | 
| 
       159 
173 
     | 
    
         
             
                else
         
     | 
| 
       160 
     | 
    
         
            -
                  "#{ 
     | 
| 
      
 174 
     | 
    
         
            +
                  "#{inspection} #{m} #{a.collect{|x| x.inspect}.join(',')}"
         
     | 
| 
       161 
175 
     | 
    
         
             
                end
         
     | 
| 
       162 
176 
     | 
    
         
             
                #self.class.message(m)[@delegate, *a] )
         
     | 
| 
       163 
177 
     | 
    
         
             
              end
         
     | 
| 
         @@ -194,4 +208,10 @@ class Assertor 
     | 
|
| 
       194 
208 
     | 
    
         
             
              #message(:==){ |*a| "Expected #{a[0].inspect} to be equal to #{a[1].inspect}" }
         
     | 
| 
       195 
209 
     | 
    
         
             
            end
         
     | 
| 
       196 
210 
     | 
    
         | 
| 
      
 211 
     | 
    
         
            +
            # DO WE MAKE THESE EXCEPTIONS?
         
     | 
| 
      
 212 
     | 
    
         
            +
            #class BasicObject
         
     | 
| 
      
 213 
     | 
    
         
            +
            #  def assert ;
         
     | 
| 
      
 214 
     | 
    
         
            +
            #  end
         
     | 
| 
      
 215 
     | 
    
         
            +
            #end
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
       197 
217 
     | 
    
         
             
            # Copyright (c) 2008,2009 Thomas Sawyer
         
     | 
| 
         @@ -0,0 +1,116 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #--
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org).
         
     | 
| 
      
 3 
     | 
    
         
            +
            # All rights reserved.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Permission is granted for use, copying, modification, distribution,
         
     | 
| 
      
 6 
     | 
    
         
            +
            # and distribution of modified versions of this work as long as the
         
     | 
| 
      
 7 
     | 
    
         
            +
            # above copyright notice is included.
         
     | 
| 
      
 8 
     | 
    
         
            +
            #++
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            if RUBY_VERSION >= '1.9'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              module AE
         
     | 
| 
      
 13 
     | 
    
         
            +
                BasicObject = ::BasicObject
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            else
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              module AE
         
     | 
| 
      
 19 
     | 
    
         
            +
                # BasicObject provides an abstract base class with no predefined
         
     | 
| 
      
 20 
     | 
    
         
            +
                # methods (except for <tt>\_\_send__</tt> and <tt>\_\_id__</tt>).
         
     | 
| 
      
 21 
     | 
    
         
            +
                # BlankSlate is useful as a base class when writing classes that
         
     | 
| 
      
 22 
     | 
    
         
            +
                # depend upon <tt>method_missing</tt> (e.g. dynamic proxies).
         
     | 
| 
      
 23 
     | 
    
         
            +
                #
         
     | 
| 
      
 24 
     | 
    
         
            +
                class BasicObject
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  # Hide the method named +name+ in the BlankSlate class.  Don't
         
     | 
| 
      
 27 
     | 
    
         
            +
                  # hide +instance_eval+ or any method beginning with "__".
         
     | 
| 
      
 28 
     | 
    
         
            +
                  def self.hide(name)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    name = name.to_s
         
     | 
| 
      
 30 
     | 
    
         
            +
                    if instance_methods.include?(name) and
         
     | 
| 
      
 31 
     | 
    
         
            +
                      name !~ /^(__|instance_eval|instance_exec)/
         
     | 
| 
      
 32 
     | 
    
         
            +
                      @hidden_methods ||= {}
         
     | 
| 
      
 33 
     | 
    
         
            +
                      @hidden_methods[name.to_sym] = instance_method(name)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      undef_method name
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  def self.find_hidden_method(name)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    @hidden_methods ||= {}
         
     | 
| 
      
 40 
     | 
    
         
            +
                    @hidden_methods[name.to_sym] || superclass.find_hidden_method(name)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  # Redefine a previously hidden method so that it may be called on a blank
         
     | 
| 
      
 44 
     | 
    
         
            +
                  # slate object.
         
     | 
| 
      
 45 
     | 
    
         
            +
                  def self.reveal(name)
         
     | 
| 
      
 46 
     | 
    
         
            +
                    hidden_method = find_hidden_method(name)
         
     | 
| 
      
 47 
     | 
    
         
            +
                    fail "Don't know how to reveal method '#{name}'" unless hidden_method
         
     | 
| 
      
 48 
     | 
    
         
            +
                    define_method(name, hidden_method)
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                  #  
         
     | 
| 
      
 52 
     | 
    
         
            +
                  instance_methods.each { |m| hide(m) }
         
     | 
| 
      
 53 
     | 
    
         
            +
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
              end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              # Since Ruby is very dynamic, methods added to the ancestors of
         
     | 
| 
      
 57 
     | 
    
         
            +
              # BlankSlate <em>after BlankSlate is defined</em> will show up in the
         
     | 
| 
      
 58 
     | 
    
         
            +
              # list of available BlankSlate methods.  We handle this by defining a
         
     | 
| 
      
 59 
     | 
    
         
            +
              # hook in the Object and Kernel classes that will hide any method
         
     | 
| 
      
 60 
     | 
    
         
            +
              # defined after BlankSlate has been loaded.
         
     | 
| 
      
 61 
     | 
    
         
            +
              #
         
     | 
| 
      
 62 
     | 
    
         
            +
              module Kernel
         
     | 
| 
      
 63 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 64 
     | 
    
         
            +
                  alias_method :basic_object_method_added, :method_added
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                  # Detect method additions to Kernel and remove them in the
         
     | 
| 
      
 67 
     | 
    
         
            +
                  # BasicObject class.
         
     | 
| 
      
 68 
     | 
    
         
            +
                  def method_added(name)
         
     | 
| 
      
 69 
     | 
    
         
            +
                    result = basic_object_method_added(name)
         
     | 
| 
      
 70 
     | 
    
         
            +
                    return result if self != Kernel
         
     | 
| 
      
 71 
     | 
    
         
            +
                    AE::BasicObject.hide(name)
         
     | 
| 
      
 72 
     | 
    
         
            +
                    result
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
              # Same as above, except in Object.
         
     | 
| 
      
 78 
     | 
    
         
            +
              #
         
     | 
| 
      
 79 
     | 
    
         
            +
              class Object
         
     | 
| 
      
 80 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 81 
     | 
    
         
            +
                  alias_method :basic_object_method_added, :method_added
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                  # Detect method additions to Object and remove them in the
         
     | 
| 
      
 84 
     | 
    
         
            +
                  # BlankSlate class.
         
     | 
| 
      
 85 
     | 
    
         
            +
                  def method_added(name)
         
     | 
| 
      
 86 
     | 
    
         
            +
                    result = basic_object_method_added(name)
         
     | 
| 
      
 87 
     | 
    
         
            +
                    return result if self != Object
         
     | 
| 
      
 88 
     | 
    
         
            +
                    AE::BasicObject.hide(name)
         
     | 
| 
      
 89 
     | 
    
         
            +
                    result
         
     | 
| 
      
 90 
     | 
    
         
            +
                  end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                  def find_hidden_method(name)
         
     | 
| 
      
 93 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 94 
     | 
    
         
            +
                  end
         
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
              end
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
              # Also, modules included into Object need to be scanned and have their
         
     | 
| 
      
 99 
     | 
    
         
            +
              # instance methods removed from blank slate.  In theory, modules
         
     | 
| 
      
 100 
     | 
    
         
            +
              # included into Kernel would have to be removed as well, but a
         
     | 
| 
      
 101 
     | 
    
         
            +
              # "feature" of Ruby prevents late includes into modules from being
         
     | 
| 
      
 102 
     | 
    
         
            +
              # exposed in the first place.
         
     | 
| 
      
 103 
     | 
    
         
            +
              #
         
     | 
| 
      
 104 
     | 
    
         
            +
              class Module
         
     | 
| 
      
 105 
     | 
    
         
            +
                alias basic_object_original_append_features append_features
         
     | 
| 
      
 106 
     | 
    
         
            +
                def append_features(mod)
         
     | 
| 
      
 107 
     | 
    
         
            +
                  result = basic_object_original_append_features(mod)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  return result if mod != Object
         
     | 
| 
      
 109 
     | 
    
         
            +
                  instance_methods.each do |name|
         
     | 
| 
      
 110 
     | 
    
         
            +
                    AE::BasicObject.hide(name)
         
     | 
| 
      
 111 
     | 
    
         
            +
                  end
         
     | 
| 
      
 112 
     | 
    
         
            +
                  result
         
     | 
| 
      
 113 
     | 
    
         
            +
                end
         
     | 
| 
      
 114 
     | 
    
         
            +
              end
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/ae/core_ext.rb
    CHANGED
    
    | 
         @@ -68,7 +68,7 @@ module Kernel 
     | 
|
| 
       68 
68 
     | 
    
         
             
                begin
         
     | 
| 
       69 
69 
     | 
    
         
             
                  __send__(method, *args, &block)
         
     | 
| 
       70 
70 
     | 
    
         
             
                  true
         
     | 
| 
       71 
     | 
    
         
            -
                rescue
         
     | 
| 
      
 71 
     | 
    
         
            +
                rescue NoMethodError
         
     | 
| 
       72 
72 
     | 
    
         
             
                  false
         
     | 
| 
       73 
73 
     | 
    
         
             
                end
         
     | 
| 
       74 
74 
     | 
    
         
             
              end
         
     | 
| 
         @@ -77,6 +77,14 @@ module Kernel 
     | 
|
| 
       77 
77 
     | 
    
         
             
              #def returns?(value) #:yield:
         
     | 
| 
       78 
78 
     | 
    
         
             
              #  value == yield
         
     | 
| 
       79 
79 
     | 
    
         
             
              #end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
              unless method_defined?(:public_send)
         
     | 
| 
      
 82 
     | 
    
         
            +
                #
         
     | 
| 
      
 83 
     | 
    
         
            +
                def public_send(m,*a,&b)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  raise NoMethodError unless respond_to?(m)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  __send__(m,*a,&b)
         
     | 
| 
      
 86 
     | 
    
         
            +
                end
         
     | 
| 
      
 87 
     | 
    
         
            +
              end
         
     | 
| 
       80 
88 
     | 
    
         
             
            end
         
     | 
| 
       81 
89 
     | 
    
         | 
| 
       82 
90 
     | 
    
         | 
| 
         @@ -198,4 +206,9 @@ class Exception 
     | 
|
| 
       198 
206 
     | 
    
         
             
              end
         
     | 
| 
       199 
207 
     | 
    
         
             
            end
         
     | 
| 
       200 
208 
     | 
    
         | 
| 
      
 209 
     | 
    
         
            +
            # We need BasicObject for Assertor.
         
     | 
| 
      
 210 
     | 
    
         
            +
            unless defined?(BasicObject)
         
     | 
| 
      
 211 
     | 
    
         
            +
              require 'ae/basic_object'
         
     | 
| 
      
 212 
     | 
    
         
            +
            end
         
     | 
| 
      
 213 
     | 
    
         
            +
             
     | 
| 
       201 
214 
     | 
    
         
             
            # Copyright (c) 2008,2009 Thomas Sawyer
         
     | 
    
        data/lib/ae/dot.rb
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Expiremental Concept
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TrueClass
         
     | 
| 
      
 4 
     | 
    
         
            +
              def true
         
     | 
| 
      
 5 
     | 
    
         
            +
                true
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
              def false
         
     | 
| 
      
 8 
     | 
    
         
            +
                fail Assertion.new('true', :backtrace=>caller)
         
     | 
| 
      
 9 
     | 
    
         
            +
                #raise Assertion
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            class FalseClass
         
     | 
| 
      
 14 
     | 
    
         
            +
              def true
         
     | 
| 
      
 15 
     | 
    
         
            +
                fail Assertion.new('false', :backtrace=>caller)
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
              def false
         
     | 
| 
      
 18 
     | 
    
         
            +
                true
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
    
        data/lib/ae/meta/data.rb
    ADDED
    
    | 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Object.__send__(:remove_const, :VERSION) if Object.const_defined?(:VERSION)      # becuase Ruby 1.8~ gets in the way
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module AE
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              def self.__DIR__
         
     | 
| 
      
 6 
     | 
    
         
            +
                File.dirname(__FILE__)
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def self.package
         
     | 
| 
      
 10 
     | 
    
         
            +
                @package ||= (
         
     | 
| 
      
 11 
     | 
    
         
            +
                  require 'yaml'
         
     | 
| 
      
 12 
     | 
    
         
            +
                  YAML.load(File.new(__DIR__ + '/package'))
         
     | 
| 
      
 13 
     | 
    
         
            +
                )
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def self.profile
         
     | 
| 
      
 17 
     | 
    
         
            +
                @profile ||= (
         
     | 
| 
      
 18 
     | 
    
         
            +
                  require 'yaml'
         
     | 
| 
      
 19 
     | 
    
         
            +
                  YAML.load(File.new(__DIR__ + '/profile'))
         
     | 
| 
      
 20 
     | 
    
         
            +
                )
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def self.const_missing(name)
         
     | 
| 
      
 24 
     | 
    
         
            +
                key = name.to_s.downcase
         
     | 
| 
      
 25 
     | 
    
         
            +
                package[key] || profile[key] || super(name)
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
    
        data/lib/ae/meta/package
    ADDED
    
    
| 
         
            File without changes
         
     | 
    
        data/lib/ae/pry.rb
    ADDED
    
    | 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'ae/basic_object'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Kernel
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              $PRY_TABLE = {}
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              # Pry allows you to test private and protected methods,
         
     | 
| 
      
 8 
     | 
    
         
            +
              # via a public-only interface.
         
     | 
| 
      
 9 
     | 
    
         
            +
              #
         
     | 
| 
      
 10 
     | 
    
         
            +
              # Generally one should avoid testing private and protected
         
     | 
| 
      
 11 
     | 
    
         
            +
              # method directly, instead relying on tests of public methods to
         
     | 
| 
      
 12 
     | 
    
         
            +
              # indirectly test them, because private and protected methods are
         
     | 
| 
      
 13 
     | 
    
         
            +
              # considered implementation details. But sometimes is necessary
         
     | 
| 
      
 14 
     | 
    
         
            +
              # to test them directly, or if you wish to achieve *absolute
         
     | 
| 
      
 15 
     | 
    
         
            +
              # coverage*, say in mission critical systems.
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def pry
         
     | 
| 
      
 18 
     | 
    
         
            +
                $PRY_TABLE[self] ||= Pry.new do |op, *a, &b|
         
     | 
| 
      
 19 
     | 
    
         
            +
                  __send__(op, *a, &b)
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              # Pry Functor
         
     | 
| 
      
 24 
     | 
    
         
            +
              class Pry < BasicObject
         
     | 
| 
      
 25 
     | 
    
         
            +
                #instance_methods.each{ |m| private m unless m.to_s =~ /^__/ }
         
     | 
| 
      
 26 
     | 
    
         
            +
                def initialize(&function)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  @function = function
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
                def method_missing(op, *a, &b)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  @function.call(op, *a, &b)
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
    
        data/lib/ae/subjunctive.rb
    CHANGED
    
    | 
         @@ -20,7 +20,7 @@ module AE 
     | 
|
| 
       20 
20 
     | 
    
         
             
                #
         
     | 
| 
       21 
21 
     | 
    
         
             
                def be(*args, &block)
         
     | 
| 
       22 
22 
     | 
    
         
             
                  return self if args.empty? && !block
         
     | 
| 
       23 
     | 
    
         
            -
                  block = args.shift if !block_given? && Proc === args.first
         
     | 
| 
      
 23 
     | 
    
         
            +
                  block = args.shift if !block_given? && ::Proc === args.first
         
     | 
| 
       24 
24 
     | 
    
         
             
                  if block
         
     | 
| 
       25 
25 
     | 
    
         
             
                    pass = block.arity > 0 ? block.call(@delegate) : block.call  #@delegate.instance_eval(&block)
         
     | 
| 
       26 
26 
     | 
    
         
             
                    msg = args.shift || @message || block.inspect
         
     | 
| 
         @@ -43,7 +43,7 @@ module AE 
     | 
|
| 
       43 
43 
     | 
    
         
             
                #
         
     | 
| 
       44 
44 
     | 
    
         
             
                def a(*args, &block)
         
     | 
| 
       45 
45 
     | 
    
         
             
                  return self if args.empty? && !block
         
     | 
| 
       46 
     | 
    
         
            -
                  block = args.shift if !block_given? && Proc === args.first
         
     | 
| 
      
 46 
     | 
    
         
            +
                  block = args.shift if !block_given? && ::Proc === args.first
         
     | 
| 
       47 
47 
     | 
    
         
             
                  if block
         
     | 
| 
       48 
48 
     | 
    
         
             
                    pass = block.arity > 0 ? block.call(@delegate) : block.call  #@delegate.instance_eval(&block)
         
     | 
| 
       49 
49 
     | 
    
         
             
                    msg = args.shift || @message || block.inspect
         
     | 
| 
         @@ -60,7 +60,7 @@ module AE 
     | 
|
| 
       60 
60 
     | 
    
         
             
            end#module AE
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
62 
     | 
    
         
             
            class Assertor
         
     | 
| 
       63 
     | 
    
         
            -
              include AE::Subjunctive
         
     | 
| 
      
 63 
     | 
    
         
            +
              include ::AE::Subjunctive
         
     | 
| 
       64 
64 
     | 
    
         
             
            end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
            # Copyright (c) 2008,2009 Thomas Sawyer
         
     | 
| 
         @@ -11,7 +11,7 @@ module AE 
     | 
|
| 
       11 
11 
     | 
    
         
             
              # THIS IS AN OPTIONAL LIBRARY.
         
     | 
| 
       12 
12 
     | 
    
         
             
              #
         
     | 
| 
       13 
13 
     | 
    
         
             
              module Should
         
     | 
| 
       14 
     | 
    
         
            -
                #  
     | 
| 
      
 14 
     | 
    
         
            +
                # Make an assertion in subjunctive tense.
         
     | 
| 
       15 
15 
     | 
    
         
             
                #
         
     | 
| 
       16 
16 
     | 
    
         
             
                #   4.should == 3  #=> Assertion Error
         
     | 
| 
       17 
17 
     | 
    
         
             
                #
         
     | 
| 
         @@ -24,7 +24,7 @@ module AE 
     | 
|
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                # Designate a negated expectation via a *functor*.
         
     | 
| 
       27 
     | 
    
         
            -
                # Read this as " 
     | 
| 
      
 27 
     | 
    
         
            +
                # Read this as "should not".
         
     | 
| 
       28 
28 
     | 
    
         
             
                #
         
     | 
| 
       29 
29 
     | 
    
         
             
                #   4.should! == 4  #=> Assertion Error
         
     | 
| 
       30 
30 
     | 
    
         
             
                #
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
    
        data/{demo → qed}/03_assert.rdoc
    RENAMED
    
    | 
         @@ -60,7 +60,7 @@ Another way to get the opposite inference, is to use +not+. 
     | 
|
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
            == Matchers & Lambda Assertions
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
            Passing a Proc object or an objec that responds to : 
     | 
| 
      
 63 
     | 
    
         
            +
            Passing a Proc object or an objec that responds to :to_proc, will use it
         
     | 
| 
       64 
64 
     | 
    
         
             
            as if it were a block of the method. This allows for a simple way to quickly
         
     | 
| 
       65 
65 
     | 
    
         
             
            create reusable assertions.
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
         @@ -72,6 +72,7 @@ Additionally is the object responds to #matches? then the receiver 
     | 
|
| 
       72 
72 
     | 
    
         
             
            will be passed to this method to determine passage.
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
74 
     | 
    
         
             
              palindrome = Object.new
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       75 
76 
     | 
    
         
             
              def palindrome.matches?(word)
         
     | 
| 
       76 
77 
     | 
    
         
             
                word == word.reverse
         
     | 
| 
       77 
78 
     | 
    
         
             
              end
         
     | 
| 
         @@ -81,7 +82,7 @@ will be passed to this method to determine passage. 
     | 
|
| 
       81 
82 
     | 
    
         | 
| 
       82 
83 
     | 
    
         
             
            == Identity Assertions
         
     | 
| 
       83 
84 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
            Rather then the general form 
     | 
| 
      
 85 
     | 
    
         
            +
            Rather then the general form.
         
     | 
| 
       85 
86 
     | 
    
         | 
| 
       86 
87 
     | 
    
         
             
              x = 10
         
     | 
| 
       87 
88 
     | 
    
         
             
              x.assert.object_id == x.object_id
         
     | 
| 
         
            File without changes
         
     | 
    
        data/{demo → qed}/05_expect.rdoc
    RENAMED
    
    | 
         
            File without changes
         
     | 
    
        data/{demo → qed}/06_counts.rdoc
    RENAMED
    
    
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = Matchers
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Matchers are simply Procs or objects with the proper interface that can be
         
     | 
| 
      
 4 
     | 
    
         
            +
            passed to #assert or #refute (or other Assertor) as an ecapsulated test.
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            == Proc or #to_proc
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            Passing a Proc object or an object that responds to :to_proc, will use it
         
     | 
| 
      
 9 
     | 
    
         
            +
            as if it were a block of the method. This allows for a simple way to quickly
         
     | 
| 
      
 10 
     | 
    
         
            +
            create reusable assertions.
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              palindrome = lambda{ |word| word == word.reverse }
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              "abracarba".assert palindrome
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            == #matches?
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Additionally if an object responds to #matches? then the receiver
         
     | 
| 
      
 19 
     | 
    
         
            +
            will be passed to this method to determine if the assertion passes.
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              palindrome = Object.new
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def palindrome.matches?(word)
         
     | 
| 
      
 24 
     | 
    
         
            +
                word == word.reverse
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              "abracarba".assert palindrome
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            == RSpec, Shoulda and other 3rd-Party Matchers 
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            With tha addition of #matches?, AE supports the same interface for matchers
         
     | 
| 
      
 32 
     | 
    
         
            +
            as RSpec. Any matcher library designed for use with RSpec should therefore
         
     | 
| 
      
 33 
     | 
    
         
            +
            be usable with AE as well. This includes RSpecs own matchers and Shoulda's
         
     | 
| 
      
 34 
     | 
    
         
            +
            excellent Rails matchers.
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ae
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 7
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 1
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
      
 8 
     | 
    
         
            +
              - 4
         
     | 
| 
       9 
9 
     | 
    
         
             
              - 0
         
     | 
| 
       10 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 10 
     | 
    
         
            +
              version: 1.4.0
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Thomas Sawyer
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-09-02 00:00:00 -04:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -55,36 +55,42 @@ extensions: [] 
     | 
|
| 
       55 
55 
     | 
    
         
             
            extra_rdoc_files: 
         
     | 
| 
       56 
56 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       57 
57 
     | 
    
         
             
            files: 
         
     | 
| 
       58 
     | 
    
         
            -
            -  
     | 
| 
       59 
     | 
    
         
            -
            -  
     | 
| 
       60 
     | 
    
         
            -
            -  
     | 
| 
       61 
     | 
    
         
            -
            -  
     | 
| 
       62 
     | 
    
         
            -
            -  
     | 
| 
       63 
     | 
    
         
            -
            -  
     | 
| 
      
 58 
     | 
    
         
            +
            - expo/cucumber/features/cucumber.feature
         
     | 
| 
      
 59 
     | 
    
         
            +
            - expo/cucumber/features/step_definitions/cucumber_steps.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - expo/cucumber/features/support/env.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - qed/01_overview.rdoc
         
     | 
| 
      
 62 
     | 
    
         
            +
            - qed/02_assertion.rdoc
         
     | 
| 
      
 63 
     | 
    
         
            +
            - qed/03_assert.rdoc
         
     | 
| 
      
 64 
     | 
    
         
            +
            - qed/04_subjunctive.rdoc
         
     | 
| 
      
 65 
     | 
    
         
            +
            - qed/05_expect.rdoc
         
     | 
| 
      
 66 
     | 
    
         
            +
            - qed/06_counts.rdoc
         
     | 
| 
      
 67 
     | 
    
         
            +
            - qed/07_matchers.rdoc
         
     | 
| 
       64 
68 
     | 
    
         
             
            - lib/ae/assert.rb
         
     | 
| 
       65 
69 
     | 
    
         
             
            - lib/ae/assertion.rb
         
     | 
| 
       66 
70 
     | 
    
         
             
            - lib/ae/assertor.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - lib/ae/basic_object.rb
         
     | 
| 
       67 
72 
     | 
    
         
             
            - lib/ae/core_ext.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - lib/ae/dot.rb
         
     | 
| 
       68 
74 
     | 
    
         
             
            - lib/ae/expect.rb
         
     | 
| 
       69 
75 
     | 
    
         
             
            - lib/ae/legacy.rb
         
     | 
| 
      
 76 
     | 
    
         
            +
            - lib/ae/meta/data.rb
         
     | 
| 
      
 77 
     | 
    
         
            +
            - lib/ae/meta/package
         
     | 
| 
      
 78 
     | 
    
         
            +
            - lib/ae/meta/profile
         
     | 
| 
       70 
79 
     | 
    
         
             
            - lib/ae/must.rb
         
     | 
| 
       71 
     | 
    
         
            -
            - lib/ae/ 
     | 
| 
       72 
     | 
    
         
            -
            - lib/ae/profile.yml
         
     | 
| 
      
 80 
     | 
    
         
            +
            - lib/ae/pry.rb
         
     | 
| 
       73 
81 
     | 
    
         
             
            - lib/ae/should.rb
         
     | 
| 
       74 
82 
     | 
    
         
             
            - lib/ae/subjunctive/must.rb
         
     | 
| 
       75 
83 
     | 
    
         
             
            - lib/ae/subjunctive/should.rb
         
     | 
| 
       76 
84 
     | 
    
         
             
            - lib/ae/subjunctive.rb
         
     | 
| 
       77 
85 
     | 
    
         
             
            - lib/ae.rb
         
     | 
| 
       78 
     | 
    
         
            -
            -  
     | 
| 
       79 
     | 
    
         
            -
            - PACKAGE
         
     | 
| 
      
 86 
     | 
    
         
            +
            - HISTORY.rdoc
         
     | 
| 
       80 
87 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       81 
88 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       82 
     | 
    
         
            -
            -  
     | 
| 
       83 
     | 
    
         
            -
            - REQUIRE
         
     | 
| 
      
 89 
     | 
    
         
            +
            - NOTICE
         
     | 
| 
       84 
90 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       85 
91 
     | 
    
         
             
            homepage: http://proutils.github.com/ae
         
     | 
| 
       86 
     | 
    
         
            -
            licenses:  
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
      
 92 
     | 
    
         
            +
            licenses: 
         
     | 
| 
      
 93 
     | 
    
         
            +
            - MIT
         
     | 
| 
       88 
94 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       89 
95 
     | 
    
         
             
            rdoc_options: 
         
     | 
| 
       90 
96 
     | 
    
         
             
            - --title
         
     | 
    
        data/PACKAGE
    DELETED
    
    
    
        data/REQUIRE
    DELETED
    
    
    
        data/lib/ae/package.yml
    DELETED
    
    
    
        data/lib/ae/profile.yml
    DELETED
    
    | 
         @@ -1,18 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            --- 
         
     | 
| 
       2 
     | 
    
         
            -
            title  : AE
         
     | 
| 
       3 
     | 
    
         
            -
            summary: Assertive Expressive
         
     | 
| 
       4 
     | 
    
         
            -
            suite  : proutils
         
     | 
| 
       5 
     | 
    
         
            -
            contact: trans <transfire@gmail.com>
         
     | 
| 
       6 
     | 
    
         
            -
            created: 2008-08-17 09:00:06
         
     | 
| 
       7 
     | 
    
         
            -
            authors: Thomas Sawyer
         
     | 
| 
       8 
     | 
    
         
            -
            license: MIT
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            description:
         
     | 
| 
       11 
     | 
    
         
            -
              Assertive Expressive is an assertions library intended for reuse
         
     | 
| 
       12 
     | 
    
         
            -
              by any TDD, BDD or the like system.
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            resources:
         
     | 
| 
       15 
     | 
    
         
            -
              homepage: http://proutils.github.com/ae
         
     | 
| 
       16 
     | 
    
         
            -
              repository: git://github.com/proutils/ae.git
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            copyright: Copyright (c) 2008 Thomas Sawyer
         
     |