Socket
Book a DemoInstallSign in
Socket

loupe

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loupe

0.1.5
bundlerRubygems
Version published
Maintainers
1
Created
Source
loupe

Loupe

Loupe is a test framework with built in parallel execution supporting Ractor or forked process modes.

Installation

Add the gem to the Gemfile.

gem "loupe"

And then execute:

bundle install

Install bundler binstubs in your application.

bundle binstub loupe

Usage

Currently, Loupe only supports writing tests using the test methods syntax. Tests must inherit from Loupe::Test, but do not need to explicitly require test_helper, like the example below.

# frozen_string_literal: true

class MyTest < Loupe::Test
  def before
    @author = Author.create(name: "John")
    @post = Post.create(author: @author)
  end

  def after
    @author.destroy
    @post.destroy
  end

  def test_post_is_linked_to_author
    expect(@post.author.name).to_be_equal_to("John")
  end
end

To run the test suite, invoke the executable using the binstub generated by bundler.

bin/loupe test/post_test.rb test/author_test.rb

Tests can run in parallel using Ractor or process mode. When using Ractors, the application's code must be Ractor compatible.

bin/loupe --ractor            # [default] run tests using Ractor workers
bin/loupe --process           # run tests using forked processes
bin/loupe --interactive       # [default] use an interactive reporter to display test results
bin/loupe --plain             # use a plain reporter to display test results
bin/loupe --color, --no-color # enable/disable output colors
bin/loupe --editor=EDITOR     # which editor to use for opening files when using interactive mode. The default is the environment variable $EDITOR

To hook Loupe into Rake, use the provided rake task as in the example below.

# Rakefile

require "loupe/rake_task"

# Instantiate the task and append any desired CLI options
Loupe::RakeTask.new do |options|
  options << "--plain"
end

# Optionally, set the default task to be test
task default: :test

Then run

bundle exec rake test

Credits

This project draws a lot of inspiration from other Ruby test frameworks, namely

  • Minitest
  • rspec

Contributing

Please refer to the guidelines in contributing.

FAQs

Package last updated on 17 Sep 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.