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

replicant

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replicant

  • 0.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Replicant is a Rack-based http-endpoint Gem I use in tests along with automation frameworks such as Watir, Selenium, or any framework which does not rely on Net:HTTP, and therefore cannot be mock'd using normal methods. It acts as a real http endpoint that can assert specific requests occurred with the expected post data. It's not close to being "done", but go ahead and take a look anyway.

Sample Usage:

require 'replicant'

before do @mock_website = Replicant.new @mock_website.response( :login_page, "/login", %q{

} )

@mock_website.response( :session_page, "/session", "" )

@mock_website.start end

after do @mock_website.stop end

context "when logging in" do before do # Your code which runs Watir/Selenium/or anything else that doesn't use Net::HTTP here end

it "accesses the login page" do @mock_website.should receive_request_for( :login_page ) end

it "posts to the session page" do @mock_website.should receive_post_for( :session_page ).with_data( "user" => "sample_user", "password" => "password" ) end end

FAQs

Package last updated on 03 Oct 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

  • 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