Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
Created August 28, 2017 19:42
Show Gist options
  • Select an option

  • Save staycreativedesign/3def23d5071404f616f12bedee5dfac3 to your computer and use it in GitHub Desktop.

Select an option

Save staycreativedesign/3def23d5071404f616f12bedee5dfac3 to your computer and use it in GitHub Desktop.
Failures:
1) Admin::InvoicesController POST create it creates a new invoice
Failure/Error: "application_fee": null,
ArgumentError:
wrong number of arguments (given 0, expected 1+)
RSpec.describe Admin::InvoicesController do
describe "POST create" do
it "it creates a new invoice" do
create_business_categories_and_industries(3)
@user = create(:user, business_industry_id: 2)
create_stripe_customer(@user)
post :create, params: invoice_params(@user)
expect(Invoice.count).to eq 1
end
end
end
def invoice_params(user)
{
"id": "evt_1Avs4VLHOWFuqTsqmZOdk3Yp",
"object": "event",
"api_version": "2017-08-15",
"created": 1503945291,
"data": {
"object": {
"id": "in_1Avs4ULHOWFuqTsqVYInDoA3",
"object": "invoice",
"amount_due": 0,
"application_fee": null,
"attempt_count": 0,
"attempted": true,
"charge": null,
"closed": true,
"currency": "usd",
"customer": user.account_id,
"date": 1503945290,
"description": null,
"discount": null,
"ending_balance": 0,
"forgiven": false,
"lines": {
"object": "list",
"data": [
{
"id": "sub_BIT0nn7EnC8dul",
"object": "line_item",
"amount": 0,
"currency": "usd",
"description": null,
"discountable": true,
"livemode": false,
"metadata": {
},
"period": {
"start": 1503945290,
"end": 1506537290
},
"plan": {
"id": "BOLDNET30",
"object": "plan",
"amount": 4900,
"created": 1501458935,
"currency": "usd",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {
},
"name": "Bold Networking Monthly",
"statement_descriptor": "Team Coach",
"trial_period_days": 30
},
"proration": false,
"quantity": 1,
"subscription": null,
"subscription_item": "si_1Avs4ULHOWFuqTsqatX9bDd6",
"type": "subscription"
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/invoices/in_1Avs4ULHOWFuqTsqVYInDoA3/lines"
},
"livemode": false,
"metadata": {
},
"next_payment_attempt": null,
"paid": true,
"period_end": 1503945290,
"period_start": 1503945290,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"subscription": "sub_BIT0nn7EnC8dul",
"subtotal": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"webhooks_delivered_at": null
}
},
"livemode": false,
"pending_webhooks": 1,
"request": {
"id": "req_2jxrugcD7ZaTH5",
"idempotency_key": null
},
"type": "invoice.created"
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment