Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[SPECS]Stripe connect controller specs#380

Merged
apoorv-mishra merged 4 commits intodevelopfrom
stripe-connect-controller-specs
May 16, 2022
Merged

[SPECS]Stripe connect controller specs#380
apoorv-mishra merged 4 commits intodevelopfrom
stripe-connect-controller-specs

Conversation

@apoorv-mishra
Copy link
Contributor

Notion card

NA

Summary

Controller specs for PR-#363

Preview

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist:

  • I have manually tested all workflows
  • I have performed a self-review of my own code
  • I have added automated tests for my code

@github-actions
Copy link

Current Code Coverage Percent of this PR:

94.61 %

Files having coverage below 100%

Impacted Files Coverage
/app/controllers/subscriptions_controller.rb 66.67 %
/app/controllers/invoices_controller.rb 63.64 %
/app/models/client.rb 92.68 %
/app/models/invoice.rb 96.3 %
/app/policies/subscriptions_policy.rb 66.67 %
/app/policies/timezone_policy.rb 66.67 %
/app/controllers/invoices/payments_controller.rb 61.11 %
/app/services/invoice_payment/pdf_generation.rb 65.38 %
/app/services/invoice_payment/checkout.rb 43.48 %
/app/controllers/internal_api/v1/timezones_controller.rb 37.5 %
/lib/countries_info.rb 0.0 %

Copy link
Contributor

@rohitjoshixyz rohitjoshixyz left a comment

Choose a reason for hiding this comment

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

One spec needs changes

Comment on lines 18 to 26
it "is authorized to refresh stripe connect" do
allow(Stripe::AccountLink).to receive(:create)
.and_return(OpenStruct.new({ url: "https://connect.stripe.com/setup/s/something" }))
allow(Stripe::Account).to receive(:retrieve)
.and_return(OpenStruct.new({ details_submitted: false }))
send_request :get, payments_settings_stripe_connect_refresh_path
expect(response).to have_http_status(:redirect)
expect(response).not_to redirect_to("https://connect.stripe.com/setup/s/something")
expect(flash["alert"]).to eq("You are not authorized to perform this action.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Check description and assertion, it is not matching

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

.and_return(OpenStruct.new({ url: "https://connect.stripe.com/setup/s/something" }))
allow(Stripe::Account).to receive(:retrieve)
.and_return(OpenStruct.new({ details_submitted: false }))
stripe_connected_account.save
Copy link
Contributor

Choose a reason for hiding this comment

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

Use bang(!) method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

end

context "when stripe connected account doesn't exist" do
it "is authorized to refresh stripe connect" do
Copy link
Contributor

Choose a reason for hiding this comment

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

Check spec description, does not refresh stripe connect account or something similar, it should match the assertion, also if the user is an admin why are they unauthorized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the description needs to be fixed. Refresh doesn't make sense if the account was not created in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed to make it return 404 now.

Copy link
Contributor

@rohitjoshixyz rohitjoshixyz left a comment

Choose a reason for hiding this comment

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

LGTM

@apoorv-mishra apoorv-mishra merged commit 2fc6b30 into develop May 16, 2022
@apoorv-mishra apoorv-mishra deleted the stripe-connect-controller-specs branch May 16, 2022 12:43
vipulnsward pushed a commit that referenced this pull request Feb 15, 2026
* Add request specs for internal PaymentSettings#index

* Add request specs for internal PaymentSettings#connect_stripe

* Add request specs for PaymentSettings#refresh_stripe_connect

* Fix specs and address review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants