Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15 tester la creation dutilisateurs #9

Merged
merged 13 commits into from
Nov 26, 2019

Conversation

sherpanat
Copy link
Owner

A ajouter : les modifications suite aux merges de 12, 13 et 14 dans master.

@@ -0,0 +1,51 @@
require 'rails_helper'
require 'dry/transaction'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Met ce genre de require dans un initializer, que ça s'exécute une fois au lancement de l'app quelque soit l'environnement.

Copy link
Owner Author

Choose a reason for hiding this comment

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

J'ai require 'rails_helper' directement dans .rspec du coup. Ça résout le problème de l'import dans chaque fichier de test mais j'ai trouvé que ce n'était pas foufou pour les perfs de l'app quand tu as des services externes hors rails (everydayrails/rails-4-1-rspec-3-0#36) mais ce n'est pas notre cas ici donc je ne pense pas que ça dérange.

spec/transactions/users/create_transaction_spec.rb Outdated Show resolved Hide resolved
spec/factories/user.rb Show resolved Hide resolved
spec/transactions/users/create_transaction_spec.rb Outdated Show resolved Hide resolved
config/environments/production.rb Outdated Show resolved Hide resolved
it "should send an email to user email" do
expect { ::Users::CreateTransaction.call(valid_user_attributes) }
.to change { ActionMailer::Base.deliveries.count }.by(1)
expect(ActionMailer::Base.deliveries.last.subject).to include('Welcome')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Tester qu'un mail est envoyé c'est bien. Tu pourrais aussi tester que la bonne méthode du mailer est appelé.

Tester le contenu du sujet du mail ça sort de la responsabilité de la transaction.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Done

spec/transactions/users/create_transaction_spec.rb Outdated Show resolved Hide resolved
@sherpanat sherpanat merged commit 5970803 into master Nov 26, 2019
@sherpanat sherpanat deleted the 15-tester-la-creation-dutilisateurs branch November 26, 2019 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants