Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Dupe rides on top of ActiveResource to allow you to cuke the client side of a service-oriented app without having to worry about whether or not the service is live or available while cuking.

brandleadership/superdupe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SuperDupe

SuperDupe provides two things:

  • Mock ActiveResource objects like the originally gem dupe
  • Superdupe send no requests to external services registerd by the ARes. It has an extra parameter to send explicitly extrnal requests.

SuperDupe is a fork of the originally gem dupe 0.5.1 (Matt Parker). At first, the gem try to use only the available mocked resources. If you have the requirement to send external requests without mocking, take an extra parameter for this situation.

Install the gem

gem install superdupe

Usage

Implemented ActiveResource class class Customer < ActiveResource::Base self.site = '' end

Register a mock response Dupe.create <class_name>, Dupe.create Customer, :name => 'test customer'

Find a registered object Customer.find 1

Find all registered objects Customer.find :all

Find registered url patterns Dupe.network.mocks[] Dupe.network.mocks[:get]

Reset registered url patterns Dupe.reset

Register a custom mock with a param-filter Get %r{/customers.xml?state=(active|inactive)} do |state| if state == 'active' Dupe.find(:"Customers") {|c| c.state == 'active'} else Dupe.find(:"Customers") {|c| c.state == 'inactive'} end end # Register a custom mock with the entered url pattern

Find the custom registered object Customer.find :all, :params => {:state => 'active'}

About

Dupe rides on top of ActiveResource to allow you to cuke the client side of a service-oriented app without having to worry about whether or not the service is live or available while cuking.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%