Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions spec/lago/api/resources/payment_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@
end
end

context 'when currency is given' do
before do
stub_request(:get, 'https://api.getlago.com/api/v1/payment_requests?currency=EUR')
.to_return(body: payment_requests_response, status: 200)
end

it 'forwards the currency option as a query param' do
resource.get_all({ currency: 'EUR' })

expect(WebMock).to have_requested(:get, 'https://api.getlago.com/api/v1/payment_requests')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have to mock webmock since we're already stubbing. 🤔

.with(query: { currency: 'EUR' })
end
end
Comment on lines +99 to +111

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it returns the same results as the when there is no options context, I don't really see the added value of this example 🤔


context 'when there is an issue' do
before do
stub_request(:get, 'https://api.getlago.com/api/v1/payment_requests')
Expand Down
14 changes: 14 additions & 0 deletions spec/lago/api/resources/subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,20 @@
end
end

context 'when currency is given' do
before do
stub_request(:get, 'https://api.getlago.com/api/v1/subscriptions?currency=EUR')
.to_return(body: response, status: 200)
end

it 'forwards the currency option as a query param' do
resource.get_all({ currency: 'EUR' })

expect(WebMock).to have_requested(:get, 'https://api.getlago.com/api/v1/subscriptions')
.with(query: { currency: 'EUR' })
end
end

context 'when status is given' do
before do
stub_request(:get, 'https://api.getlago.com/api/v1/subscriptions?external_customer_id=123&status%5B%5D=pending')
Expand Down
14 changes: 14 additions & 0 deletions spec/lago/api/resources/wallet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,20 @@
end
end

context 'when currency is given' do
before do
stub_request(:get, 'https://api.getlago.com/api/v1/wallets?currency=EUR')
.to_return(body: response, status: 200)
end

it 'forwards the currency option as a query param' do
resource.get_all({ currency: 'EUR' })

expect(WebMock).to have_requested(:get, 'https://api.getlago.com/api/v1/wallets')
.with(query: { currency: 'EUR' })
end
end

context 'when there is an issue' do
before do
stub_request(:get, 'https://api.getlago.com/api/v1/wallets')
Expand Down
Loading