Skip to content

Commit 585a326

Browse files
committed
Add has_more attribute to all ListObject instances
This method is called in Stripe when using the `auto_paging_each` ListObject method. Without this being in the mock data this method doesn't work. Steps to reproduce: $ rails console test irb> StripeMock.start irb> Stripe.api_key = 'sk_test_...' irb> h = StripeMock.create_test_helper irb> customer = Stripe::Customer.create(source: h.generate_card_token) irb> customer.subscriptions.auto_paging_each.map(&:id)
1 parent 4ae881b commit 585a326

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/stripe_mock/data.rb

+4
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,14 @@ def self.mock_customer(sources, params)
142142
sources: {
143143
object: "list",
144144
total_count: sources.size,
145+
has_more: false,
145146
url: "/v1/customers/#{cus_id}/sources",
146147
data: sources
147148
},
148149
subscriptions: {
149150
object: "list",
150151
total_count: 0,
152+
has_more: false,
151153
url: "/v1/customers/#{cus_id}/subscriptions",
152154
data: []
153155
},
@@ -371,6 +373,7 @@ def self.mock_invoice(lines, params={})
371373
lines: {
372374
object: "list",
373375
total_count: lines.count,
376+
has_more: false,
374377
url: "/v1/invoices/#{in_id}/lines",
375378
data: lines
376379
},
@@ -601,6 +604,7 @@ def self.mock_recipient(cards, params={})
601604
object: "list",
602605
url: "/v1/recipients/#{rp_id}/cards",
603606
data: cards,
607+
has_more: false,
604608
total_count: cards.count
605609
},
606610
default_card: nil

0 commit comments

Comments
 (0)