-
Notifications
You must be signed in to change notification settings - Fork 16
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
Sets project image on attribute creation (closes #264) #377
base: master
Are you sure you want to change the base?
Conversation
jonnatas
commented
Sep 8, 2016
- Uses 'image_url' as instance variable to be able to set 'image_url'
- It evades the problem of updating the image of a null 'project_attribute' on repository creation
Welcome @jonnatas ! You've got the code right. Congratulations! What do you think about taking this opportunity to enhance the |
What do you think about making And if you are brave, what about making the |
8460cc9
to
009c84a
Compare
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there is no acceptance test for such feature. Do you think we can take this opportunity to choose it?
|
||
subject { post :create, :project => subject_params } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call to post is better suited into a before do; end
. Is there a special reason for making it within the subject?
subject { post :create, :project => subject_params } | ||
|
||
it 'should increase total number of project_attributes' do | ||
expect{subject}.to change{@user.project_attributes.count}.by(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of touching the database, what do you think about creating mocks and asserting they are called? If need help with the mocking concepts, please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafamanzo yes, can you give me a hand with the mocking?
@@ -56,6 +61,7 @@ | |||
end | |||
|
|||
it { is_expected.to render_template(:new) } | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful with blank spaces and lines. (But a blank line at the end of the file is desirable)
- It evades the problem of updating the image of a null repository Signed-off-by: jonnatas <jonatas_lenon@hotmail.com> Signed-off-by: DylanGuedes <djmgguedes@gmail.com>
Signed-off-by: jonnatas <jonatas_lenon@hotmail.com> Signed-off-by: DylanGuedes <djmgguedes@gmail.com>
6481cb3
to
12fc9eb
Compare
Signed-off-by: jonnatas <jonatas_lenon@hotmail.com> Signed-off-by: MarcosDDourado <marcosdourado92@gmail.com>
12fc9eb
to
811dd5a
Compare
|
||
# GET /projects/new | ||
def new | ||
@project = Project.new | ||
end | ||
|
||
def fetch_image_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about setting this as a private method?
|
||
Then(/^I insert the url on the image field/) do | ||
fill_in "project_image_url", with: "https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing endline
ping @jonnatas |
@vitorbaraujo @oliveiraMarcelo, This PR is almost complete. Would you like to proceed with this one? |
We will put this issue in our backlog and attack it on our next sprint, is that ok? |
That's ok. Thanks. |
I'm working on it. |