From 4af8282a44c4eb0d19575e4cc715def2d2136c70 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sat, 18 May 2019 19:36:26 +0000 Subject: [PATCH] [CodeFactor] Apply fixes --- app/assets/javascripts/nav.js | 2 +- app/helpers/posts_helper.rb | 2 +- app/models/post.rb | 2 +- spec/features/percy/percy_spec.rb | 20 ++++++++++---------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/nav.js b/app/assets/javascripts/nav.js index 34ce99672..eb3d7297a 100644 --- a/app/assets/javascripts/nav.js +++ b/app/assets/javascripts/nav.js @@ -1 +1 @@ -$('.dropdown-toggle').dropdown() \ No newline at end of file +$('.dropdown-toggle').dropdown(); diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index c7d7c6c2b..9928f710c 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -1,6 +1,6 @@ module PostsHelper def display_post_truncated(post) length = 300 - return truncate(post.body, length: length, separator: ' ', omission: '... ') { link_to "Read more", post_path(post) } + truncate(post.body, length: length, separator: ' ', omission: '... ') { link_to "Read more", post_path(post) } end end diff --git a/app/models/post.rb b/app/models/post.rb index 050af47f5..50be9bfc7 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -51,7 +51,7 @@ class Post < ApplicationRecord def to_s subject end - + private def update_crops_posts_association diff --git a/spec/features/percy/percy_spec.rb b/spec/features/percy/percy_spec.rb index cc4c71a5a..dd9d42f63 100644 --- a/spec/features/percy/percy_spec.rb +++ b/spec/features/percy/percy_spec.rb @@ -10,16 +10,16 @@ describe 'Test with visual testing', type: :feature, js: true do let(:plant_part) { FactoryBot.create :plant_part, name: 'fruit' } let(:tomato_photo) do - FactoryBot.create :photo, - title: 'look at my tomatoes', - owner: member, - fullsize_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_z.jpg', - thumbnail_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_q.jpg' + FactoryBot.create :photo, + title: 'look at my tomatoes', + owner: member, + fullsize_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_z.jpg', + thumbnail_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_q.jpg' end let(:post_body) do "So, um, watering's important. Yep. Very important. -Well, what with moving into the house and all THAT entails...my plants are looking the worse for wear. They haven't gotten enough water. The oregano is dead. The basil and chives are just hanging on. The [tomato](crop) have sort of purple leaves. Seeing that the roots were all growing out of the bottom of the pots, I finally went and got soil to fill the basins I have for the tomatoes and spent the money on proper (much larger) pots for the herbs. +Well, what with moving into the house and all THAT entails...my plants are looking the worse for wear. They haven't gotten enough water. The oregano is dead. The basil and chives are just hanging on. The [tomato](crop) have sort of purple leaves. Seeing that the roots were all growing out of the bottom of the pots, I finally went and got soil to fill the basins I have for the tomatoes and spent the money on proper (much larger) pots for the herbs. At Home Depot, it turned out that 7.5\" pots that are glazed inside and out (to prevent wicking & evaporation of water -- the problem my tomatoes were hitting with the teensy clay pots) were $10 for the pot and $5 for the saucer. Or there are 7.25\" self-watering pots for $15. So my herbs are now in self-watering pots where they should be able to survive Pennsic without me. I got a new oregano plant too. @@ -105,9 +105,9 @@ I noticed a couple of days ago on the way to work that there's a place near home it 'gardens#show' do # a garden garden = FactoryBot.create :garden, name: 'paradise', owner: member - #with some lettuce (finished) + # with some lettuce (finished) FactoryBot.create :planting, crop: FactoryBot.create(:crop, name: 'lettuce'), garden: garden, owner: member, finished_at: 2.weeks.ago - #tomato still growing + # tomato still growing tomato_planting = FactoryBot.create :planting, garden: garden, owner: member, crop: tomato tomato_photo.plantings << tomato_planting visit garden_path(garden) @@ -129,8 +129,8 @@ I noticed a couple of days ago on the way to work that there's a place near home describe 'posts' do it 'loads posts#show' do - FactoryBot.create :comment ,post: post - FactoryBot.create :comment ,post: post + FactoryBot.create :comment, post: post + FactoryBot.create :comment, post: post visit post_path(post) Percy.snapshot(page, name: "#{prefix}/posts#show") end