homework 1 - #5
Conversation
lucashour
left a comment
There was a problem hiding this comment.
Listo el review, no es necesario modificar.
| # implementar los tests para el modelo Post. | ||
| describe 'Factory' do | ||
| it 'has a valid factory' do | ||
| expect(build(:post)).to be_valid |
There was a problem hiding this comment.
Pese a que el test pasa y está bien, podemos usar un build_stubbed para no persistir al Post en la base de datos (para mejorar la performance). El build es mejor en este sentido que el create y lo veo muy bien, pero aún así persiste aquellas asociaciones que tenga definido el factory. Es sólo un detalle, pero está bueno conocerlo.
expect(build_stubbed(:post)).to be_valid|
|
||
| describe 'Associations' do | ||
| # Testear asociaciones (shoulda-matchers). | ||
| it { should have_many(:posts) } |
There was a problem hiding this comment.
Podemos agregar el test del dependent: :destroy.
describe 'Associations' do
it { should have_many(:posts).dependent(:destroy) }
end| subject { create(:user) } | ||
| context 'when given value is different from password' do | ||
| it 'returns false' do | ||
| expect(subject.valid_password?(SecureRandom.uuid)).to be_falsey |
There was a problem hiding this comment.
Está bien, pero sabiendo que el resultado sería directamente false, podríamos usar be false en lugar de be_falsey. Además, el test dice que retorna false.
| subject.call | ||
| expect(subject.error).to be(ApiLoginManager::EXTERNAL_VALIDATOR) | ||
| end | ||
| end |
There was a problem hiding this comment.
Creo que modificaría los be_falsey por be false, por el mismo comentario que hice anteriormente.
No description provided.