Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Homepage / Source Code / Documentation / User Manual / Report Issue / Mailing List / IRC Channel
Assertive Expressive (AE) is an assertions framework intended for reuse by any TDD, BDD or similar system.
AE defines the method assert
. It's is compatible with the method
as defined by Test::Unit and MiniTest, which verifies truth of a
single argument (and can accept an optional failure message).
assert(true)
In addition AE's assert
method has been extended to accept a block,
the result of which is likewise verified.
assert{true}
But the real power the AE's +assert+ method lies in it's use
without argument or block. In that case it returns an instance of
Assertor
. An Assertor
is an Assertions Functor, or
Higher-Order Function. It is a function that operates on
another function. With it, we can make assertions like so:
x.assert == y
a.assert.include? e
StandardError.assert.raised? do
...
end
And so forth. Any method can be used in conjunction with +assert+ to make an assertion. Eg.
class String
def daffy?
/daffy/i =~ self
end
end
"Daffy Duck".assert.daffy?
When an assertion fails an Assertion exception is raised. Any test framework can catch this exception and process it accordingly. Technically the framework should check to see that the exception object responds affirmatively to the #assertion? method. This way any type of exception can be used as a means of assertion, not just AE's Assertion class.
Please have a look at the QED and API documentation to learn more.
Generally speaking, AE can be used with any test framework simply by putting
require 'ae'
in a test helper script. However to fully
integrate with a test framework and ensure the test framework recognizes
AE assertions (as more than just exceptions) and to ensure assertion
counts are correct, a little extra interfacing code may be necessary.
Lucky for you AE has already done the leg work for the most common test frameworks:
require 'ae/adapters/testunit'
require 'ae/adapters/minitest'
require 'ae/adapters/rspec'
(Note that Cucumber does not need an adapter.)
AE also includes a script that will automatically detect the current test framework by checking for the existence of their respective namespace modules.
require 'ae/adapter'
With AE, defining assertions centers around the #assert method. So assert can be thought of as AE's primary nomenclature. However, variant nomenclatures have been popularized by other test frameworks, in particular should and must. If you prefer one of them terms, AE provides optional libraries that can loaded for utilizing them.
require 'ae/should'
require 'ae/must'
By loading one of these scripts (or both) into your test system (e.g. via a test helper script) you gain access to subjunctive terminology. See the API documentation for the Subjunctive module for details.
To ease transition from TestUnit style assertion methods, AE provides a TestUnit legacy module.
require 'ae/legacy'
This provides a module AE::Legacy::Assertions
which is included in AE::World
and can be mixed into your test environment to provide old-school assertion
methods, e.g.
assert_equal(foo, bar, "it failed")
Install AE in the usual fashion:
$ gem install ae
Local installation requires Setup.rb.
$ gem install setup
Then download the tarball package from GitHub and do:
$ tar -xvzf ae-1.0.0.tgz
$ cd ae-1.0.0.tgz
$ sudo setup.rb all
Windows users use 'ruby setup.rb all'.
Copyright (c) 2008 Rubyworks. All rights reserved.
Unless otherwise provided for by the originating author, this program is distributed under the terms of the BSD-2-Clause license. Portions of this program may be copyrighted by others.
See the NOTICE.rdoc file for details.
AE is a Rubyworks project.
FAQs
Unknown package
We found that ae demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.