Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A small test framework that supports debugging test failures & errors when they happen

License

NotificationsYou must be signed in to change notification settings

hopsoft/pry-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lines of CodeMaintainabilityBuild StatusCoverage StatusDownloads

Formerly known asMicroTest.

PryTest

aka pry-test

A small test framework that supports debugging test failures & errors when they happen.

Values

  • Simplicity - writing tests should be easy & devoid of friction
  • Intelligibility - tests should be readable & unambiguous
  • Immediacy - test failures should be dealt with quickly when they occur

Benefits

  • A simple test API
  • An awesomefailprypass workflow
  • Optional async test runs

An important note on debugging test failures with Pry.

The API

Everything you need to know about PryTest's API is outlined here.

PryTest::TestSuperclass for all test classes.
test(desc, &block) Defines a test method.
  • desc - a description of what is being tested
  • &block - a block of code which defines the test
assert(value) Verifies the truthiness of a value.
  • value - the value to assert
refute(value) Verifies the falsiness of a value.
  • value - the value to refute
before(&block) A callback that runs before each test method.
  • &block - the block of code to execute
after(&block) A callback that runs after each test method.
  • &block - the block of code to execute

A Complete Example

The entire public interface is used in this basic example.

classMathTest <PryTest::Testbeforedo# runs before each test methodendafterdo# runs after each test methodendtest"basic addition"doassert2 +2 ==4endtest"all is right in the world"dorefute0 >1endend

Get Started

PryTest ships with a demo so you can try it out easily.

gem install pry-testpry-test --helppry-test --demo

Try some advanced features.

pry-test --demo --asyncpry-test --demo --disable-pry

Testing Your Own Projects

PryTest assumes your test directory is located atPROJECT_ROOT/test;however, this isn't a requirement. You can indicate your test directory location.

pry-test /path/to/test/dir

If you have multiple versions of PryTest installed,it's safest to run your tests withbundle exec.

bundleexec pry-test /path/to/test/dir

PryTest is small & unobtrusive.It plays nice with other test frameworks, & can be introduced to existing projects incrementally.

Advanced

See the wikito troubleshoot or get help with more advanced topics.

About

A small test framework that supports debugging test failures & errors when they happen

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp