Fix::Expect
Provides the
expect
syntax.
Contact
- Home page: https://github.com/fixrb/fix-expect
- Bugs/issues: https://github.com/fixrb/fix-expect/issues
- Support: https://stackoverflow.com/questions/tagged/fixrb
Rubies
Installation
Add this line to your application's Gemfile:
gem 'fix-expect'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fix-expect
Usage
Fix::Expect lets you express expected outcomes on an object:
expect(value.abs).to equal 42 # => MUST equal 42
Both expect
and expect_block
methods are mapped to Spectus's absolute requirement/prohibition to express expectations:
Fix.describe 6 * 7 do
it { expect_block { subject.class }.to equal Fixnum }
it { expect(subject.class).to equal Fixnum }
end
# ..
#
# Ran 2 tests in 0.000327 seconds
# 100% compliant - 0 infos, 0 failures, 0 errors
Using those methods, the default inherited subject can be overridden by the given expected object/block:
Fix.describe -6 * 7 do
on :abs do
# test against the described front object:
it { MUST_NOT equal 1 }
# another test against -1 object:
it { expect(-1).to equal 1 }
end
end
# ..
#
# Ran 2 tests in 0.000372 seconds
# 100% compliant - 0 infos, 0 failures, 0 errors
However, the tree of challenges remains the same.
For convenience, the is_expected
method is also provided:
Fix.describe -6 * 7 do
on :abs do
# test against the described front object:
it { is_expected.to equal 42 }
end
end
# .
#
# Ran 1 tests in 0.000176 seconds
# 100% compliant - 0 infos, 0 failures, 0 errors
Security
As a basic form of security Fix::Expect provides a set of SHA512 checksums for
every Gem release. These checksums can be found in the checksum/
directory.
Although these checksums do not prevent malicious users from tampering with a
built Gem they can be used for basic integrity verification purposes.
The checksum of a file can be checked using the sha512sum
expect. For
example:
$ sha512sum pkg/fix-expect-0.1.0.gem
26198b7812a5ac118a5f2a1b63927871b3378efb071b37abb7e1ba87c1aac9f3a6b45eeae87d9dc647b194c15171b13f15e46503a9a1440b1233faf924381ff5 pkg/fix-expect-0.1.0.gem
Versioning
Fix::Expect follows Semantic Versioning 2.0.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
License
See LICENSE.md
file.
This project is sponsored by: