ae 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +33 -0
- data/{LICENSE → Apache2.txt} +3 -1
- data/{HISTORY.rdoc → History.rdoc} +18 -0
- data/NOTICE.rdoc +30 -0
- data/README.rdoc +38 -11
- data/Syckfile +82 -0
- data/lib/ae.rb +22 -19
- data/lib/ae.yml +33 -0
- data/lib/ae/adapters/minitest.rb +10 -17
- data/lib/ae/adapters/rspec.rb +1 -11
- data/lib/ae/adapters/testunit.rb +21 -20
- data/lib/ae/assert.rb +15 -8
- data/lib/ae/assertion.rb +36 -60
- data/lib/ae/assertor.rb +250 -178
- data/lib/ae/basic_object.rb +6 -10
- data/lib/ae/core_ext.rb +2 -208
- data/lib/ae/core_ext/exception.rb +13 -0
- data/lib/ae/core_ext/helpers.rb +198 -0
- data/lib/ae/expect.rb +2 -2
- data/lib/ae/must.rb +5 -1
- data/lib/ae/subjunctive.rb +1 -1
- data/lib/ae/version.rb +19 -0
- data/qed/01_overview.rdoc +1 -1
- data/qed/06_counts.rdoc +11 -7
- metadata +18 -17
- data/NOTICE +0 -14
- data/lib/ae/meta/data.rb +0 -29
- data/lib/ae/meta/package +0 -8
- data/lib/ae/meta/profile +0 -23
data/.ruby
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
spec_version: 1.0.0
|
3
|
+
name: ae
|
4
|
+
title: AE
|
5
|
+
engine_check:
|
6
|
+
- ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
|
7
|
+
contact: trans <transfire@gmail.com>
|
8
|
+
resources:
|
9
|
+
repo: git://github.com/rubyworks/ae.git
|
10
|
+
code: http://github.com/rubyworks/ae
|
11
|
+
mail: http://groups.google.com/group/rubyworks-mailinglist
|
12
|
+
docs: http://wiki.github.com/rubyworks/ae/docs/qed
|
13
|
+
bugs: http://github.com/rubyworks/ae/issues
|
14
|
+
wiki: http://wiki.github.com/rubyworks/ae
|
15
|
+
home: http://rubyworks.github.com/ae
|
16
|
+
requires:
|
17
|
+
- group:
|
18
|
+
- build
|
19
|
+
name: syckle
|
20
|
+
version: 0+
|
21
|
+
- group:
|
22
|
+
- test
|
23
|
+
name: qed
|
24
|
+
version: 0+
|
25
|
+
suite: rubyworks
|
26
|
+
manifest: Manifest.txt
|
27
|
+
version: 1.7.0
|
28
|
+
copyright: Copyright (c) 2008 Thomas Sawyer
|
29
|
+
description: Assertive Expressive is an assertions library specifically designed for reuse by other test frameworks.
|
30
|
+
authors:
|
31
|
+
- Thomas Sawyer
|
32
|
+
summary: Assertive Expressive
|
33
|
+
created: 2008-08-17
|
data/{LICENSE → Apache2.txt}
RENAMED
@@ -1,5 +1,23 @@
|
|
1
1
|
= RELEASE HISTORY
|
2
2
|
|
3
|
+
== 1.7.0 / 2011-04-28
|
4
|
+
|
5
|
+
AE now uses proper namespace for all classes. In particular, the `Assertor`
|
6
|
+
class has become `AE::Assertor`. Only the `Assertion` class remains outside
|
7
|
+
the `AE` namespace, as it is now used to map to the current exception class
|
8
|
+
for raising assertions as defined by current test framwework. In addition,
|
9
|
+
AE's Kernel extensions, which are used to adapt AE for use with any given
|
10
|
+
test framework have been moved to the AE and AE::Assertor classes as
|
11
|
+
class methods along with AE's assertion count methods.
|
12
|
+
|
13
|
+
Changes:
|
14
|
+
|
15
|
+
* All AE classes use proper namespace.
|
16
|
+
* Framework methods moved to AE::Assertor class.
|
17
|
+
* Assertion count tracking methods moved to AE::Assertor class.
|
18
|
+
* AE::Assertion class simplified to a simple sublcass of Exception.
|
19
|
+
|
20
|
+
|
3
21
|
== 1.6.1 / 2010-11-05
|
4
22
|
|
5
23
|
This release has test passing for Ruby 1.9.2. Ruby 1.9.2 doesn't appear
|
data/NOTICE.rdoc
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
= COPYRIGHT NOTICES
|
2
|
+
|
3
|
+
== AE
|
4
|
+
|
5
|
+
Copyright (c) 2008,2011 Thomas Sawyer
|
6
|
+
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
you may not use this file except in compliance with the License.
|
9
|
+
You may obtain a copy of the License at
|
10
|
+
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
See the License for the specific language governing permissions and
|
17
|
+
limitations under the License.
|
18
|
+
|
19
|
+
|
20
|
+
== BlankSlate
|
21
|
+
|
22
|
+
AE::BasicObject is based on Jim Weirich's BlankSlate class.
|
23
|
+
|
24
|
+
Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org).
|
25
|
+
All rights reserved.
|
26
|
+
|
27
|
+
Permission is granted for use, copying, modification, distribution,
|
28
|
+
and distribution of modified versions of this work as long as the
|
29
|
+
above copyright notice is included.
|
30
|
+
|
data/README.rdoc
CHANGED
@@ -1,16 +1,12 @@
|
|
1
1
|
= Assertive Expressive
|
2
2
|
|
3
|
-
* home: http://rubyworks.github.com/ae/
|
4
|
-
* code: http://github.com/rubyworks/ae/
|
5
|
-
|
6
|
-
|
7
3
|
== DESCRIPTION
|
8
4
|
|
9
5
|
Assertive Expressive (AE) is an assertions framework
|
10
6
|
intended for reuse by any TDD, BDD or similar system.
|
11
7
|
|
12
8
|
|
13
|
-
== FEATURES
|
9
|
+
== FEATURES
|
14
10
|
|
15
11
|
* Clear, simple and concise syntax.
|
16
12
|
* Uses higher-order functions and fluid notation.
|
@@ -21,15 +17,16 @@ intended for reuse by any TDD, BDD or similar system.
|
|
21
17
|
* Eats it's own dog food.
|
22
18
|
|
23
19
|
|
24
|
-
==
|
20
|
+
== RESOURCES
|
25
21
|
|
26
|
-
|
22
|
+
* home: http://rubyworks.github.com/ae/
|
23
|
+
* code: http://github.com/rubyworks/ae/
|
27
24
|
|
28
25
|
|
29
26
|
== SYNOPSIS
|
30
27
|
|
31
28
|
AE defines the method +assert+. It's is compatible with the method
|
32
|
-
as defined by Test::Unit and
|
29
|
+
as defined by Test::Unit and MiniTest, which verifies truth of a
|
33
30
|
single argument (and can accept an optional failure message).
|
34
31
|
|
35
32
|
assert(true)
|
@@ -64,7 +61,32 @@ to make an assertion. Eg.
|
|
64
61
|
|
65
62
|
"Daffy Duck".assert.daffy?
|
66
63
|
|
67
|
-
|
64
|
+
When an assertion fails an Assertion exception is raised. Any test
|
65
|
+
framework can catch this exception and process it accordingly.
|
66
|
+
Technically the framework should check to see that the exception
|
67
|
+
object responds affirmatively to the #assertion? method. This way any
|
68
|
+
type of exception can be used as a means of assertion, not just AE's
|
69
|
+
Assertion class.
|
70
|
+
|
71
|
+
Please have a look at the QED and API documentation to learn more.
|
72
|
+
|
73
|
+
|
74
|
+
== INTEGRATION
|
75
|
+
|
76
|
+
Generally speaking, AE can be used with any test framework simply by putting
|
77
|
+
<code>require 'ae'</code> in a test helper script. However to fully
|
78
|
+
integrate with a test framework and ensure the test framework recognizes
|
79
|
+
AE assertions (as more than just exceptions) and to ensure assertion
|
80
|
+
counts are correct, a little extra interfacing code may be necessary.
|
81
|
+
|
82
|
+
Lucky for you AE has already done the leg work for the most common
|
83
|
+
test frameworks:
|
84
|
+
|
85
|
+
* require 'ae/adapters/testunit'
|
86
|
+
* require 'ae/adapters/minitest'
|
87
|
+
* require 'ae/adapters/rspec'
|
88
|
+
|
89
|
+
Note that Cucumber does not need an adapter.
|
68
90
|
|
69
91
|
|
70
92
|
== HOW TO INSTALL
|
@@ -99,9 +121,14 @@ Windows users use 'ruby setup.rb all'.
|
|
99
121
|
|
100
122
|
== COPYRIGHTS & LICENSE
|
101
123
|
|
124
|
+
(Apache 2.0 License)
|
125
|
+
|
102
126
|
Copyright (c) 2008,2010 Thomas Sawyer
|
103
127
|
|
104
128
|
Unless otherwise provided for by the originating author, this
|
105
|
-
program is distributed under the terms of the Apache 2 license.
|
129
|
+
program is distributed under the terms of the Apache 2.0 license.
|
130
|
+
See the Apache2.txt for details.
|
131
|
+
|
132
|
+
Protions of this program may be copyrighted by others. See the
|
133
|
+
NOTICE.rdoc file for details.
|
106
134
|
|
107
|
-
See LICENSE file for details.
|
data/Syckfile
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
gem:
|
3
|
+
service: Gem
|
4
|
+
active : true
|
5
|
+
|
6
|
+
dnote:
|
7
|
+
service : DNote
|
8
|
+
loadpath : ~
|
9
|
+
labels : ~
|
10
|
+
output : ~
|
11
|
+
format : ~
|
12
|
+
active : true
|
13
|
+
|
14
|
+
stats:
|
15
|
+
service : Stats
|
16
|
+
title : ~
|
17
|
+
loadpath : ~
|
18
|
+
exclude : ~
|
19
|
+
output : ~
|
20
|
+
active : true
|
21
|
+
|
22
|
+
rdoc:
|
23
|
+
service : rdoc
|
24
|
+
format : redfish
|
25
|
+
exclude : [Syckfile, Profile, Manifest.txt]
|
26
|
+
output : site/doc/api
|
27
|
+
|
28
|
+
ridoc:
|
29
|
+
service: RIDoc
|
30
|
+
include: ~
|
31
|
+
exclude: ~
|
32
|
+
output : .ri
|
33
|
+
active : true
|
34
|
+
|
35
|
+
qedoc:
|
36
|
+
service: custom
|
37
|
+
cycle: main
|
38
|
+
document: |
|
39
|
+
puts `qedoc -o site/doc/qed -t "AE Demonstrandum" qed`
|
40
|
+
|
41
|
+
testrb:
|
42
|
+
service : testrb
|
43
|
+
tests : ~
|
44
|
+
exclude : ~
|
45
|
+
loadpath : ~
|
46
|
+
requires : ~
|
47
|
+
live : false
|
48
|
+
active : false
|
49
|
+
|
50
|
+
grancher:
|
51
|
+
service: Grancher
|
52
|
+
active: true
|
53
|
+
#sitemap:
|
54
|
+
# - site
|
55
|
+
# - [doc/rdoc, rdoc]
|
56
|
+
# - [doc/qedoc, qedoc]
|
57
|
+
|
58
|
+
gemcutter:
|
59
|
+
active: true
|
60
|
+
|
61
|
+
email:
|
62
|
+
service : Email
|
63
|
+
file : ~
|
64
|
+
subject : ~
|
65
|
+
mailto : ruby-talk@ruby-lang.org
|
66
|
+
# from : transfire@gmail.com
|
67
|
+
# server : <%= ENV['EMAIL_SERVER'] %>
|
68
|
+
# port : <%= ENV['EMAIL_PORT'] %>
|
69
|
+
# account : <%= ENV['EMAIL_ACCOUNT'] %>
|
70
|
+
# domain : <%= ENV['EMAIL_DOMAIN'] %>
|
71
|
+
# login : <%= ENV['EMAIL_LOGIN'] %>
|
72
|
+
# secure : <%= ENV['EMAIL_SECURE'] %>
|
73
|
+
active : true
|
74
|
+
|
75
|
+
vclog:
|
76
|
+
service : VClog
|
77
|
+
format : html # xml, txt
|
78
|
+
layout : rel # gnu
|
79
|
+
typed : false
|
80
|
+
output : ~
|
81
|
+
active : false
|
82
|
+
|
data/lib/ae.rb
CHANGED
@@ -1,29 +1,32 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2008,2011 Thomas Sawyer
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
2
14
|
|
15
|
+
# AE's namespace.
|
3
16
|
module AE
|
4
|
-
DIRECTORY = File.dirname(__FILE__)
|
5
17
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
18
|
+
# Set Assertion class. This is a convenience method
|
19
|
+
# for framework adapters, used to set the exception class
|
20
|
+
# that a framework uses to raise an assertion error.
|
21
|
+
def self.assertion_error=(exception_class)
|
22
|
+
verbose, $VERBOSE = $VERBOSE, nil
|
23
|
+
Object.const_set(:Assertion, exception_class)
|
24
|
+
$VERBOSE = verbose
|
11
25
|
end
|
12
26
|
|
13
|
-
def self.profile
|
14
|
-
@profile ||= (
|
15
|
-
require 'yaml'
|
16
|
-
YAML.load(File.new(DIRECTORY + '/profile'))
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.const_missing(name)
|
21
|
-
key = name.to_s.downcase
|
22
|
-
package[key] || profile[key] || super(name)
|
23
|
-
end
|
24
27
|
end
|
25
28
|
|
29
|
+
require 'ae/version'
|
26
30
|
require 'ae/assert'
|
27
31
|
require 'ae/expect'
|
28
32
|
|
29
|
-
# Copyright (c) 2008, 2010 Thomas Sawyer
|
data/lib/ae.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
spec_version: 1.0.0
|
3
|
+
name: ae
|
4
|
+
title: AE
|
5
|
+
engine_check:
|
6
|
+
- ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
|
7
|
+
contact: trans <transfire@gmail.com>
|
8
|
+
resources:
|
9
|
+
repo: git://github.com/rubyworks/ae.git
|
10
|
+
code: http://github.com/rubyworks/ae
|
11
|
+
mail: http://groups.google.com/group/rubyworks-mailinglist
|
12
|
+
docs: http://wiki.github.com/rubyworks/ae/docs/qed
|
13
|
+
bugs: http://github.com/rubyworks/ae/issues
|
14
|
+
wiki: http://wiki.github.com/rubyworks/ae
|
15
|
+
home: http://rubyworks.github.com/ae
|
16
|
+
requires:
|
17
|
+
- group:
|
18
|
+
- build
|
19
|
+
name: syckle
|
20
|
+
version: 0+
|
21
|
+
- group:
|
22
|
+
- test
|
23
|
+
name: qed
|
24
|
+
version: 0+
|
25
|
+
suite: rubyworks
|
26
|
+
manifest: Manifest.txt
|
27
|
+
version: 1.7.0
|
28
|
+
copyright: Copyright (c) 2008 Thomas Sawyer
|
29
|
+
description: Assertive Expressive is an assertions library specifically designed for reuse by other test frameworks.
|
30
|
+
authors:
|
31
|
+
- Thomas Sawyer
|
32
|
+
summary: Assertive Expressive
|
33
|
+
created: 2008-08-17
|
data/lib/ae/adapters/minitest.rb
CHANGED
@@ -1,24 +1,17 @@
|
|
1
|
+
require 'ae'
|
2
|
+
|
3
|
+
AE.assertion_error = ::MiniTest::Assertion
|
4
|
+
|
5
|
+
# MiniTest tracks assertion counts internally in it's Unit class via the
|
6
|
+
# +assertion_count+ attribute. To work with AE we need add in AE's assertion
|
7
|
+
# total by overriding the +assertion_count+ method.
|
8
|
+
|
1
9
|
module MiniTest #:nodoc:
|
2
10
|
class Unit #:nodoc:
|
3
|
-
def
|
4
|
-
|
5
|
-
format = "%d tests, %d assertions, %d failures, %d errors, %d skips"
|
6
|
-
io.puts format % [test_count, assertion_count + ae_count, failures, errors, skips]
|
11
|
+
def assertion_count
|
12
|
+
@assertion_count + AE::Assertor.counts[:total]
|
7
13
|
end
|
8
14
|
end
|
9
15
|
end
|
10
16
|
|
11
|
-
require 'ae'
|
12
|
-
|
13
|
-
class Assertion #:nodoc:
|
14
|
-
|
15
|
-
def self.framework_flunk(options)
|
16
|
-
message = options.delete(:message)
|
17
|
-
backtrace = options.delete(:backtrace)
|
18
17
|
|
19
|
-
err = MiniTest::Assertion.new(message)
|
20
|
-
err.set_backtrace(backtrace) if backtrace
|
21
|
-
fail err
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
data/lib/ae/adapters/rspec.rb
CHANGED
@@ -1,14 +1,4 @@
|
|
1
1
|
require 'ae'
|
2
2
|
|
3
|
-
|
3
|
+
AE.assertion_error = ::RSpec::Expectations::ExpectationNotMetError
|
4
4
|
|
5
|
-
def self.framework_flunk(options)
|
6
|
-
message = options.delete(:message)
|
7
|
-
backtrace = options.delete(:backtrace)
|
8
|
-
|
9
|
-
err = Spec::Expectations::ExpectationNotMetError.new(message)
|
10
|
-
err.set_backtrace(options[:backtrace]) if options[:backtrace]
|
11
|
-
fail err
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
data/lib/ae/adapters/testunit.rb
CHANGED
@@ -1,33 +1,34 @@
|
|
1
|
+
require 'ae'
|
2
|
+
|
3
|
+
AE.assertion_error = ::Test::Unit::AssertionFailedError
|
4
|
+
|
5
|
+
# TestUnit uses #add_assertion on it's +result+ object to track counts.
|
6
|
+
# We capture the result object by overriding the TestCase#run method,
|
7
|
+
# store it in a global variable and then use it when AE increments
|
8
|
+
# assertion counts.
|
9
|
+
|
1
10
|
module Test #:nodoc:
|
2
11
|
module Unit #:nodoc:
|
3
12
|
class TestCase #:nodoc:
|
4
13
|
alias_method :_run, :run
|
5
14
|
def run(result, &block)
|
6
|
-
$
|
15
|
+
$_test_unit_result = result
|
7
16
|
_run(result, &block)
|
8
17
|
end
|
9
18
|
end
|
10
19
|
end
|
11
20
|
end
|
12
21
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
def self.framework_flunk(options)
|
25
|
-
message = options.delete(:message)
|
26
|
-
backtrace = options.delete(:backtrace)
|
27
|
-
|
28
|
-
err = Test::Unit::AssertionFailedError.new(message)
|
29
|
-
err.set_backtrace(backtrace) if backtrace
|
30
|
-
fail err
|
22
|
+
class AE::Assertor #:nodoc:
|
23
|
+
def self.increment_counts(pass)
|
24
|
+
$_test_unit_result.add_assertion if $_test_unit_result
|
25
|
+
counts[:total] += 1
|
26
|
+
if pass
|
27
|
+
counts[:pass] += 1
|
28
|
+
else
|
29
|
+
counts[:fail] += 1
|
30
|
+
end
|
31
|
+
return counts
|
31
32
|
end
|
32
|
-
|
33
33
|
end
|
34
|
+
|