Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assertions-eb

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assertions-eb

  • 1.7.3
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

= assertions

  • Project Page: http://rubyforge.org/projects/assertions/

== DESCRIPTION: This package adds some additional assertions to Test::Unit::Assertions, including:

  • Assertions for all of the comparison operators (Test::Unit::Assertions#assert_greater_than, Test::Unit::Assertions#assert_less_than_or_equal_to, etc.). Shorter aliases also are provided for these (Test::Unit::Assertions#assert_gt, Test::Unit::Assertions#assert_le, etc.).
  • An assertion that verifies that a given block raises a specified exception with a specified message (Test::Unit::Assertions#assert_raise_message). This allows full testing of error messages.
  • An assertion that verifies that a given block contains an assertion that fails (Test::Unit::Assertions#assert_fail), which can be used to test new assertions.
  • An assertion that verifies that a given value is false or nil (Test::Unit::Assertions#assert_not)
  • Assertions that verify enumerables are sorted (Test::Unit::Assertions#assert_sorted, Test::Unit::Assertions#assert_sorted_desc, Test::Unit::Assertions#assert_sorted_by, Test::Unit::Assertions#assert_sorted_by_desc)
  • An assertion that verifies x1 < y < x2 (Test::Unit::Assertion#assert_between)

== PROBLEMS: None (known).

== SYNOPSIS: ======examples/example.rb: #!/usr/bin/env ruby require 'rubygems' require 'assertions'

require 'test/unit'

class Tests < Test::Unit::TestCase def test_assertions # # Verify that 4 > 5 is false. # assert_not(4 > 5)

 #
 # Verify that 4 < 5
 #
 assert_less_than(4, 5)

 #
 # Verify that 4 < 5 again, but this time with the
 # shorter alias.
 #
 assert_lt(4, 5)

 #
 # Verify that 5 >= 5
 #
 assert_ge(5, 5)

 #
 # Verify that the specified exception is raised.
 #
 assert_raise_message("Hello, exception!", RuntimeError) do
   raise "Hello, exception!"
 end

 #
 # Verify that an assertion failed.
 #
 assert_fail do
   assert_equal(5, 4)
 end

 #
 # Verify an enumerable is sorted
 #
 assert_sorted([1,2,3])

 #
 # Verify an enumerable is sorted descending
 #
 assert_sorted_desc([3,2,1])

 #
 # Verify an enumerable is sorted based on a key
 #
 assert_sorted_by(:key, [{:key => 1}, {:key => 2}])

 #
 # Verify an enumerable is sorted descending based on a key
 #
 assert_sorted_by(:key, [{:key => 2}, {:key => 1}])

#
# Verify a thing is between two other things
#
assert_between(1, 3, 2)

end end

== INSTALL: gem install assertions

== AUTHORS: === Designing Patterns

== Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Run the tests until they all pass (rake test)
  4. Commit your changes (git commit -am 'Added some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

== Meta

Originally Created by Designing Patterns

Maintained by Expected Behavior

Released under the MIT license. http://github.com/expected-behavior/assertions

== SHARE AND ENJOY!

FAQs

Package last updated on 20 Feb 2012

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc