alinajuly / RubyHW

homework
0 stars 0 forks source link

Feedback for HW9 #18

Closed MaksHostroushko closed 1 year ago

MaksHostroushko commented 1 year ago

You did this work great! But let's add a couple of improvements

  1. https://github.com/alinajuly/RubyHW/blob/main/HW9/blog/spec/requests/api/v1/articles_spec.rb#L5..L8 It could be better if we write variables with the same spaces I mean

    let(:author)  { Author.create(name: 'Sasha') }
    let(:article) { Article.create(title: 'Title', body: 'Body title', author_id: author.id) }
    let(:comment) { Comment.create(body: 'comment', author_id: author.id, article_id: article.id) }
    let(:id)      { article.id }
  2. Ideally, we should call factory instead of records creating manually I mean, it could be better to write let(:author) { create(:author, name: 'Sasha') } instead of Author.create(name: 'Sasha') You can use this game for this fix(but it is optional)

  3. https://github.com/alinajuly/RubyHW/blob/main/HW9/blog/spec/requests/api/v1/articles_spec.rb#L32.L45 Please, add spaces between it..end

  4. https://github.com/alinajuly/RubyHW/blob/main/HW9/blog/spec/requests/api/v1/articles_spec.rb#L32.L45 I think, we should prefer symbol to string, because it's better for memory So, let's use parameter name: :id, in: :path

  5. https://github.com/alinajuly/RubyHW/blob/main/HW9/blog/spec/requests/api/v1/articles_spec.rb#L129..L132 We shouldn't do it manually. Our test should have a controller and return response. We need to check the response but don't write a logic For example

    image
alinajuly commented 1 year ago

Thank you. Done.