VRFS-2480: Recurly specs to verify placing an order.
This commit is contained in:
parent
41096f08ad
commit
2e5b3add3c
|
|
@ -5,11 +5,12 @@ describe RecurlyClient do
|
|||
#let(:client) { RecurlyClient.new }
|
||||
|
||||
before :all do
|
||||
@client = RecurlyClient.new
|
||||
@user = FactoryGirl.create(:user)
|
||||
@client = RecurlyClient.new
|
||||
@jamtrack = FactoryGirl.create(:jam_track)
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
@user = FactoryGirl.create(:user)
|
||||
@billing_info = {}
|
||||
@billing_info[:first_name] = @user.first_name
|
||||
@billing_info[:last_name] = @user.last_name
|
||||
|
|
@ -85,5 +86,22 @@ describe RecurlyClient do
|
|||
found.should_not be_nil
|
||||
found.state.should eq('closed')
|
||||
end
|
||||
|
||||
it "can place order" do
|
||||
@client.find_or_create_account(@user, @billing_info)
|
||||
expect{@client.place_order(@user, @jamtrack)}.not_to raise_error()
|
||||
subs = @client.get_account(@user).subscriptions
|
||||
subs.should_not be_nil
|
||||
subs.should have(1).items
|
||||
@user.jam_track_rights.should_not be_nil
|
||||
@user.jam_track_rights.should have(1).items
|
||||
@user.jam_track_rights.last.jam_track.id.should eq(@jamtrack.id)
|
||||
end
|
||||
|
||||
it "detects error on double order" do
|
||||
@client.find_or_create_account(@user, @billing_info)
|
||||
expect{@client.place_order(@user, @jamtrack)}.not_to raise_error()
|
||||
expect{@client.place_order(@user, @jamtrack)}.to raise_error(RecurlyClientError)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue