Auto corrected by following Lint Ruby RSpec/ImplicitSubject

This commit is contained in:
Awesome Code
2019-04-16 09:56:19 +00:00
committed by Brenda Wallace
parent d0001691d5
commit 8b0ecd568e
9 changed files with 42 additions and 42 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 "&lt;strong&gt;" etc.
is_expected.to have_content "<strong>strong</strong>"
expect(subject).to have_content "<strong>strong</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

View File

@@ -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