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

properb

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

properb

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Properb

Property-based testing in Ruby, with RSpec integration.

Installation

This project

Usage

To install, add the following to your spec/spec_helper.rb file:

RSpec.configure do |config|
  Properb.rspec_install(config)
end

Then you can use generate and it_always in your tests to create property-based tests:

describe "#sort" do
  generate(strings: array(string))

  it_always "preserves the number of elements", num_tests: 200 do
    expect(strings.sort.length).to be == strings.length
  end

  it_always "has the first and last elements in sorted order" do
    assume(strings).to_not be_empty
    sorted = strings.sort
    expect(sorted[0]).to be <= sorted[-1]
  end

  it_always "creates pairwise sorted elements", num_tests: 200 do
    # assume(strings.length).to be >= 2
    assume(strings.uniq).to eq(strings)
    sorted = strings.sort
    (0...sorted.length - 1).each do |i|
      expect(sorted[i]).to be < sorted[i + 1]
    end
  end
end

Development

This project uses Guix as its main dependency management system. A development environment can be created by running:

guix shell --development --file=guix.scm

Contributing

Bug reports and changes are welcome on SourceHut at https://sr.ht/~czan/properb/.

FAQs

Package last updated on 12 Nov 2023

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