Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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.
Ruby

This branch is 45 commits ahead, 35 commits behind moonmaster9000:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
rails_generators/dupe
spec
.gitignore
CHANGELOG
Gemfile
Gemfile.lock
README.markdown
Rakefile
VERSION

README.markdown

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 , 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'}

Something went wrong with that request. Please try again.