From 8b0ecd568ea70c10adcba0cec120f11b08c241ee Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Tue, 16 Apr 2019 09:56:19 +0000 Subject: [PATCH] Auto corrected by following Lint Ruby RSpec/ImplicitSubject --- spec/features/crops/crop_detail_page_spec.rb | 10 +++++----- spec/features/gardens/actions_spec.rb | 16 ++++++++-------- spec/features/harvests/browse_harvests_spec.rb | 6 +++--- spec/features/home/home_spec.rb | 18 +++++++++--------- spec/features/seeds/seed_photos.rb | 8 ++++---- spec/helpers/photos_helper_spec.rb | 6 +++--- .../crops/_planting_advice.html.haml_spec.rb | 4 ++-- spec/views/members/show.rss.haml_spec.rb | 8 ++++---- spec/views/posts/show.html.haml_spec.rb | 8 ++++---- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/spec/features/crops/crop_detail_page_spec.rb b/spec/features/crops/crop_detail_page_spec.rb index bbf53b0a0..2c263999b 100644 --- a/spec/features/crops/crop_detail_page_spec.rb +++ b/spec/features/crops/crop_detail_page_spec.rb @@ -119,7 +119,7 @@ describe "crop detail page", js: true do end it "predicts harvest" do - is_expected.to have_text("First harvest expected 20 days after planting") + expect(subject).to have_text("First harvest expected 20 days after planting") end end end @@ -142,12 +142,12 @@ describe "crop detail page", js: true do end it "predicts lifespan" do - is_expected.to have_text "Median lifespan" - is_expected.to have_text "99 days" + expect(subject).to have_text "Median lifespan" + expect(subject).to have_text "99 days" end it "describes annual crops" do - is_expected.to have_text( + expect(subject).to have_text( "#{crop.name} is an annual crop (living and reproducing in a single year or less)" ) end @@ -164,7 +164,7 @@ describe "crop detail page", js: true do end it "describes perennial crops" do - is_expected.to have_text("#{crop.name} is a perennial crop (living more than two years)") + expect(subject).to have_text("#{crop.name} is a perennial crop (living more than two years)") end end diff --git a/spec/features/gardens/actions_spec.rb b/spec/features/gardens/actions_spec.rb index 1f7fe2a26..4da6b1e32 100644 --- a/spec/features/gardens/actions_spec.rb +++ b/spec/features/gardens/actions_spec.rb @@ -15,9 +15,9 @@ describe "Gardens" do shared_examples "has buttons bar at top" do it "has buttons bar at top" do within '.layout-actions' do - is_expected.to have_link 'Add a garden' - is_expected.to have_link 'My gardens' - is_expected.to have_link "Everyone's gardens" + expect(subject).to have_link 'Add a garden' + expect(subject).to have_link 'My gardens' + expect(subject).to have_link "Everyone's gardens" end end end @@ -27,11 +27,11 @@ describe "Gardens" do include_examples "has buttons bar at top" it "has actions on garden" do - is_expected.to have_link 'Plant something here' - is_expected.to have_link 'Mark as inactive' - is_expected.to have_link 'Edit' - is_expected.to have_link 'Add photo' - is_expected.to have_link 'Delete' + expect(subject).to have_link 'Plant something here' + expect(subject).to have_link 'Mark as inactive' + expect(subject).to have_link 'Edit' + expect(subject).to have_link 'Add photo' + expect(subject).to have_link 'Delete' end end diff --git a/spec/features/harvests/browse_harvests_spec.rb b/spec/features/harvests/browse_harvests_spec.rb index a141547e4..1f05c5a34 100644 --- a/spec/features/harvests/browse_harvests_spec.rb +++ b/spec/features/harvests/browse_harvests_spec.rb @@ -14,7 +14,7 @@ describe "browse harvests" do before { visit harvests_path } it 'read more' do - is_expected.not_to have_link "Read more" + expect(subject).not_to have_link "Read more" end end @@ -26,11 +26,11 @@ describe "browse harvests" do end it 'read more' do - is_expected.to have_link "Read more" + expect(subject).to have_link "Read more" end it 'links to #show' do - is_expected.to have_link harvest.crop.name, href: harvest_path(harvest) + expect(subject).to have_link harvest.crop.name, href: harvest_path(harvest) end end end diff --git a/spec/features/home/home_spec.rb b/spec/features/home/home_spec.rb index 8a10c83fa..6ef612af0 100644 --- a/spec/features/home/home_spec.rb +++ b/spec/features/home/home_spec.rb @@ -27,13 +27,13 @@ describe "home page" do shared_examples 'shows seeds' do it "show tradeable seed" do - is_expected.to have_link href: seed_path(tradable_seed) + expect(subject).to have_link href: seed_path(tradable_seed) end it "does not show finished seeds" do - is_expected.not_to have_link href: seed_path(finished_seed) + expect(subject).not_to have_link href: seed_path(finished_seed) end it "does not show untradable seeds" do - is_expected.not_to have_link href: seed_path(untradable_seed) + expect(subject).not_to have_link href: seed_path(untradable_seed) end it { is_expected.to have_text 'View all seeds' } @@ -41,14 +41,14 @@ describe "home page" do shared_examples 'show plantings' do it 'shows plantings section' do - is_expected.to have_text 'Recently Planted' - is_expected.to have_link href: planting_path(planting) + expect(subject).to have_text 'Recently Planted' + expect(subject).to have_link href: planting_path(planting) end end shared_examples 'show harvests' do it 'shows harvests section' do - is_expected.to have_text 'Recently Harvested' - is_expected.to have_link href: harvest_path(harvest) + expect(subject).to have_text 'Recently Harvested' + expect(subject).to have_link href: harvest_path(harvest) end end @@ -61,12 +61,12 @@ describe "home page" do describe 'shows recently added crops' do it { is_expected.to have_text 'Recently Added' } it 'link to newest crops' do - is_expected.to have_link crop.name, href: crop_path(crop) + expect(subject).to have_link crop.name, href: crop_path(crop) end end it 'includes a link to all crops' do - is_expected.to have_link 'View all crops' + expect(subject).to have_link 'View all crops' end end diff --git a/spec/features/seeds/seed_photos.rb b/spec/features/seeds/seed_photos.rb index add3d0fa5..d1eacdd7f 100644 --- a/spec/features/seeds/seed_photos.rb +++ b/spec/features/seeds/seed_photos.rb @@ -31,16 +31,16 @@ describe "Seeds", :js do let!(:photos) { FactoryBot.create_list :photo, 50 } it "shows newest photo" do - is_expected.to have_xpath("//img[contains(@src,'#{photos.last.thumbnail_url}')]") + expect(subject).to have_xpath("//img[contains(@src,'#{photos.last.thumbnail_url}')]") end it "links to newest photo" do - is_expected.to have_xpath("//a[contains(@href,'#{photo_path(photos.last)}')]") + expect(subject).to have_xpath("//a[contains(@href,'#{photo_path(photos.last)}')]") end it "does not show oldest photo" do - is_expected.not_to have_xpath("//img[contains(@src,'#{photos.first.thumbnail_url}')]") + expect(subject).not_to have_xpath("//img[contains(@src,'#{photos.first.thumbnail_url}')]") end it "does not link to oldest photo" do - is_expected.not_to have_xpath("//a[contains(@href,'#{photo_path(photos.first)}')]") + expect(subject).not_to have_xpath("//a[contains(@href,'#{photo_path(photos.first)}')]") end end end diff --git a/spec/helpers/photos_helper_spec.rb b/spec/helpers/photos_helper_spec.rb index 60a6cbc59..cace0e120 100644 --- a/spec/helpers/photos_helper_spec.rb +++ b/spec/helpers/photos_helper_spec.rb @@ -22,7 +22,7 @@ describe PhotosHelper do before { planting.photos << planting_photo } it "uses planting photos" do - is_expected.to eq planting_photo.thumbnail_url + expect(subject).to eq planting_photo.thumbnail_url end end @@ -30,7 +30,7 @@ describe PhotosHelper do before { harvest.photos << harvest_photo } it "uses harvest photos" do - is_expected.to eq harvest_photo.thumbnail_url + expect(subject).to eq harvest_photo.thumbnail_url end end @@ -38,7 +38,7 @@ describe PhotosHelper do before { seed.photos << seed_photo } it "uses seed photos" do - is_expected.to eq seed_photo.thumbnail_url + expect(subject).to eq seed_photo.thumbnail_url end end end diff --git a/spec/views/crops/_planting_advice.html.haml_spec.rb b/spec/views/crops/_planting_advice.html.haml_spec.rb index 7335fd127..59e635b45 100644 --- a/spec/views/crops/_planting_advice.html.haml_spec.rb +++ b/spec/views/crops/_planting_advice.html.haml_spec.rb @@ -13,7 +13,7 @@ describe "crops/_planting_advice" do context "with no sunniness set" do include_examples "render planting_advice" it "doesn't show sunniness" do - is_expected.to have_content "Plant in: not known." + expect(subject).to have_content "Plant in: not known." end end @@ -41,7 +41,7 @@ describe "crops/_planting_advice" do context "when none are set" do include_examples "render planting_advice" it "doesn't show planted_from " do - is_expected.to have_content "Plant from: not known." + expect(subject).to have_content "Plant from: not known." end end diff --git a/spec/views/members/show.rss.haml_spec.rb b/spec/views/members/show.rss.haml_spec.rb index a0a7414e0..8ad64ab95 100644 --- a/spec/views/members/show.rss.haml_spec.rb +++ b/spec/views/members/show.rss.haml_spec.rb @@ -12,20 +12,20 @@ describe 'members/show.rss.haml', type: "view" do end it 'shows RSS feed title' do - is_expected.to have_text("callum's recent posts") + expect(subject).to have_text("callum's recent posts") end it 'shows content of posts' do - is_expected.to have_content "This is some text." + expect(subject).to have_content "This is some text." end it 'renders post bodies to HTML and XML-escapes them' do # The variable "rendered" has been entity-replaced and tag-stripped # The literal string output contains "<strong>" etc. - is_expected.to have_content "strong" + expect(subject).to have_content "strong" end it 'gives the author in the item title' do - is_expected.to have_content "#{@post1.subject} by #{@post1.author}" + expect(subject).to have_content "#{@post1.subject} by #{@post1.author}" end end diff --git a/spec/views/posts/show.html.haml_spec.rb b/spec/views/posts/show.html.haml_spec.rb index 2754439d1..bb59f2b47 100644 --- a/spec/views/posts/show.html.haml_spec.rb +++ b/spec/views/posts/show.html.haml_spec.rb @@ -71,7 +71,7 @@ describe "posts/show" do end it "shows comments" do - is_expected.to have_content comment.body + expect(subject).to have_content comment.body end it 'has an anchor to the comments' do @@ -95,7 +95,7 @@ describe "posts/show" do end it "shows the oldest comments first" do - is_expected.to have_content(/#{@comment1.body}.*#{@comment2.body}.*#{@comment3.body}.*#{@comment4.body}/m) + expect(subject).to have_content(/#{@comment1.body}.*#{@comment2.body}.*#{@comment3.body}.*#{@comment4.body}/m) end end @@ -105,7 +105,7 @@ describe "posts/show" do before { render } it "shows forum name" do - is_expected.to have_content "in #{post.forum.name}" + expect(subject).to have_content "in #{post.forum.name}" end end @@ -119,7 +119,7 @@ describe "posts/show" do end it 'shows a comment button' do - is_expected.to have_link "Comment", href: new_comment_path(post_id: post.id) + expect(subject).to have_link "Comment", href: new_comment_path(post_id: post.id) end end end