Socket
Book a DemoInstallSign in
Socket

rspec-process-mocks

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rspec-process-mocks

0.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

WARNING: This is just a big hack right now. If you are interested in using this project but I haven't removed this warning yet, please bug me to lessen the hackiness and make it more usable.

RSpec Process Mocks

rspec-process-mocks is an addon to rspec-mocks that provides support for method stubs, fakes, and message expectations within child processes.

Documentation

Setup

Gemfile

gem 'rspec-process-mocks', :git => 'git://github.com/thoughtless/rspec-process-mocks.git'

bundle install

spec/spec_helper.rb

require 'rspec/process_mocks' # This line must be after 'config.mock_with :rspec'

Message Expectations

describe "some action" do
  context "when bad stuff happens" do
    it "logs the error" do
      logger = double('logger')
      doer = Doer.new(logger)
      logger.should_receive_in_child_process(:log)
      doer.do_something_with(:bad_data)
      sleep 0.1 # Leave time for the child process to run.
    end
  end
end

class Doer
  attr_accessor :logger
  def do_something_with(data)
    Process.fork { logger.log(data) }
  end
end

Contribute

See http://github.com/thoughtless/rspec-process-mocks

Also see

FAQs

Package last updated on 08 Jun 2011

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.