require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Cardflex::Plan do it 'should create plan' do # have to give a plan id unique to the test account. Since this account is shared by all testers of the api, # it's possible that this will conflict. so we'll accept a conflicting plan-id as a success. plan_id = ('a'..'z').to_a.shuffle.take(10).join req = { :plan => { :payments => 0, :amount => 1.5, :name => 'test_plan', :plan_id => plan_id, :day_frequency => 30 } } res = Cardflex::Plan.create(req) if defined? res.result_code expect(res.result_code.to_i).to eq 300 else expect(res.plan.plan[:plan_id]).to eq plan_id end end end