mezuro / prezento

Prezento is the web interface for Mezuro.
http://mezuro.github.io/
GNU Affero General Public License v3.0
6 stars 15 forks source link

Sets project image on attribute creation (closes #264) #377

Open jonnatas opened 8 years ago

jonnatas commented 8 years ago
rafamanzo commented 8 years ago

Welcome @jonnatas !

You've got the code right. Congratulations!

What do you think about taking this opportunity to enhance the ProjectsController#create unit tests? The case for valid fields lack the proper mock for current_user.project_attributes.create(project_id: @project.id). And the case with invalid fields lacks a check that this was not called.

rafamanzo commented 8 years ago

What do you think about making image_url = project_params.delete(:image_url) a before action? Then applied only for create and update.

And if you are brave, what about making the set_project calls before actions as well?

jonnatas commented 8 years ago

We created a new test for projects_controller#create that checks if the action also increased the total number of users and rewrited image_url to be a before_action to be reusable in projects_controller#update. We also try'd to do a better mock for the scenarios that you asked for, but It was tough, mainly because we can't finded a proper way to use "receive" (looks like it can't be usable with this configuration of rspec).

We can still trying if you really need the other mocks, but maybe we will need some help haha.

diegoamc commented 7 years ago

ping @jonnatas

rafamanzo commented 7 years ago

@vitorbaraujo @oliveiraMarcelo, This PR is almost complete. Would you like to proceed with this one?

vitorbaraujo commented 7 years ago

We will put this issue in our backlog and attack it on our next sprint, is that ok?

paulormm commented 7 years ago

That's ok. Thanks.

oliveiraMarcelo commented 7 years ago

I'm working on it.