Forum: RSpec Cucumber + Authorize.net CIM

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
93e2bc09ec293552d9a243019512f680?d=identicon&s=25 David Nawara (dave_nawara)
on 2009-05-18 19:48
Hi all,

I'm curious how one would recommend testing authorize.net customer
information manager storage with cucumber stories.

In my checkout process testing, my code sends user profile/card/address
information to the authorize.net test servers, which then stores the
sensitive data for me.  Obviously, transactions do not remove this data,
as it's not in my database.  My models are set to destroy the data with
callbacks, but since destroys aren't called on my models these callbacks
are never triggered.  Therefor, subsequent tests fail since I have
artifacts left on the Authorize.net CIM.

I'm reluctant to remove use_transactional_fixtures, but I don't really
see any other options or hooks to use to fix my situation, short of
using a Before hook that manually destroys all models in my test db.

Any help greatly appreciated!

Regards,
Dave Nawara
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-05-18 20:25
(Received via mailing list)
> Hi all,
>
> I'm curious how one would recommend testing authorize.net customer
> information manager storage with cucumber stories.
>
> In my checkout process testing, my code sends user profile/card/address
> information to the authorize.net test servers, which then stores the

Introduce an abstraction layer for that site with an API you define.
You'll have one implementation of that API that just sends requests to
authorize.net. You'll use this in production.

Implement the same API in a different class, but instead of sending
requests to authorize.net, just hard code some users and roles. Use
this implementation when you run Cucumber.

Aslak
93e2bc09ec293552d9a243019512f680?d=identicon&s=25 David Nawara (dave_nawara)
on 2009-05-18 23:02
Aslak Hellesøy wrote:
> Introduce an abstraction layer for that site with an API you define.
>
> Aslak

Thanks Aslak.  I'll give this method a shot.
This topic is locked and can not be replied to.