From c8e5cecaf69a0332f4429d2bdc8def1f2d186510 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 8 Feb 2019 09:13:26 +1300 Subject: [PATCH 01/11] Fixes checking for github bots in contributors --- CONTRIBUTORS.md | 3 +-- script/check_contributors_md.rb | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 2dcbb1842..f1985a45d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -93,5 +93,4 @@ submit the change with your pull request. ### Security and Dependency Updates - DeppBot / [deppbot](https://github.com/deppbot) -- dependabot[bot] / [dependabot-bot] / [dependabot] (https://github.com/dependabot-bot) -- dependabot / [dependabot](https://github.com/dependabot) +- dependabot[bot] (https://github.com/dependabot-bot) diff --git a/script/check_contributors_md.rb b/script/check_contributors_md.rb index 4792abbb5..406f64e19 100755 --- a/script/check_contributors_md.rb +++ b/script/check_contributors_md.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby puts "Checking to see if you're in CONTRIBUTORS.md..." + if ENV['TRAVIS'] if ENV['TRAVIS_PULL_REQUEST'] require 'httparty' @@ -18,7 +19,7 @@ if ENV['TRAVIS'] end else author = `git config github.user`.chomp - if $CHILD_STATUS.exitstatus.positive? + if $?.exitstatus.positive? abort %( Couldn't determine your GitHub username, and not in a Travis PR build Please set it using @@ -27,6 +28,9 @@ Please set it using end end +author.sub! '[', '\\[' +author.sub! ']', '\\]' + unless system('grep', '-i', author, 'CONTRIBUTORS.md') abort %( Thanks for your contribution, #{author}! From bffbd944620c7fab9227f9dd048c9701c9519e8f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 9 Feb 2019 08:50:04 +1300 Subject: [PATCH 02/11] Read the file contents in ruby --- script/check_contributors_md.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/script/check_contributors_md.rb b/script/check_contributors_md.rb index 406f64e19..44c54444c 100755 --- a/script/check_contributors_md.rb +++ b/script/check_contributors_md.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +require "English" puts "Checking to see if you're in CONTRIBUTORS.md..." @@ -19,7 +20,7 @@ if ENV['TRAVIS'] end else author = `git config github.user`.chomp - if $?.exitstatus.positive? + if $CHILD_STATUS.exitstatus.positive? abort %( Couldn't determine your GitHub username, and not in a Travis PR build Please set it using @@ -28,10 +29,7 @@ Please set it using end end -author.sub! '[', '\\[' -author.sub! ']', '\\]' - -unless system('grep', '-i', author, 'CONTRIBUTORS.md') +unless File.read('CONTRIBUTORS.md').include? author abort %( Thanks for your contribution, #{author}! Please add your name and GitHub handle to the file CONTRIBUTORS.md, From cde61a1c4fbfd356d471bf52bb7762f3084d76e5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 9 Feb 2019 09:04:24 +1300 Subject: [PATCH 03/11] Use Regex to search for author --- script/check_contributors_md.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script/check_contributors_md.rb b/script/check_contributors_md.rb index 44c54444c..9aa3fa290 100755 --- a/script/check_contributors_md.rb +++ b/script/check_contributors_md.rb @@ -29,7 +29,10 @@ Please set it using end end -unless File.read('CONTRIBUTORS.md').include? author +# Escape chars in name, and make case insensitive +author_to_search_for = Regexp.new(Regexp.escape(author), Regexp::IGNORECASE) + +unless File.read('CONTRIBUTORS.md').match?(author_to_search_for) abort %( Thanks for your contribution, #{author}! Please add your name and GitHub handle to the file CONTRIBUTORS.md, From e32a8bd6acf8081272f9e3a27e5b343b30fd6b9e Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 10 Feb 2019 09:23:43 +0000 Subject: [PATCH 04/11] Auto corrected by following Lint Ruby RSpec/HooksBeforeExamples --- spec/controllers/likes_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/likes_controller_spec.rb b/spec/controllers/likes_controller_spec.rb index 09f6ee251..a62c8a9cb 100644 --- a/spec/controllers/likes_controller_spec.rb +++ b/spec/controllers/likes_controller_spec.rb @@ -9,8 +9,8 @@ describe LikesController do before { sign_in member } describe "POST create" do - it { expect(response.content_type).to eq "application/json" } before { post :create, params: { post_id: blogpost.id, format: :json } } + it { expect(response.content_type).to eq "application/json" } it { expect(Like.last.likeable_id).to eq(blogpost.id) } it { expect(Like.last.likeable_type).to eq('Post') } From 49eed9b2081a26a8f55ddc8ff9a27a6fb187d95e Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 10 Feb 2019 09:23:59 +0000 Subject: [PATCH 05/11] Auto corrected by following Lint Ruby RSpec/LetBeforeExamples --- spec/controllers/comments_controller_spec.rb | 2 +- spec/features/signout_spec.rb | 2 +- spec/models/crop_spec.rb | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index 6d9a707af..a3f1a60f0 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -35,11 +35,11 @@ describe CommentsController do describe "with valid params" do before { get :new, params: { post_id: post.id } } + let(:old_comment) { FactoryBot.create(:comment, post: post) } it "picks up post from params" do expect(assigns(:post)).to eq(post) end - let(:old_comment) { FactoryBot.create(:comment, post: post) } it "assigns the old comments as @comments" do expect(assigns(:comments)).to eq [old_comment] diff --git a/spec/features/signout_spec.rb b/spec/features/signout_spec.rb index 35cd8af9b..d94631c67 100644 --- a/spec/features/signout_spec.rb +++ b/spec/features/signout_spec.rb @@ -3,6 +3,7 @@ require 'rails_helper' feature "signout" do let(:member) { create :member } + let(:path) {} scenario "redirect to previous page after signout" do visit crops_path # some random page click_link 'Sign in' @@ -29,7 +30,6 @@ feature "signout" do end end - let(:path) {} describe 'after signout, redirect to signin page if page needs authentication' do include_examples "sign-in redirects", "/plantings/new" diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index e580add1b..27b31fde8 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -1,6 +1,9 @@ require 'rails_helper' describe Crop do + let(:pp2) { FactoryBot.create(:plant_part) } + let(:pp1) { FactoryBot.create(:plant_part) } + let(:maize) { FactoryBot.create(:maize) } context 'all fields present' do let(:crop) { FactoryBot.create(:tomato) } @@ -333,9 +336,6 @@ describe Crop do end end - let(:maize) { FactoryBot.create(:maize) } - let(:pp1) { FactoryBot.create(:plant_part) } - let(:pp2) { FactoryBot.create(:plant_part) } context "harvests" do let(:h1) { FactoryBot.create(:harvest, crop: maize, plant_part: pp1) } From 54798190a79ba5541512d0f70b04aea5c5231f12 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 10 Feb 2019 09:24:07 +0000 Subject: [PATCH 06/11] Auto corrected by following Lint Ruby RSpec/ReturnFromStub --- spec/helpers/buttons_helper_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/helpers/buttons_helper_spec.rb b/spec/helpers/buttons_helper_spec.rb index d23bde14f..d16d01f0e 100644 --- a/spec/helpers/buttons_helper_spec.rb +++ b/spec/helpers/buttons_helper_spec.rb @@ -11,7 +11,7 @@ require 'rails_helper' # end # end RSpec.describe ButtonsHelper, type: :helper do - before { allow(self).to receive(:can?) { true } } + before { allow(self).to receive(:can?).and_return(true) } let(:garden) { FactoryBot.create :garden } let(:planting) { FactoryBot.create :planting } From bbd34c5e7b60825e4c62587d553cbe766404d562 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 10 Feb 2019 09:24:19 +0000 Subject: [PATCH 07/11] Auto corrected by following Lint Ruby RSpec/SharedContext --- spec/views/crops/_planting_advice.html.haml_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/views/crops/_planting_advice.html.haml_spec.rb b/spec/views/crops/_planting_advice.html.haml_spec.rb index f5adc5b29..7335fd127 100644 --- a/spec/views/crops/_planting_advice.html.haml_spec.rb +++ b/spec/views/crops/_planting_advice.html.haml_spec.rb @@ -5,7 +5,7 @@ describe "crops/_planting_advice" do let(:planting) { FactoryBot.create(:planting) } - shared_examples "render planting_advice" do + shared_context "render planting_advice" do before { render 'crops/planting_advice', crop: planting.crop } end From 490db7b34276858b8bd903a257f3c5cc255ee952 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 10 Feb 2019 09:23:31 +0000 Subject: [PATCH 08/11] Auto corrected by following Lint Ruby RSpec/HookArgument --- .../authentications_controller_spec.rb | 2 +- .../charts/gardens_controller_spec.rb | 2 +- spec/controllers/comments_controller_spec.rb | 2 +- spec/controllers/gardens_controller_spec.rb | 2 +- spec/controllers/member_controller_spec.rb | 2 +- spec/controllers/photos_controller_spec.rb | 6 ++--- spec/controllers/places_controller_spec.rb | 4 ++-- .../registrations_controller_spec.rb | 2 +- spec/features/gardens/gardens_index_spec.rb | 2 +- .../features/harvests/browse_harvests_spec.rb | 2 +- spec/helpers/application_helper_spec.rb | 4 ++-- spec/helpers/crops_helper_spec.rb | 2 +- spec/lib/actions/oauth_signup_action_spec.rb | 16 ++++++------- spec/models/ability_spec.rb | 2 +- spec/models/comment_spec.rb | 2 +- spec/models/crop_spec.rb | 10 ++++---- spec/models/follow_spec.rb | 4 ++-- spec/models/harvest_spec.rb | 8 +++---- spec/models/like_spec.rb | 2 +- spec/models/member_spec.rb | 4 ++-- spec/support/controller_macros.rb | 2 +- spec/support/database_cleaner.rb | 6 ++--- spec/support/is_likeable.rb | 2 +- spec/views/admin/index_spec.rb | 2 +- spec/views/admin/newsletter_spec.rb | 2 +- spec/views/comments/edit.html.haml_spec.rb | 2 +- spec/views/comments/index.html.haml_spec.rb | 2 +- spec/views/comments/index.rss.haml_spec.rb | 2 +- spec/views/comments/new.html.haml_spec.rb | 2 +- spec/views/comments/show.html.haml_spec.rb | 2 +- spec/views/crops/_popover.html.haml_spec.rb | 2 +- spec/views/crops/edit.html.haml_spec.rb | 2 +- spec/views/crops/hierarchy.html.haml_spec.rb | 2 +- spec/views/crops/index.html.haml_spec.rb | 4 ++-- spec/views/crops/index.rss.haml_spec.rb | 2 +- spec/views/crops/new.html.haml_spec.rb | 2 +- spec/views/crops/wrangle.html.haml_spec.rb | 2 +- spec/views/devise/confirmations/new_spec.rb | 2 +- .../mailer/confirmation_instructions_spec.rb | 2 +- .../reset_password_instructions_spec.rb | 2 +- .../devise/mailer/unlock_instructions_spec.rb | 2 +- spec/views/devise/registrations/edit_spec.rb | 10 ++++---- spec/views/devise/registrations/new_spec.rb | 2 +- spec/views/devise/sessions/new_spec.rb | 2 +- spec/views/devise/unlocks/new_spec.rb | 2 +- spec/views/forums/edit.html.haml_spec.rb | 2 +- spec/views/forums/index.html.haml_spec.rb | 4 ++-- spec/views/forums/new.html.haml_spec.rb | 2 +- spec/views/forums/show.html.haml_spec.rb | 2 +- spec/views/gardens/edit.html.haml_spec.rb | 2 +- spec/views/gardens/new.html.haml_spec.rb | 2 +- spec/views/gardens/show.html.haml_spec.rb | 2 +- spec/views/harvests/edit.html.haml_spec.rb | 2 +- spec/views/harvests/index.html.haml_spec.rb | 2 +- spec/views/harvests/index.rss.haml_spec.rb | 2 +- spec/views/harvests/new.html.haml_spec.rb | 2 +- spec/views/home/_blurb.html.haml_spec.rb | 2 +- spec/views/home/_members.html.haml_spec.rb | 2 +- spec/views/home/_seeds.html.haml_spec.rb | 2 +- spec/views/home/index_spec.rb | 6 ++--- spec/views/layouts/_header_spec.rb | 4 ++-- spec/views/layouts/_meta_spec.rb | 2 +- spec/views/layouts/application_spec.rb | 2 +- .../views/members/_location.html.haml_spec.rb | 4 ++-- spec/views/members/index.html.haml_spec.rb | 2 +- spec/views/members/show.rss.haml_spec.rb | 2 +- .../notifications/index.html.haml_spec.rb | 4 ++-- .../views/notifications/new.html.haml_spec.rb | 2 +- .../notifications/show.html.haml_spec.rb | 2 +- spec/views/notifier/notify.html.haml_spec.rb | 2 +- spec/views/photos/edit.html.haml_spec.rb | 2 +- spec/views/photos/index.html.haml_spec.rb | 2 +- spec/views/photos/new.html.haml_spec.rb | 4 ++-- spec/views/photos/show.html.haml_spec.rb | 10 ++++---- .../places/_map_attribution.html.haml_spec.rb | 2 +- spec/views/places/index.html.haml_spec.rb | 2 +- spec/views/places/show.html.haml_spec.rb | 2 +- spec/views/plant_parts/edit.html.haml_spec.rb | 2 +- .../views/plant_parts/index.html.haml_spec.rb | 2 +- spec/views/plant_parts/new.html.haml_spec.rb | 2 +- spec/views/plant_parts/show.html.haml_spec.rb | 2 +- spec/views/plantings/_form.html.haml_spec.rb | 2 +- spec/views/plantings/edit.html.haml_spec.rb | 4 ++-- spec/views/plantings/index.html.haml_spec.rb | 2 +- spec/views/plantings/index.rss.haml_spec.rb | 6 ++--- spec/views/plantings/new.html.haml_spec.rb | 4 ++-- spec/views/plantings/show.html.haml_spec.rb | 6 ++--- spec/views/posts/_single.html.haml_spec.rb | 24 +++++++++---------- spec/views/posts/edit.html.haml_spec.rb | 6 ++--- spec/views/posts/index.html.haml_spec.rb | 2 +- spec/views/posts/index.rss.haml_spec.rb | 2 +- spec/views/posts/new.html.haml_spec.rb | 4 ++-- spec/views/posts/show.html.haml_spec.rb | 8 +++---- spec/views/posts/show.rss.haml_spec.rb | 2 +- spec/views/roles/edit.html.haml_spec.rb | 2 +- spec/views/roles/index.html.haml_spec.rb | 2 +- spec/views/roles/new.html.haml_spec.rb | 2 +- spec/views/roles/show.html.haml_spec.rb | 2 +- .../scientific_names/edit.html.haml_spec.rb | 2 +- .../scientific_names/index.html.haml_spec.rb | 4 ++-- .../scientific_names/new.html.haml_spec.rb | 4 ++-- .../scientific_names/show.html.haml_spec.rb | 4 ++-- spec/views/seeds/edit.html.haml_spec.rb | 2 +- spec/views/seeds/index.rss.haml_spec.rb | 6 ++--- spec/views/seeds/new.html.haml_spec.rb | 2 +- spec/views/seeds/show.html.haml_spec.rb | 6 ++--- 106 files changed, 174 insertions(+), 174 deletions(-) diff --git a/spec/controllers/authentications_controller_spec.rb b/spec/controllers/authentications_controller_spec.rb index db4bec89a..7da3d0501 100644 --- a/spec/controllers/authentications_controller_spec.rb +++ b/spec/controllers/authentications_controller_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe AuthenticationsController do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_member) { @member } diff --git a/spec/controllers/charts/gardens_controller_spec.rb b/spec/controllers/charts/gardens_controller_spec.rb index 6c3843446..250b05358 100644 --- a/spec/controllers/charts/gardens_controller_spec.rb +++ b/spec/controllers/charts/gardens_controller_spec.rb @@ -15,7 +15,7 @@ describe Charts::GardensController do end context "when signed in" do - before(:each) { sign_in member } + before { sign_in member } let!(:member) { FactoryBot.create(:member) } diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index a3f1a60f0..8181f4483 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -5,7 +5,7 @@ describe CommentsController do let(:member) { FactoryBot.create(:member) } - before(:each) do + before do sign_in member controller.stub(:current_member) { member } end diff --git a/spec/controllers/gardens_controller_spec.rb b/spec/controllers/gardens_controller_spec.rb index 4e40f5ffa..3222829fe 100644 --- a/spec/controllers/gardens_controller_spec.rb +++ b/spec/controllers/gardens_controller_spec.rb @@ -50,7 +50,7 @@ RSpec.describe GardensController, type: :controller do end context "when signed in" do - before(:each) { sign_in member } + before { sign_in member } let!(:member) { FactoryBot.create(:member) } diff --git a/spec/controllers/member_controller_spec.rb b/spec/controllers/member_controller_spec.rb index 025b66701..f6d01207f 100644 --- a/spec/controllers/member_controller_spec.rb +++ b/spec/controllers/member_controller_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe MembersController do - before :each do + before do @member = FactoryBot.create(:member) @posts = [FactoryBot.create(:post, author: @member)] @twitter_auth = FactoryBot.create(:authentication, member: @member) diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index 36ccb436b..08c24ad92 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -30,7 +30,7 @@ describe PhotosController do let(:member) { FactoryBot.create(:member) } let!(:auth) { FactoryBot.create(:flickr_authentication, member: member) } - before(:each) do + before do sign_in member member.stub(:flickr_photos) { [[], 0] } member.stub(:flickr_sets) { { "foo" => "bar" } } @@ -38,7 +38,7 @@ describe PhotosController do end describe "planting photos" do - before(:each) { get :new, params: { type: "planting", id: planting.id } } + before { get :new, params: { type: "planting", id: planting.id } } it { assigns(:flickr_auth).should be_an_instance_of(Authentication) } it { assigns(:item).should eq planting } @@ -62,7 +62,7 @@ describe PhotosController do end describe "POST create" do - before(:each) do + before do Photo.any_instance.stub(:flickr_metadata).and_return(title: "A Heartbreaking work of staggering genius", license_name: "CC-BY", license_url: "http://example.com/aybpl", diff --git a/spec/controllers/places_controller_spec.rb b/spec/controllers/places_controller_spec.rb index d235b98c9..a32d27c28 100644 --- a/spec/controllers/places_controller_spec.rb +++ b/spec/controllers/places_controller_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' describe PlacesController do - before :each do + before do controller.stub(:current_member) { nil } end describe "GET show" do - before(:each) do + before do @member_london = FactoryBot.create(:london_member) @member_south_pole = FactoryBot.create(:south_pole_member) end diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 015bbb705..82b52652d 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe RegistrationsController do - before :each do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/features/gardens/gardens_index_spec.rb b/spec/features/gardens/gardens_index_spec.rb index fa047d8d8..9f94dccf4 100644 --- a/spec/features/gardens/gardens_index_spec.rb +++ b/spec/features/gardens/gardens_index_spec.rb @@ -74,7 +74,7 @@ feature "Gardens#index", :js do let(:member) { FactoryBot.create :member, login_name: 'robbieburns' } let(:crop) { FactoryBot.create :crop } - before(:each) do + before do # time to harvest = 50 day # time to finished = 90 days FactoryBot.create(:harvest, diff --git a/spec/features/harvests/browse_harvests_spec.rb b/spec/features/harvests/browse_harvests_spec.rb index 010433be2..cadbc19e7 100644 --- a/spec/features/harvests/browse_harvests_spec.rb +++ b/spec/features/harvests/browse_harvests_spec.rb @@ -21,7 +21,7 @@ feature "browse harvests" do feature "filled in optional fields" do let!(:harvest) { create :harvest, :long_description } - before(:each) do + before do visit harvests_path end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 5c1d11d9e..b54b792a9 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -17,7 +17,7 @@ describe ApplicationHelper do describe '#avatar_uri' do context 'with a normal user' do - before :each do + before do @member = FactoryBot.build(:member, email: 'example@example.com', preferred_avatar_uri: nil) end @@ -31,7 +31,7 @@ describe ApplicationHelper do end context 'with a user who specified a preferred avatar uri' do - before :each do + before do @member = FactoryBot.build(:member, email: 'example@example.com', preferred_avatar_uri: 'http://media.catmoji.com/post/ujg/cat-in-hat.jpg') end diff --git a/spec/helpers/crops_helper_spec.rb b/spec/helpers/crops_helper_spec.rb index 49a570836..ef7e062f4 100644 --- a/spec/helpers/crops_helper_spec.rb +++ b/spec/helpers/crops_helper_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe CropsHelper do describe "display_seed_availability" do - before :each do + before do @member = create :member @crop = create :tomato end diff --git a/spec/lib/actions/oauth_signup_action_spec.rb b/spec/lib/actions/oauth_signup_action_spec.rb index 3fc37c00e..e315eb6bb 100644 --- a/spec/lib/actions/oauth_signup_action_spec.rb +++ b/spec/lib/actions/oauth_signup_action_spec.rb @@ -2,12 +2,12 @@ require 'rails_helper' require './lib/actions/oauth_signup_action' describe 'Growstuff::OauthSignupAction' do - before :each do + before do @action = Growstuff::OauthSignupAction.new end context 'with a valid authentication' do - before :each do + before do @auth = OmniAuth::AuthHash.new('provider' => 'facebook', 'uid' => '123545', 'info' => { @@ -23,7 +23,7 @@ describe 'Growstuff::OauthSignupAction' do end context 'no existing user' do - before :each do + before do @auth['info']['email'] = 'no.existing.user@gmail.com' Member.where(email: @auth['info']['email']).delete_all @@ -32,7 +32,7 @@ describe 'Growstuff::OauthSignupAction' do @authentication = @action.establish_authentication(@auth, @member) end - after :each do + after do @member.delete @authentication.delete end @@ -70,7 +70,7 @@ describe 'Growstuff::OauthSignupAction' do context 'an existing user' do context 'who has never used oauth' do - before :each do + before do @auth['info']['email'] = 'never.used.oauth@yahoo.com' Member.where(email: @auth['info']['email']).delete_all @@ -82,7 +82,7 @@ describe 'Growstuff::OauthSignupAction' do @authentication = @action.establish_authentication(@auth, @member) end - after :each do + after do @existing_member.delete @member.delete @authentication.delete @@ -112,7 +112,7 @@ describe 'Growstuff::OauthSignupAction' do end context 'who has used oauth' do - before :each do + before do @auth['info']['email'] = 'i.used.oauth.once@coolemail.com' Member.where(email: @auth['info']['email']).delete_all @@ -131,7 +131,7 @@ describe 'Growstuff::OauthSignupAction' do @authentication = @action.establish_authentication(@auth, @member) end - after :each do + after do @existing_member.delete @member.delete @existing_authentication.delete diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 7891135c9..7fa8bf9c6 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -51,7 +51,7 @@ describe Ability do context "crop wrangler" do let(:role) { FactoryBot.create(:crop_wrangler) } - before(:each) do + before do member.roles << role end diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index bc90ee8ba..687219386 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -42,7 +42,7 @@ describe Comment do end context "ordering" do - before(:each) do + before do @m = FactoryBot.create(:member) @p = FactoryBot.create(:post, author: @m) @c1 = FactoryBot.create(:comment, post: @p, author: @m) diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index 27b31fde8..51f120316 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -142,12 +142,12 @@ describe Crop do end context 'photos' do - before :each do + before do @crop = FactoryBot.create(:tomato) end context 'with a planting photo' do - before :each do + before do @planting = FactoryBot.create(:planting, crop: @crop) @photo = FactoryBot.create(:photo, owner: @planting.owner) @planting.photos << @photo @@ -164,7 +164,7 @@ describe Crop do end context 'with a harvest photo' do - before :each do + before do @harvest = FactoryBot.create(:harvest, crop: @crop) @photo = FactoryBot.create(:photo, owner: @harvest.owner) @harvest.photos << @photo @@ -176,7 +176,7 @@ describe Crop do end context 'and planting photo' do - before :each do + before do @planting = FactoryBot.create(:planting, crop: @crop) @planting_photo = FactoryBot.create(:photo, owner: @planting.owner) @planting.photos << @planting_photo @@ -386,7 +386,7 @@ describe Crop do end context "csv loading" do - before(:each) do + before do # don't use 'let' for this -- we need to actually create it, # regardless of whether it's used. @cropbot = FactoryBot.create(:cropbot) diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index bd61fe2ee..cdef36012 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Follow do - before(:each) do + before do @member1 = FactoryBot.create(:member) @member2 = FactoryBot.create(:member) end @@ -20,7 +20,7 @@ describe Follow do end context "when follow is created" do - before(:each) do + before do @follow = Follow.create(follower_id: @member1.id, followed_id: @member2.id) end diff --git a/spec/models/harvest_spec.rb b/spec/models/harvest_spec.rb index 9711d2a59..262edd61e 100644 --- a/spec/models/harvest_spec.rb +++ b/spec/models/harvest_spec.rb @@ -223,7 +223,7 @@ describe Harvest do end context 'photos' do - before :each do + before do @harvest = FactoryBot.create(:harvest) end @@ -233,7 +233,7 @@ describe Harvest do end context 'and with a crop(planting) photo' do - before :each do + before do @planting = FactoryBot.create(:planting, crop: @harvest.crop) @photo = FactoryBot.create(:photo, owner: @planting.owner) @planting.photos << @photo @@ -270,7 +270,7 @@ describe Harvest do end context 'and with a crop(planting) photo' do - before :each do + before do @planting = FactoryBot.create(:planting, crop: @harvest.crop) @crop_photo = FactoryBot.create(:photo, owner: @planting.owner) @planting.photos << @crop_photo @@ -282,7 +282,7 @@ describe Harvest do end context 'and a second photo' do - before :each do + before do @photo2 = FactoryBot.create(:photo, owner: @harvest.owner) @harvest.photos << @photo2 end diff --git a/spec/models/like_spec.rb b/spec/models/like_spec.rb index c92e3c389..6c47dcddb 100644 --- a/spec/models/like_spec.rb +++ b/spec/models/like_spec.rb @@ -5,7 +5,7 @@ describe 'like' do let(:post) { FactoryBot.create(:post) } context 'existing like' do - before(:each) do + before do @like = Like.create(member: member, likeable: post) end diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index c6342e60a..3be3f0287 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -200,7 +200,7 @@ describe 'member' do end context 'confirmed scope' do - before(:each) do + before do FactoryBot.create(:member) FactoryBot.create(:member) end @@ -252,7 +252,7 @@ describe 'member' do # 4) ordered by the most recent sign in context 'with a few members and plantings' do - before :each do + before do @members = [ :london_member, :london_member, :london_member, :unconfirmed_member, # !1 diff --git a/spec/support/controller_macros.rb b/spec/support/controller_macros.rb index 354c64069..b54cf0282 100644 --- a/spec/support/controller_macros.rb +++ b/spec/support/controller_macros.rb @@ -2,7 +2,7 @@ module ControllerMacros def login_member(member_factory = :member) let(:member) { FactoryBot.create(member_factory || :member) } - before(:each) do + before do @request.env["devise.mapping"] = Devise.mappings[:member] sign_in member end diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index e0dbc9aa8..720a47032 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -3,7 +3,7 @@ RSpec.configure do |config| DatabaseCleaner.clean_with(:truncation) end - config.before(:each) do + config.before do DatabaseCleaner.strategy = :transaction end @@ -11,11 +11,11 @@ RSpec.configure do |config| DatabaseCleaner.strategy = :truncation end - config.before(:each) do + config.before do DatabaseCleaner.start end - config.after(:each) do + config.after do DatabaseCleaner.clean end end diff --git a/spec/support/is_likeable.rb b/spec/support/is_likeable.rb index e1a590b30..ac451bd07 100644 --- a/spec/support/is_likeable.rb +++ b/spec/support/is_likeable.rb @@ -1,5 +1,5 @@ shared_examples "it is likeable" do - before(:each) do + before do # Possibly a horrible hack. # Will fail if factory name does not match the model name.. @likeable = FactoryBot.create(described_class.to_s.underscore.to_sym) diff --git a/spec/views/admin/index_spec.rb b/spec/views/admin/index_spec.rb index cc8b145d3..7e8c27fdc 100644 --- a/spec/views/admin/index_spec.rb +++ b/spec/views/admin/index_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'admin/index.html.haml', type: "view" do - before(:each) do + before do @member = FactoryBot.create(:admin_member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/admin/newsletter_spec.rb b/spec/views/admin/newsletter_spec.rb index 384833034..4807aaa8e 100644 --- a/spec/views/admin/newsletter_spec.rb +++ b/spec/views/admin/newsletter_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'admin/newsletter.html.haml', type: "view" do - before(:each) do + before do @member = FactoryBot.create(:admin_member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/comments/edit.html.haml_spec.rb b/spec/views/comments/edit.html.haml_spec.rb index 2ef7d480f..b7a547f8c 100644 --- a/spec/views/comments/edit.html.haml_spec.rb +++ b/spec/views/comments/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "comments/edit" do - before(:each) do + before do controller.stub(:current_user) { nil } assign(:comment, FactoryBot.create(:comment)) end diff --git a/spec/views/comments/index.html.haml_spec.rb b/spec/views/comments/index.html.haml_spec.rb index 91ed15a88..b9e577562 100644 --- a/spec/views/comments/index.html.haml_spec.rb +++ b/spec/views/comments/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "comments/index" do - before(:each) do + before do controller.stub(:current_user) { nil } page = 1 per_page = 2 diff --git a/spec/views/comments/index.rss.haml_spec.rb b/spec/views/comments/index.rss.haml_spec.rb index 672658bac..d1b376cab 100644 --- a/spec/views/comments/index.rss.haml_spec.rb +++ b/spec/views/comments/index.rss.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'comments/index.rss.haml' do - before(:each) do + before do controller.stub(:current_user) { nil } @author = FactoryBot.create(:member) @post = FactoryBot.create(:post) diff --git a/spec/views/comments/new.html.haml_spec.rb b/spec/views/comments/new.html.haml_spec.rb index e0533ea5b..cc6638936 100644 --- a/spec/views/comments/new.html.haml_spec.rb +++ b/spec/views/comments/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "comments/new" do - before(:each) do + before do controller.stub(:current_user) { nil } @post = FactoryBot.create(:post) @comment = FactoryBot.create(:comment, post: @post) diff --git a/spec/views/comments/show.html.haml_spec.rb b/spec/views/comments/show.html.haml_spec.rb index 6315b4f69..32a524d65 100644 --- a/spec/views/comments/show.html.haml_spec.rb +++ b/spec/views/comments/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "comments/show" do - before(:each) do + before do controller.stub(:current_user) { nil } @comment = assign(:comment, FactoryBot.create(:comment)) render diff --git a/spec/views/crops/_popover.html.haml_spec.rb b/spec/views/crops/_popover.html.haml_spec.rb index dde4a893f..577667eca 100644 --- a/spec/views/crops/_popover.html.haml_spec.rb +++ b/spec/views/crops/_popover.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "crops/_popover" do - before(:each) do + before do @tomato = FactoryBot.create(:tomato) @sn = FactoryBot.create(:solanum_lycopersicum, crop: @tomato) @planting = FactoryBot.create(:planting, crop: @tomato) diff --git a/spec/views/crops/edit.html.haml_spec.rb b/spec/views/crops/edit.html.haml_spec.rb index f0d8e9251..ba43f645f 100644 --- a/spec/views/crops/edit.html.haml_spec.rb +++ b/spec/views/crops/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "crops/edit" do - before(:each) do + before do controller.stub(:current_user) do FactoryBot.create(:crop_wrangling_member) end diff --git a/spec/views/crops/hierarchy.html.haml_spec.rb b/spec/views/crops/hierarchy.html.haml_spec.rb index 833bb2b98..c1d79f0bb 100644 --- a/spec/views/crops/hierarchy.html.haml_spec.rb +++ b/spec/views/crops/hierarchy.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "crops/hierarchy" do - before(:each) do + before do controller.stub(:current_user) { nil } @tomato = FactoryBot.create(:tomato) @roma = FactoryBot.create(:crop, name: 'Roma tomato', parent: @tomato) diff --git a/spec/views/crops/index.html.haml_spec.rb b/spec/views/crops/index.html.haml_spec.rb index 7d05d18db..7d86653de 100644 --- a/spec/views/crops/index.html.haml_spec.rb +++ b/spec/views/crops/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "crops/index" do - before(:each) do + before do controller.stub(:current_user) { nil } page = 1 per_page = 2 @@ -29,7 +29,7 @@ describe "crops/index" do end context "logged in and crop wrangler" do - before(:each) do + before do @member = FactoryBot.create(:crop_wrangling_member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/crops/index.rss.haml_spec.rb b/spec/views/crops/index.rss.haml_spec.rb index 72a8bbdff..a7afbba7a 100644 --- a/spec/views/crops/index.rss.haml_spec.rb +++ b/spec/views/crops/index.rss.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'crops/index.rss.haml' do - before(:each) do + before do controller.stub(:current_user) { nil } @author = FactoryBot.create(:member) @tomato = FactoryBot.create(:tomato) diff --git a/spec/views/crops/new.html.haml_spec.rb b/spec/views/crops/new.html.haml_spec.rb index 5ce7eefdc..0dcf43624 100644 --- a/spec/views/crops/new.html.haml_spec.rb +++ b/spec/views/crops/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "crops/new" do - before(:each) do + before do @crop = FactoryBot.create(:maize) 3.times do @crop.scientific_names.build diff --git a/spec/views/crops/wrangle.html.haml_spec.rb b/spec/views/crops/wrangle.html.haml_spec.rb index 085060570..8b9814140 100644 --- a/spec/views/crops/wrangle.html.haml_spec.rb +++ b/spec/views/crops/wrangle.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "crops/wrangle" do - before(:each) do + before do @member = FactoryBot.create(:crop_wrangling_member) controller.stub(:current_user) { @member } page = 1 diff --git a/spec/views/devise/confirmations/new_spec.rb b/spec/views/devise/confirmations/new_spec.rb index 720822083..e13c0389e 100644 --- a/spec/views/devise/confirmations/new_spec.rb +++ b/spec/views/devise/confirmations/new_spec.rb @@ -1,5 +1,5 @@ describe 'devise/confirmations/new.html.haml', type: "view" do - before(:each) do + before do @view.stub(:resource).and_return(Member.new) @view.stub(:resource_name).and_return("member") @view.stub(:resource_class).and_return(Member) diff --git a/spec/views/devise/mailer/confirmation_instructions_spec.rb b/spec/views/devise/mailer/confirmation_instructions_spec.rb index d2cce98c4..0dc0c0ddb 100644 --- a/spec/views/devise/mailer/confirmation_instructions_spec.rb +++ b/spec/views/devise/mailer/confirmation_instructions_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe 'devise/mailer/confirmation_instructions.html.haml', type: "view" do context "logged in" do - before(:each) do + before do @resource = FactoryBot.create(:member) render end diff --git a/spec/views/devise/mailer/reset_password_instructions_spec.rb b/spec/views/devise/mailer/reset_password_instructions_spec.rb index fc2ad1bbe..d3b2d4c2d 100644 --- a/spec/views/devise/mailer/reset_password_instructions_spec.rb +++ b/spec/views/devise/mailer/reset_password_instructions_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe 'devise/mailer/reset_password_instructions.html.haml', type: "view" do context "logged in" do - before(:each) do + before do @resource = mock_model(Member) @resource.stub(:email).and_return("example@example.com") @resource.stub(:reset_password_token).and_return("joe") diff --git a/spec/views/devise/mailer/unlock_instructions_spec.rb b/spec/views/devise/mailer/unlock_instructions_spec.rb index 633545cf3..d55b24a0e 100644 --- a/spec/views/devise/mailer/unlock_instructions_spec.rb +++ b/spec/views/devise/mailer/unlock_instructions_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'devise/mailer/unlock_instructions.html.haml', type: "view" do context "logged in" do - before(:each) do + before do @resource = FactoryBot.create(:member) render end diff --git a/spec/views/devise/registrations/edit_spec.rb b/spec/views/devise/registrations/edit_spec.rb index 85ee6588a..b4aeeddde 100644 --- a/spec/views/devise/registrations/edit_spec.rb +++ b/spec/views/devise/registrations/edit_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe 'devise/registrations/edit.html.haml', type: "view" do context "logged in" do - before(:each) do + before do controller.stub(:current_user) { nil } @member = FactoryBot.create(:member) controller.stub(:current_member) { @member } @@ -18,7 +18,7 @@ describe 'devise/registrations/edit.html.haml', type: "view" do end context 'email section' do - before(:each) do + before do render end @@ -32,7 +32,7 @@ describe 'devise/registrations/edit.html.haml', type: "view" do end context 'profile section' do - before(:each) do + before do render end @@ -66,7 +66,7 @@ describe 'devise/registrations/edit.html.haml', type: "view" do end context 'connected to twitter' do - before(:each) do + before do @twitter_auth = FactoryBot.create(:authentication, member: @member) render end @@ -88,7 +88,7 @@ describe 'devise/registrations/edit.html.haml', type: "view" do end context 'connected to flickr' do - before(:each) do + before do @flickr_auth = FactoryBot.create(:flickr_authentication, member: @member) render end diff --git a/spec/views/devise/registrations/new_spec.rb b/spec/views/devise/registrations/new_spec.rb index 48805b806..ad9992cfb 100644 --- a/spec/views/devise/registrations/new_spec.rb +++ b/spec/views/devise/registrations/new_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe 'devise/registrations/new.html.haml', type: "view" do context "logged in" do - before(:each) do + before do @view.stub(:resource).and_return(Member.new) @view.stub(:resource_name).and_return("member") @view.stub(:resource_class).and_return(Member) diff --git a/spec/views/devise/sessions/new_spec.rb b/spec/views/devise/sessions/new_spec.rb index dfe91af2a..2df578b45 100644 --- a/spec/views/devise/sessions/new_spec.rb +++ b/spec/views/devise/sessions/new_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe 'devise/sessions/new.html.haml', type: "view" do context "logged in" do - before(:each) do + before do @view.stub(:resource).and_return(Member.new) @view.stub(:resource_name).and_return("member") @view.stub(:resource_class).and_return(Member) diff --git a/spec/views/devise/unlocks/new_spec.rb b/spec/views/devise/unlocks/new_spec.rb index 60d056d72..04f66d08f 100644 --- a/spec/views/devise/unlocks/new_spec.rb +++ b/spec/views/devise/unlocks/new_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe 'devise/unlocks/new.html.haml', type: "view" do context "logged in" do - before(:each) do + before do @view.stub(:resource).and_return(Member.new) @view.stub(:resource_name).and_return("member") @view.stub(:resource_class).and_return(Member) diff --git a/spec/views/forums/edit.html.haml_spec.rb b/spec/views/forums/edit.html.haml_spec.rb index 77f5cff31..1782bb7b7 100644 --- a/spec/views/forums/edit.html.haml_spec.rb +++ b/spec/views/forums/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "forums/edit" do - before(:each) do + before do @forum = assign(:forum, stub_model(Forum, name: "MyString", description: "MyText", diff --git a/spec/views/forums/index.html.haml_spec.rb b/spec/views/forums/index.html.haml_spec.rb index 02b265e85..7307501fe 100644 --- a/spec/views/forums/index.html.haml_spec.rb +++ b/spec/views/forums/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "forums/index" do - before(:each) do + before do @admin = FactoryBot.create(:admin_member) controller.stub(:current_user) { @admin } @forum1 = FactoryBot.create(:forum) @@ -20,7 +20,7 @@ describe "forums/index" do end context "posts" do - before(:each) do + before do @post = FactoryBot.create(:forum_post, forum: @forum1) @comment = FactoryBot.create(:comment, post: @post) render diff --git a/spec/views/forums/new.html.haml_spec.rb b/spec/views/forums/new.html.haml_spec.rb index 72cd7ae45..4fec098df 100644 --- a/spec/views/forums/new.html.haml_spec.rb +++ b/spec/views/forums/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "forums/new" do - before(:each) do + before do @forum = assign(:forum, FactoryBot.create(:forum)) render end diff --git a/spec/views/forums/show.html.haml_spec.rb b/spec/views/forums/show.html.haml_spec.rb index 08892df58..c40a77a81 100644 --- a/spec/views/forums/show.html.haml_spec.rb +++ b/spec/views/forums/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "forums/show" do - before(:each) do + before do controller.stub(:current_user) { nil } @forum = assign(:forum, FactoryBot.create(:forum)) end diff --git a/spec/views/gardens/edit.html.haml_spec.rb b/spec/views/gardens/edit.html.haml_spec.rb index 1326f1544..a0564bf84 100644 --- a/spec/views/gardens/edit.html.haml_spec.rb +++ b/spec/views/gardens/edit.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe "gardens/edit" do context "logged in" do - before(:each) do + before do @owner = FactoryBot.create(:member) sign_in @owner controller.stub(:current_user) { @owner } diff --git a/spec/views/gardens/new.html.haml_spec.rb b/spec/views/gardens/new.html.haml_spec.rb index 7346997dc..d76659f73 100644 --- a/spec/views/gardens/new.html.haml_spec.rb +++ b/spec/views/gardens/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "gardens/new" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/gardens/show.html.haml_spec.rb b/spec/views/gardens/show.html.haml_spec.rb index 7451f26c8..5fee8fc4e 100644 --- a/spec/views/gardens/show.html.haml_spec.rb +++ b/spec/views/gardens/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "gardens/show" do - before(:each) do + before do @owner = FactoryBot.create(:member) controller.stub(:current_user) { @owner } @garden = FactoryBot.create(:garden, owner: @owner) diff --git a/spec/views/harvests/edit.html.haml_spec.rb b/spec/views/harvests/edit.html.haml_spec.rb index 1193b4284..90df77ebe 100644 --- a/spec/views/harvests/edit.html.haml_spec.rb +++ b/spec/views/harvests/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "harvests/edit" do - before(:each) do + before do assign(:harvest, FactoryBot.create(:harvest)) render end diff --git a/spec/views/harvests/index.html.haml_spec.rb b/spec/views/harvests/index.html.haml_spec.rb index b5ebcfb67..461749f0b 100644 --- a/spec/views/harvests/index.html.haml_spec.rb +++ b/spec/views/harvests/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "harvests/index" do - before(:each) do + before do controller.stub(:current_user) { nil } @member = FactoryBot.create(:member) @tomato = FactoryBot.create(:tomato) diff --git a/spec/views/harvests/index.rss.haml_spec.rb b/spec/views/harvests/index.rss.haml_spec.rb index b0898cf78..3bb73bca1 100644 --- a/spec/views/harvests/index.rss.haml_spec.rb +++ b/spec/views/harvests/index.rss.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'harvests/index.rss.haml' do - before(:each) do + before do controller.stub(:current_user) { nil } @member = FactoryBot.create(:member) @tomato = FactoryBot.create(:tomato) diff --git a/spec/views/harvests/new.html.haml_spec.rb b/spec/views/harvests/new.html.haml_spec.rb index d79055a38..ee8e80a74 100644 --- a/spec/views/harvests/new.html.haml_spec.rb +++ b/spec/views/harvests/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "harvests/new" do - before(:each) do + before do assign(:harvest, FactoryBot.create(:harvest)) render end diff --git a/spec/views/home/_blurb.html.haml_spec.rb b/spec/views/home/_blurb.html.haml_spec.rb index 47244a445..395ce74b0 100644 --- a/spec/views/home/_blurb.html.haml_spec.rb +++ b/spec/views/home/_blurb.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe 'home/_blurb.html.haml', type: "view" do context 'signed out' do - before :each do + before do controller.stub(:current_user) { nil } render end diff --git a/spec/views/home/_members.html.haml_spec.rb b/spec/views/home/_members.html.haml_spec.rb index 76aa434b6..946622d56 100644 --- a/spec/views/home/_members.html.haml_spec.rb +++ b/spec/views/home/_members.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'home/_members.html.haml', type: "view" do - before(:each) do + before do @member = FactoryBot.create(:london_member) @member.updated_at = 2.days.ago assign(:members, [@member]) diff --git a/spec/views/home/_seeds.html.haml_spec.rb b/spec/views/home/_seeds.html.haml_spec.rb index 7b8d6156c..baacfc37e 100644 --- a/spec/views/home/_seeds.html.haml_spec.rb +++ b/spec/views/home/_seeds.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'home/_seeds.html.haml', type: "view" do - before(:each) do + before do @owner = FactoryBot.create(:london_member) @seed = FactoryBot.create(:tradable_seed, owner: @owner) render diff --git a/spec/views/home/index_spec.rb b/spec/views/home/index_spec.rb index 4bc1e9c10..61f40d3f1 100644 --- a/spec/views/home/index_spec.rb +++ b/spec/views/home/index_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'home/index.html.haml', type: "view" do - before(:each) do + before do @member = FactoryBot.create(:london_member) @member.updated_at = 2.days.ago assign(:interesting_members, [@member]) @@ -19,7 +19,7 @@ describe 'home/index.html.haml', type: "view" do end context 'logged out' do - before(:each) do + before do controller.stub(:current_user) { nil } render end @@ -31,7 +31,7 @@ describe 'home/index.html.haml', type: "view" do end context 'signed in' do - before(:each) do + before do sign_in @member controller.stub(:current_user) { @member } render diff --git a/spec/views/layouts/_header_spec.rb b/spec/views/layouts/_header_spec.rb index 58509f589..48963e00d 100644 --- a/spec/views/layouts/_header_spec.rb +++ b/spec/views/layouts/_header_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' describe 'layouts/_header.html.haml', type: "view" do context "when not logged in" do - before(:each) do + before do controller.stub(:current_user) { nil } render end @@ -51,7 +51,7 @@ describe 'layouts/_header.html.haml', type: "view" do end context "logged in" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/layouts/_meta_spec.rb b/spec/views/layouts/_meta_spec.rb index 151c6fe19..1701a2ed4 100644 --- a/spec/views/layouts/_meta_spec.rb +++ b/spec/views/layouts/_meta_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'layouts/_meta.html.haml', type: "view" do - before(:each) do + before do render end diff --git a/spec/views/layouts/application_spec.rb b/spec/views/layouts/application_spec.rb index e706bc575..49d6d70f4 100644 --- a/spec/views/layouts/application_spec.rb +++ b/spec/views/layouts/application_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'layouts/application.html.haml', type: "view" do - before(:each) do + before do controller.stub(:current_user) { nil } end diff --git a/spec/views/members/_location.html.haml_spec.rb b/spec/views/members/_location.html.haml_spec.rb index 50d7b675f..db1fae09c 100644 --- a/spec/views/members/_location.html.haml_spec.rb +++ b/spec/views/members/_location.html.haml_spec.rb @@ -4,7 +4,7 @@ describe "members/_location" do context "member with location" do let(:member) { FactoryBot.create(:london_member) } - before(:each) { render partial: 'members/location', locals: { member: member } } + before { render partial: 'members/location', locals: { member: member } } it 'shows location if available' do expect(rendered).to have_content member.location @@ -16,7 +16,7 @@ describe "members/_location" do end context "member with no location" do - before(:each) do + before do member = FactoryBot.create(:member) render partial: 'members/location', locals: { member: member } end diff --git a/spec/views/members/index.html.haml_spec.rb b/spec/views/members/index.html.haml_spec.rb index 9488fa5df..34fda500f 100644 --- a/spec/views/members/index.html.haml_spec.rb +++ b/spec/views/members/index.html.haml_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe "members/index" do let(:member) { FactoryBot.create(:london_member) } - before(:each) do + before do controller.stub(:current_user) { nil } page = 1 per_page = 2 diff --git a/spec/views/members/show.rss.haml_spec.rb b/spec/views/members/show.rss.haml_spec.rb index 6ee321be4..a0a7414e0 100644 --- a/spec/views/members/show.rss.haml_spec.rb +++ b/spec/views/members/show.rss.haml_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe 'members/show.rss.haml', type: "view" do subject { rendered } - before(:each) do + before do @member = assign(:member, FactoryBot.create(:member, login_name: 'callum')) @post1 = FactoryBot.create(:post, id: 1, author: @member) @post2 = FactoryBot.create(:markdown_post, id: 2, author: @member) diff --git a/spec/views/notifications/index.html.haml_spec.rb b/spec/views/notifications/index.html.haml_spec.rb index 0bb4257fa..d02e43038 100644 --- a/spec/views/notifications/index.html.haml_spec.rb +++ b/spec/views/notifications/index.html.haml_spec.rb @@ -1,13 +1,13 @@ require 'rails_helper' describe "notifications/index" do - before(:each) do + before do @member = FactoryBot.create(:member) controller.stub(:current_user) { @member } end context "ordinary notifications" do - before(:each) do + before do @notification = FactoryBot.create(:notification, sender: @member, recipient: @member) assign(:notifications, Kaminari.paginate_array([@notification, @notification]).page(1)) diff --git a/spec/views/notifications/new.html.haml_spec.rb b/spec/views/notifications/new.html.haml_spec.rb index a7f030f47..242f433e3 100644 --- a/spec/views/notifications/new.html.haml_spec.rb +++ b/spec/views/notifications/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "notifications/new" do - before(:each) do + before do @recipient = FactoryBot.create(:member) @sender = FactoryBot.create(:member) assign(:notification, FactoryBot.create(:notification, recipient_id: @recipient.id, sender_id: @sender.id)) diff --git a/spec/views/notifications/show.html.haml_spec.rb b/spec/views/notifications/show.html.haml_spec.rb index 14db0448c..9f5087f41 100644 --- a/spec/views/notifications/show.html.haml_spec.rb +++ b/spec/views/notifications/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "notifications/show" do - before(:each) do + before do @member = FactoryBot.create(:member) @notification = FactoryBot.create(:notification, recipient: @member) assign(:notification, @notification) diff --git a/spec/views/notifier/notify.html.haml_spec.rb b/spec/views/notifier/notify.html.haml_spec.rb index 913ea10d2..5369bde44 100644 --- a/spec/views/notifier/notify.html.haml_spec.rb +++ b/spec/views/notifier/notify.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'notifier/notify.html.haml', type: "view" do - before(:each) do + before do @notification = FactoryBot.create(:notification) @reply_link = "http://example.com" @signed_message = "EncryptedMessage" diff --git a/spec/views/photos/edit.html.haml_spec.rb b/spec/views/photos/edit.html.haml_spec.rb index d83a1a911..a4491a226 100644 --- a/spec/views/photos/edit.html.haml_spec.rb +++ b/spec/views/photos/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "photos/edit" do - before(:each) do + before do @photo = assign(:photo, stub_model(Photo, owner_id: 1, flickr_photo_id: 1, diff --git a/spec/views/photos/index.html.haml_spec.rb b/spec/views/photos/index.html.haml_spec.rb index b603de1e6..5598de23a 100644 --- a/spec/views/photos/index.html.haml_spec.rb +++ b/spec/views/photos/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "photos/index" do - before(:each) do + before do page = 1 per_page = 2 total_entries = 2 diff --git a/spec/views/photos/new.html.haml_spec.rb b/spec/views/photos/new.html.haml_spec.rb index e4f24f9e4..9f4072ee5 100644 --- a/spec/views/photos/new.html.haml_spec.rb +++ b/spec/views/photos/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "photos/new" do - before(:each) do + before do @member = FactoryBot.create(:member) controller.stub(:current_user) { @member } page = 1 @@ -22,7 +22,7 @@ describe "photos/new" do end context "user has photosets" do - before(:each) do + before do assign(:sets, "foo" => "bar") # Hash of names => IDs end diff --git a/spec/views/photos/show.html.haml_spec.rb b/spec/views/photos/show.html.haml_spec.rb index d727be8a4..8d189db0e 100644 --- a/spec/views/photos/show.html.haml_spec.rb +++ b/spec/views/photos/show.html.haml_spec.rb @@ -45,7 +45,7 @@ describe "photos/show" do end context "signed in as owner" do - before(:each) do + before do controller.stub(:current_user) { member } render end @@ -58,7 +58,7 @@ describe "photos/show" do end context "signed in as another member" do - before(:each) do + before do controller.stub(:current_user) { FactoryBot.create :member } render end @@ -68,7 +68,7 @@ describe "photos/show" do end context "not signed in" do - before(:each) do + before do controller.stub(:current_user) { nil } render end @@ -78,7 +78,7 @@ describe "photos/show" do end context "CC-licensed photo" do - before(:each) do + before do controller.stub(:current_user) { nil } # @photo = assign(:photo, FactoryBot.create(:photo, owner: @member)) @photo.harvests << harvest @@ -95,7 +95,7 @@ describe "photos/show" do end context "unlicensed photo" do - before(:each) do + before do controller.stub(:current_user) { nil } @photo = assign(:photo, FactoryBot.create(:unlicensed_photo)) render diff --git a/spec/views/places/_map_attribution.html.haml_spec.rb b/spec/views/places/_map_attribution.html.haml_spec.rb index 7082290c8..afe384dfe 100644 --- a/spec/views/places/_map_attribution.html.haml_spec.rb +++ b/spec/views/places/_map_attribution.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "places/_map_attribution.html.haml", type: :view do - before(:each) do + before do render end diff --git a/spec/views/places/index.html.haml_spec.rb b/spec/views/places/index.html.haml_spec.rb index f3a3661ae..072eb4ca3 100644 --- a/spec/views/places/index.html.haml_spec.rb +++ b/spec/views/places/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "places/index" do - before(:each) do + before do render end diff --git a/spec/views/places/show.html.haml_spec.rb b/spec/views/places/show.html.haml_spec.rb index 635d06ab9..7f9aa0c9c 100644 --- a/spec/views/places/show.html.haml_spec.rb +++ b/spec/views/places/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "places/show" do - before(:each) do + before do @member = FactoryBot.create(:london_member) @nearby_members = [FactoryBot.create(:member)] controller.stub(:current_user) { @member } diff --git a/spec/views/plant_parts/edit.html.haml_spec.rb b/spec/views/plant_parts/edit.html.haml_spec.rb index 683dd6ab0..3eaa4fbac 100644 --- a/spec/views/plant_parts/edit.html.haml_spec.rb +++ b/spec/views/plant_parts/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "plant_parts/edit" do - before(:each) do + before do @plant_part = assign(:plant_part, stub_model(PlantPart, name: "MyString")) end diff --git a/spec/views/plant_parts/index.html.haml_spec.rb b/spec/views/plant_parts/index.html.haml_spec.rb index 65ecf2d63..b46c4a1a5 100644 --- a/spec/views/plant_parts/index.html.haml_spec.rb +++ b/spec/views/plant_parts/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "plant_parts/index" do - before(:each) do + before do controller.stub(:current_user) { nil } @pp = FactoryBot.create(:plant_part) assign(:plant_parts, [@pp]) diff --git a/spec/views/plant_parts/new.html.haml_spec.rb b/spec/views/plant_parts/new.html.haml_spec.rb index b1b3f12ae..90a1465f4 100644 --- a/spec/views/plant_parts/new.html.haml_spec.rb +++ b/spec/views/plant_parts/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "plant_parts/new" do - before(:each) do + before do assign(:plant_part, stub_model(PlantPart, name: "MyString").as_new_record) end diff --git a/spec/views/plant_parts/show.html.haml_spec.rb b/spec/views/plant_parts/show.html.haml_spec.rb index b367a723b..9947cfcce 100644 --- a/spec/views/plant_parts/show.html.haml_spec.rb +++ b/spec/views/plant_parts/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "plant_parts/show" do - before(:each) do + before do controller.stub(:current_user) { nil } @pp = FactoryBot.create(:plant_part) @harvest = FactoryBot.create(:harvest, plant_part: @pp) diff --git a/spec/views/plantings/_form.html.haml_spec.rb b/spec/views/plantings/_form.html.haml_spec.rb index 8da8f1bfe..c4f6247b0 100644 --- a/spec/views/plantings/_form.html.haml_spec.rb +++ b/spec/views/plantings/_form.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "plantings/_form" do - before(:each) do + before do @member = FactoryBot.create(:member) @garden = FactoryBot.create(:garden, owner: @member) @uppercase = FactoryBot.create(:uppercasecrop) diff --git a/spec/views/plantings/edit.html.haml_spec.rb b/spec/views/plantings/edit.html.haml_spec.rb index 0afa1e829..768434f16 100644 --- a/spec/views/plantings/edit.html.haml_spec.rb +++ b/spec/views/plantings/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "plantings/edit" do - before(:each) do + before do @member = FactoryBot.create(:member, login_name: 'right', email: 'right@example.com') @@ -20,7 +20,7 @@ describe "plantings/edit" do end context "logged in" do - before(:each) do + before do sign_in @member controller.stub(:current_user) { @member } render diff --git a/spec/views/plantings/index.html.haml_spec.rb b/spec/views/plantings/index.html.haml_spec.rb index 3df5b20ff..792c2b5e5 100644 --- a/spec/views/plantings/index.html.haml_spec.rb +++ b/spec/views/plantings/index.html.haml_spec.rb @@ -6,7 +6,7 @@ describe "plantings/index" do let(:tomato) { FactoryBot.create(:tomato) } let(:maize) { FactoryBot.create(:maize) } - before(:each) do + before do controller.stub(:current_user) { nil } page = 1 per_page = 3 diff --git a/spec/views/plantings/index.rss.haml_spec.rb b/spec/views/plantings/index.rss.haml_spec.rb index c4a394561..24faa046c 100644 --- a/spec/views/plantings/index.rss.haml_spec.rb +++ b/spec/views/plantings/index.rss.haml_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' describe 'plantings/index.rss.haml' do - before(:each) do + before do controller.stub(:current_user) { nil } end context 'all plantings' do - before :each do + before do @planting = FactoryBot.create(:planting) @sunny = FactoryBot.create(:sunny_planting) @seedling = FactoryBot.create(:seedling_planting) @@ -36,7 +36,7 @@ describe 'plantings/index.rss.haml' do end context "one person's plantings" do - before :each do + before do @planting = FactoryBot.create(:planting) assign(:plantings, [@planting]) assign(:owner, @planting.owner) diff --git a/spec/views/plantings/new.html.haml_spec.rb b/spec/views/plantings/new.html.haml_spec.rb index 6b6b11f57..418860c86 100644 --- a/spec/views/plantings/new.html.haml_spec.rb +++ b/spec/views/plantings/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "plantings/new" do - before(:each) do + before do @member = FactoryBot.create(:member) controller.stub(:current_user) { @member } @@ -18,7 +18,7 @@ describe "plantings/new" do end context "logged in" do - before(:each) do + before do sign_in @member assign(:planting, Planting.new) assign(:crop, @crop2) diff --git a/spec/views/plantings/show.html.haml_spec.rb b/spec/views/plantings/show.html.haml_spec.rb index 47a742c58..1d12e6f6d 100644 --- a/spec/views/plantings/show.html.haml_spec.rb +++ b/spec/views/plantings/show.html.haml_spec.rb @@ -10,7 +10,7 @@ describe "plantings/show" do planted_from: 'cutting') end - before(:each) do + before do assign(:planting, planting) assign(:photos, planting.photos.paginate(page: 1)) controller.stub(:current_user) { member } @@ -55,7 +55,7 @@ describe "plantings/show" do end context "no location set" do - before(:each) do + before do render end @@ -77,7 +77,7 @@ describe "plantings/show" do end context "location set" do - before(:each) do + before do planting.owner.update(location: 'Greenwich, UK') render end diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index a153995c5..524e1ae9c 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -5,13 +5,13 @@ describe "posts/_single" do render partial: "single", locals: { post: @post } end - before(:each) do + before do @post = FactoryBot.create(:post) controller.stub(:current_user) { nil } end context "when the number of comments doesn't matter" do - before(:each) do + before do render_post end @@ -25,7 +25,7 @@ describe "posts/_single" do end context "when logged in" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } @@ -42,7 +42,7 @@ describe "posts/_single" do end context "when logged in as post author" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } @@ -56,7 +56,7 @@ describe "posts/_single" do end context "when there are no comments" do - before(:each) do + before do render_post end @@ -66,7 +66,7 @@ describe "posts/_single" do end context "when there is 1 comment" do - before(:each) do + before do @comment = FactoryBot.create(:comment, post: @post) render_post end @@ -77,7 +77,7 @@ describe "posts/_single" do end context "when there are 2 comments" do - before(:each) do + before do @comment = FactoryBot.create(:comment, post: @post) @comment2 = FactoryBot.create(:comment, post: @post) render_post @@ -89,7 +89,7 @@ describe "posts/_single" do end context "when comments should be hidden" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } @@ -113,7 +113,7 @@ describe "posts/_single" do end context "when post has been edited" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } @@ -132,7 +132,7 @@ describe "posts/_single" do end context "when comment has been edited" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } @@ -152,7 +152,7 @@ describe "posts/_single" do end context "when post has not been edited" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } @@ -167,7 +167,7 @@ describe "posts/_single" do end context "when comment has not been edited" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/posts/edit.html.haml_spec.rb b/spec/views/posts/edit.html.haml_spec.rb index 8ec056aff..b8a72ca74 100644 --- a/spec/views/posts/edit.html.haml_spec.rb +++ b/spec/views/posts/edit.html.haml_spec.rb @@ -1,14 +1,14 @@ require 'rails_helper' describe "posts/edit" do - before(:each) do + before do controller.stub(:current_user) { nil } @author = FactoryBot.create(:member) @post = assign(:post, FactoryBot.create(:post, author: @author)) end context "logged in" do - before(:each) do + before do sign_in @author render end @@ -29,7 +29,7 @@ describe "posts/edit" do end context "forum specified" do - before(:each) do + before do @forum = assign(:forum, FactoryBot.create(:forum)) assign(:post, FactoryBot.create(:post, forum: @forum, diff --git a/spec/views/posts/index.html.haml_spec.rb b/spec/views/posts/index.html.haml_spec.rb index b2f956904..44508846d 100644 --- a/spec/views/posts/index.html.haml_spec.rb +++ b/spec/views/posts/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "posts/index" do - before(:each) do + before do controller.stub(:current_user) { nil } @author = FactoryBot.create(:member) page = 1 diff --git a/spec/views/posts/index.rss.haml_spec.rb b/spec/views/posts/index.rss.haml_spec.rb index 3d4ec11f2..83576079f 100644 --- a/spec/views/posts/index.rss.haml_spec.rb +++ b/spec/views/posts/index.rss.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'posts/index.rss.haml', type: "view" do - before(:each) do + before do controller.stub(:current_user) { nil } author = FactoryBot.create(:member) @post1 = FactoryBot.create(:post, id: 1, author: author) diff --git a/spec/views/posts/new.html.haml_spec.rb b/spec/views/posts/new.html.haml_spec.rb index 77da034a9..eaef7f5da 100644 --- a/spec/views/posts/new.html.haml_spec.rb +++ b/spec/views/posts/new.html.haml_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe "posts/new" do let(:author) { FactoryBot.create(:member) } - before(:each) do + before do assign(:post, FactoryBot.create(:post, author: author)) # assign(:forum, Forum.new) sign_in author @@ -37,7 +37,7 @@ describe "posts/new" do context "forum specified" do let(:forum) { FactoryBot.create(:forum) } - before(:each) do + before do assign(:forum, forum) assign(:post, FactoryBot.create(:post, forum: forum)) render diff --git a/spec/views/posts/show.html.haml_spec.rb b/spec/views/posts/show.html.haml_spec.rb index 39868b314..2754439d1 100644 --- a/spec/views/posts/show.html.haml_spec.rb +++ b/spec/views/posts/show.html.haml_spec.rb @@ -5,7 +5,7 @@ describe "posts/show" do let(:author) { FactoryBot.create(:member, login_name: 'mary') } - before(:each) do + before do controller.stub(:current_user) { nil } assign(:post, post) end @@ -61,7 +61,7 @@ describe "posts/show" do let(:post) { FactoryBot.create(:html_post, author: author) } let!(:comment) { FactoryBot.create(:comment, post: post) } - before(:each) do + before do @comments = post.comments render end @@ -82,7 +82,7 @@ describe "posts/show" do context "when there is more than one comment" do let(:post) { FactoryBot.create(:html_post, author: author) } - before(:each) do + before do @comment1 = FactoryBot.create(:comment, post: post, body: "F1rst!!!", created_at: Date.new(2010, 5, 17)) @comment3 = FactoryBot.create(:comment, post: post, body: "Th1rd!!!", @@ -112,7 +112,7 @@ describe "posts/show" do context "signed in" do let(:post) { FactoryBot.create(:post, author: author) } - before(:each) do + before do sign_in author controller.stub(:current_user) { author } render diff --git a/spec/views/posts/show.rss.haml_spec.rb b/spec/views/posts/show.rss.haml_spec.rb index c22c4196f..802bebe93 100644 --- a/spec/views/posts/show.rss.haml_spec.rb +++ b/spec/views/posts/show.rss.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe 'posts/show.rss.haml' do - before(:each) do + before do controller.stub(:current_user) { nil } @author = FactoryBot.create(:member) @post = FactoryBot.create(:post) diff --git a/spec/views/roles/edit.html.haml_spec.rb b/spec/views/roles/edit.html.haml_spec.rb index 01def5033..f546c7c21 100644 --- a/spec/views/roles/edit.html.haml_spec.rb +++ b/spec/views/roles/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "roles/edit" do - before(:each) do + before do @role = assign(:role, stub_model(Role, name: "MyString", description: "MyText")) diff --git a/spec/views/roles/index.html.haml_spec.rb b/spec/views/roles/index.html.haml_spec.rb index 8338f3cd9..a666a4ac8 100644 --- a/spec/views/roles/index.html.haml_spec.rb +++ b/spec/views/roles/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "roles/index" do - before(:each) do + before do controller.stub(:current_user) { nil } assign(:roles, [ stub_model(Role, diff --git a/spec/views/roles/new.html.haml_spec.rb b/spec/views/roles/new.html.haml_spec.rb index eab80fa36..d04afacef 100644 --- a/spec/views/roles/new.html.haml_spec.rb +++ b/spec/views/roles/new.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "roles/new" do - before(:each) do + before do assign(:role, stub_model(Role, name: "MyString", description: "MyText").as_new_record) diff --git a/spec/views/roles/show.html.haml_spec.rb b/spec/views/roles/show.html.haml_spec.rb index f6d0b10b3..1f41bb23c 100644 --- a/spec/views/roles/show.html.haml_spec.rb +++ b/spec/views/roles/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "roles/show" do - before(:each) do + before do @role = assign(:role, stub_model(Role, name: "Name", description: "MyText")) diff --git a/spec/views/scientific_names/edit.html.haml_spec.rb b/spec/views/scientific_names/edit.html.haml_spec.rb index 249cd249b..5cf1b6fe6 100644 --- a/spec/views/scientific_names/edit.html.haml_spec.rb +++ b/spec/views/scientific_names/edit.html.haml_spec.rb @@ -5,7 +5,7 @@ describe "scientific_names/edit" do let(:member) { FactoryBot.create(:member) } let(:scientific_name) { FactoryBot.create(:zea_mays, creator: member) } - before(:each) do + before do sign_in member controller.stub(:current_user) { member } assign(:scientific_name, scientific_name) diff --git a/spec/views/scientific_names/index.html.haml_spec.rb b/spec/views/scientific_names/index.html.haml_spec.rb index 4d63ac9e1..9d098e58b 100644 --- a/spec/views/scientific_names/index.html.haml_spec.rb +++ b/spec/views/scientific_names/index.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "scientific_names/index" do - before(:each) do + before do controller.stub(:current_user) { nil } assign(:scientific_names, [ FactoryBot.create(:zea_mays), @@ -22,7 +22,7 @@ describe "scientific_names/index" do end context "logged in and crop wrangler" do - before(:each) do + before do @member = FactoryBot.create(:crop_wrangling_member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/scientific_names/new.html.haml_spec.rb b/spec/views/scientific_names/new.html.haml_spec.rb index 0cf5a4205..1f6320308 100644 --- a/spec/views/scientific_names/new.html.haml_spec.rb +++ b/spec/views/scientific_names/new.html.haml_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' describe "scientific_names/new" do - before(:each) do + before do assign(:scientific_name, FactoryBot.create(:zea_mays)) end context "logged in" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/scientific_names/show.html.haml_spec.rb b/spec/views/scientific_names/show.html.haml_spec.rb index b728df2b3..7bd3f6367 100644 --- a/spec/views/scientific_names/show.html.haml_spec.rb +++ b/spec/views/scientific_names/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "scientific_names/show" do - before(:each) do + before do controller.stub(:current_user) { nil } @scientific_name = assign(:scientific_name, FactoryBot.create(:zea_mays)) @@ -14,7 +14,7 @@ describe "scientific_names/show" do end context 'signed in' do - before :each do + before do @wrangler = FactoryBot.create(:crop_wrangling_member) sign_in @wrangler controller.stub(:current_user) { @wrangler } diff --git a/spec/views/seeds/edit.html.haml_spec.rb b/spec/views/seeds/edit.html.haml_spec.rb index f450d7065..4bc6bf815 100644 --- a/spec/views/seeds/edit.html.haml_spec.rb +++ b/spec/views/seeds/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe "seeds/edit" do - before(:each) do + before do @member = FactoryBot.create(:member) sign_in @member controller.stub(:current_user) { @member } diff --git a/spec/views/seeds/index.rss.haml_spec.rb b/spec/views/seeds/index.rss.haml_spec.rb index 4df8e526c..cfeedd904 100644 --- a/spec/views/seeds/index.rss.haml_spec.rb +++ b/spec/views/seeds/index.rss.haml_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' describe 'seeds/index.rss.haml' do - before(:each) do + before do controller.stub(:current_user) { nil } end context 'all seeds' do - before(:each) do + before do @seed = FactoryBot.create(:seed) @tradable = FactoryBot.create(:tradable_seed) assign(:seeds, [@seed, @tradable]) @@ -35,7 +35,7 @@ describe 'seeds/index.rss.haml' do end context "one member's seeds" do - before(:each) do + before do @seed = FactoryBot.create(:seed) assign(:seeds, [@seed]) assign(:owner, @seed.owner) diff --git a/spec/views/seeds/new.html.haml_spec.rb b/spec/views/seeds/new.html.haml_spec.rb index 3b33cc6c4..2a132c432 100644 --- a/spec/views/seeds/new.html.haml_spec.rb +++ b/spec/views/seeds/new.html.haml_spec.rb @@ -4,7 +4,7 @@ describe "seeds/new" do let!(:seed) { FactoryBot.create(:seed, owner: member) } let!(:member) { FactoryBot.create(:member) } - before(:each) do + before do sign_in member controller.stub(:current_user) { @member } assign(:seed, seed) diff --git a/spec/views/seeds/show.html.haml_spec.rb b/spec/views/seeds/show.html.haml_spec.rb index 114df46fb..2426495be 100644 --- a/spec/views/seeds/show.html.haml_spec.rb +++ b/spec/views/seeds/show.html.haml_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe "seeds/show" do let(:seed) { FactoryBot.create(:seed) } - before(:each) do + before do controller.stub(:current_user) { nil } assign(:seed, seed) assign(:photos, seed.photos.paginate(page: 1)) @@ -20,7 +20,7 @@ describe "seeds/show" do let!(:seed) { FactoryBot.create(:tradable_seed, owner: owner) } let!(:member) { FactoryBot.create(:member) } - before(:each) do + before do assign(:seed, seed) # note current_member is not the owner of this seed sign_in member @@ -47,7 +47,7 @@ describe "seeds/show" do let(:owner) { FactoryBot.create(:member) } let!(:seed) { FactoryBot.create(:tradable_seed, owner: owner) } - before(:each) do + before do sign_in owner controller.stub(:current_user) { owner } assign(:seed, seed) From 29ee362bfa624fdfa06182575c173d5cbe509b72 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 10 Feb 2019 20:02:58 +0000 Subject: [PATCH 09/11] Auto corrected by following Lint Ruby Space --- spec/helpers/crops_helper_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/helpers/crops_helper_spec.rb b/spec/helpers/crops_helper_spec.rb index ef7e062f4..fc34b4a7d 100644 --- a/spec/helpers/crops_helper_spec.rb +++ b/spec/helpers/crops_helper_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe CropsHelper do describe "display_seed_availability" do before do - @member = create :member + @member = create :member @crop = create :tomato end From 689baa85a3f5f45f95c6f488bed9b5a38362edf2 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 10 Feb 2019 09:23:24 +0000 Subject: [PATCH 10/11] Auto corrected by following Lint Ruby RSpec/ExampleWording --- spec/features/gardens/gardens_index_spec.rb | 2 +- .../features/places/searching_a_place_spec.rb | 8 ++--- .../plantings/planting_a_crop_spec.rb | 14 ++++---- spec/helpers/application_helper_spec.rb | 6 ++-- spec/helpers/crops_helper_spec.rb | 6 ++-- spec/lib/actions/oauth_signup_action_spec.rb | 34 +++++++++---------- spec/models/alternate_name_spec.rb | 4 +-- spec/models/crop_spec.rb | 18 +++++----- spec/models/follow_spec.rb | 6 ++-- spec/models/garden_spec.rb | 16 ++++----- spec/models/harvest_spec.rb | 10 +++--- spec/models/member_spec.rb | 12 +++---- spec/models/planting_spec.rb | 18 +++++----- spec/models/post_spec.rb | 12 +++---- spec/models/scientific_name_spec.rb | 6 ++-- spec/models/seed_spec.rb | 12 +++---- spec/support/is_likeable.rb | 2 +- spec/views/devise/confirmations/new_spec.rb | 2 +- .../mailer/confirmation_instructions_spec.rb | 4 +-- .../reset_password_instructions_spec.rb | 2 +- .../devise/mailer/unlock_instructions_spec.rb | 4 +-- spec/views/devise/registrations/edit_spec.rb | 2 +- spec/views/devise/registrations/new_spec.rb | 2 +- spec/views/devise/sessions/new_spec.rb | 2 +- spec/views/devise/shared/_links_spec.rb | 4 +-- spec/views/devise/unlocks/new_spec.rb | 2 +- spec/views/layouts/_header_spec.rb | 18 +++++----- spec/views/layouts/_meta_spec.rb | 8 ++--- spec/views/notifier/notify.html.haml_spec.rb | 10 +++--- .../scientific_names/show.html.haml_spec.rb | 2 +- 30 files changed, 124 insertions(+), 124 deletions(-) diff --git a/spec/features/gardens/gardens_index_spec.rb b/spec/features/gardens/gardens_index_spec.rb index 9f94dccf4..7e0e93781 100644 --- a/spec/features/gardens/gardens_index_spec.rb +++ b/spec/features/gardens/gardens_index_spec.rb @@ -34,7 +34,7 @@ feature "Gardens#index", :js do it "show active garden" do expect(page).to have_text active_garden.name end - it "should not show inactive garden" do + it "does not show inactive garden" do expect(page).not_to have_text inactive_garden.name end it "links to active garden" do diff --git a/spec/features/places/searching_a_place_spec.rb b/spec/features/places/searching_a_place_spec.rb index edbb06e59..fb11308b5 100644 --- a/spec/features/places/searching_a_place_spec.rb +++ b/spec/features/places/searching_a_place_spec.rb @@ -30,23 +30,23 @@ feature "User searches" do search_with "Philippines" end - it "should show that there are nearby seeds, plantings, and members" do + it "shows that there are nearby seeds, plantings, and members" do expect(page).to have_content "Nearby members" expect(page).to have_content "Seeds available for trade near Philippines" expect(page).to have_content "Recent plantings near Philippines" end - it "should go to members' index page" do + it "goes to members' index page" do click_link 'View all members >>' expect(current_path).to eq members_path end - it "should go to plantings' index page" do + it "goes to plantings' index page" do click_link 'View all plantings >>' expect(current_path).to eq plantings_path end - it "should go to seeds' index page" do + it "goes to seeds' index page" do click_link 'View all seeds >>' expect(current_path).to eq seeds_path end diff --git a/spec/features/plantings/planting_a_crop_spec.rb b/spec/features/plantings/planting_a_crop_spec.rb index 9711453a4..0e8a8db4e 100644 --- a/spec/features/plantings/planting_a_crop_spec.rb +++ b/spec/features/plantings/planting_a_crop_spec.rb @@ -64,7 +64,7 @@ feature "Planting a crop", :js, :elasticsearch do @a_future_date = 1.year.from_now.strftime("%Y-%m-%d") end - it "should show that it is not planted yet" do + it "shows that it is not planted yet" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do @@ -80,7 +80,7 @@ feature "Planting a crop", :js, :elasticsearch do expect(page).to have_content "Progress: 0% - not planted yet" end - it "should show that days before maturity is unknown" do + it "shows that days before maturity is unknown" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do @@ -96,7 +96,7 @@ feature "Planting a crop", :js, :elasticsearch do expect(page).to have_content "Progress: Not enough data" end - it "should show that planting is in progress" do + it "shows that planting is in progress" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do @@ -114,7 +114,7 @@ feature "Planting a crop", :js, :elasticsearch do expect(page).not_to have_content "Not enough data" end - it "should show that planting is 100% complete (no date specified)" do + it "shows that planting is 100% complete (no date specified)" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do @@ -132,7 +132,7 @@ feature "Planting a crop", :js, :elasticsearch do expect(page).to have_content "Yes (no date specified)" end - it "should show that planting is 100% complete (date specified)" do + it "shows that planting is 100% complete (date specified)" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do @@ -240,7 +240,7 @@ feature "Planting a crop", :js, :elasticsearch do end describe "Planting sunniness" do - it "should show the a sunny image" do + it "shows the a sunny image" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do @@ -256,7 +256,7 @@ feature "Planting a crop", :js, :elasticsearch do expect(page).to have_css("img[alt='sun']") end - it "should show a sunniness not specified image" do + it "shows a sunniness not specified image" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index b54b792a9..353e6e9b0 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -21,11 +21,11 @@ describe ApplicationHelper do @member = FactoryBot.build(:member, email: 'example@example.com', preferred_avatar_uri: nil) end - it 'should render a gravatar uri' do + it 'renders a gravatar uri' do expect(avatar_uri(@member)).to eq 'http://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8?size=150&default=identicon' end - it 'should render a gravatar uri for a given size' do + it 'renders a gravatar uri for a given size' do expect(avatar_uri(@member, 456)).to eq 'http://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8?size=456&default=identicon' end end @@ -35,7 +35,7 @@ describe ApplicationHelper do @member = FactoryBot.build(:member, email: 'example@example.com', preferred_avatar_uri: 'http://media.catmoji.com/post/ujg/cat-in-hat.jpg') end - it 'should render a the specified uri' do + it 'renders a the specified uri' do expect(avatar_uri(@member)).to eq 'http://media.catmoji.com/post/ujg/cat-in-hat.jpg' end end diff --git a/spec/helpers/crops_helper_spec.rb b/spec/helpers/crops_helper_spec.rb index fc34b4a7d..532019e41 100644 --- a/spec/helpers/crops_helper_spec.rb +++ b/spec/helpers/crops_helper_spec.rb @@ -8,7 +8,7 @@ describe CropsHelper do end context "with no seeds" do - it 'should render' do + it 'renders' do expect(helper.display_seed_availability(@member, @crop)).to eq "You don't have any seeds of this crop." end end @@ -18,7 +18,7 @@ describe CropsHelper do create :seed, crop: @crop, quantity: nil, owner: @member end - it 'should render' do + it 'renders' do expect( helper.display_seed_availability(@member, @crop) ).to eq "You have an unknown quantity of seeds of this crop." @@ -35,7 +35,7 @@ describe CropsHelper do create :seed, crop: a_different_crop, quantity: 3, owner: @member end - it 'should render' do + it 'renders' do expect(helper.display_seed_availability(@member, @crop)).to eq "You have 33 seeds of this crop." end end diff --git a/spec/lib/actions/oauth_signup_action_spec.rb b/spec/lib/actions/oauth_signup_action_spec.rb index e315eb6bb..c6006e7c4 100644 --- a/spec/lib/actions/oauth_signup_action_spec.rb +++ b/spec/lib/actions/oauth_signup_action_spec.rb @@ -37,31 +37,31 @@ describe 'Growstuff::OauthSignupAction' do @authentication.delete end - it 'should create a new user' do + it 'creates a new user' do expect(@action.member_created?).to eq true end - it 'should set the right email' do + it 'sets the right email' do expect(@member.email).to eq @auth['info']['email'] end - it 'should generate a login_name' do + it 'generates a login_name' do expect(@member.login_name).to eq 'JohnnyB' end - it 'should set an avatar' do + it 'sets an avatar' do expect(@member.preferred_avatar_uri).to eq @auth['info']['image'] end - it 'should generate a random password' do + it 'generates a random password' do expect(@member.password).not_to eq nil end - it 'should not agree to the tos' do + it 'does not agree to the tos' do expect(@member.tos_agreement).to eq nil end - it 'should store the uid and provider for the member' do + it 'stores the uid and provider for the member' do expect(@authentication.member.id).to eq @member.id expect(@authentication.provider).to eq 'facebook' expect(@authentication.uid).to eq '123545' @@ -88,23 +88,23 @@ describe 'Growstuff::OauthSignupAction' do @authentication.delete end - it 'should not create a new user' do + it 'does not create a new user' do expect(@action.member_created?).to eq nil end - it 'should locate the existing member by email' do + it 'locates the existing member by email' do expect(@member.id).to eq @existing_member.id end - it 'should not generate a login_name' do + it 'does not generate a login_name' do expect(@member.login_name).to eq 'existing' end - it 'should not change the avatar' do + it 'does not change the avatar' do expect(@member.preferred_avatar_uri).to eq 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg' end - it 'should store the uid and provider for the member' do + it 'stores the uid and provider for the member' do expect(@authentication.member.id).to eq @member.id expect(@authentication.provider).to eq 'facebook' expect(@authentication.uid).to eq '123545' @@ -138,23 +138,23 @@ describe 'Growstuff::OauthSignupAction' do @authentication.delete end - it 'should not create a new user' do + it 'does not create a new user' do expect(@action.member_created?).to eq nil end - it 'should locate the existing member by uid and provider' do + it 'locates the existing member by uid and provider' do expect(@member.id).to eq @existing_member.id end - it 'should not generate a login_name' do + it 'does not generate a login_name' do expect(@member.login_name).to eq 'schrodingerscat' end - it 'should not change the avatar' do + it 'does not change the avatar' do expect(@member.preferred_avatar_uri).to eq 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg' end - it 'should locate the existing uid and provider for the member' do + it 'locates the existing uid and provider for the member' do expect(@authentication.id).to eq @existing_authentication.id end end diff --git a/spec/models/alternate_name_spec.rb b/spec/models/alternate_name_spec.rb index 42b8aa9aa..b7c4303e9 100644 --- a/spec/models/alternate_name_spec.rb +++ b/spec/models/alternate_name_spec.rb @@ -3,11 +3,11 @@ require 'rails_helper' describe AlternateName do let(:an) { FactoryBot.create(:alternate_eggplant) } - it 'should save a basic alternate name' do + it 'saves a basic alternate name' do expect(an.save).to be(true) end - it 'should be possible to add multiple alternate names to a crop' do + it 'is possible to add multiple alternate names to a crop' do crop = an.crop an2 = AlternateName.create( name: "really alternative tomato", diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index 51f120316..3762645a5 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -7,18 +7,18 @@ describe Crop do context 'all fields present' do let(:crop) { FactoryBot.create(:tomato) } - it 'should save a basic crop' do + it 'saves a basic crop' do crop.save.should be(true) end - it 'should be fetchable from the database' do + it 'is fetchable from the database' do crop.save @crop2 = Crop.find_by(name: 'tomato') @crop2.en_wikipedia_url.should eq("http://en.wikipedia.org/wiki/Tomato") @crop2.slug.should eq("tomato") end - it 'should stringify as the system name' do + it 'stringifies as the system name' do crop.save crop.to_s.should eq('tomato') end @@ -30,7 +30,7 @@ describe Crop do end context 'invalid data' do - it 'should not save a crop without a system name' do + it 'does not save a crop without a system name' do crop = FactoryBot.build(:crop, name: nil) expect { crop.save }.to raise_error ActiveRecord::StatementInvalid end @@ -182,7 +182,7 @@ describe Crop do @planting.photos << @planting_photo end - it 'should prefer the planting photo' do + it 'prefers the planting photo' do expect(@crop.default_photo.id).to eq @planting_photo.id end end @@ -553,11 +553,11 @@ describe Crop do tomato.destroy end - it "should delete the association between post and the crop(tomato)" do + it "deletes the association between post and the crop(tomato)" do expect(Post.find(post.id).crops).to eq [maize] end - it "should not delete the posts" do + it "does not delete the posts" do expect(Post.find(post.id)).not_to eq nil end end @@ -577,11 +577,11 @@ describe Crop do end describe "rejecting a crop" do - it "should give reason if a default option" do + it "gives reason if a default option" do expect(rejected_reason.rejection_explanation).to eq "not edible" end - it "should show rejection notes if reason was other" do + it "shows rejection notes if reason was other" do expect(rejected_other.rejection_explanation).to eq "blah blah blah" end end diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index cdef36012..63e397d95 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -24,16 +24,16 @@ describe Follow do @follow = Follow.create(follower_id: @member1.id, followed_id: @member2.id) end - it "should not duplicate follows" do + it "does not duplicate follows" do expect(Follow.create(follower_id: @member1.id, followed_id: @member2.id)).not_to be_valid end - it "should list users in following/follower collections when follow is created" do + it "lists users in following/follower collections when follow is created" do expect(@member1.followed).to include(@member2) expect(@member2.followers).to include(@member1) end - it "should no longer list users in following/follower collections when follow is deleted" do + it "noes longer list users in following/follower collections when follow is deleted" do @follow.destroy expect(@member1.followed).not_to include(@member2) expect(@member2.followers).not_to include(@member1) diff --git a/spec/models/garden_spec.rb b/spec/models/garden_spec.rb index 346e719b5..67c462bb6 100644 --- a/spec/models/garden_spec.rb +++ b/spec/models/garden_spec.rb @@ -4,11 +4,11 @@ describe Garden do let(:owner) { FactoryBot.create(:member, login_name: 'hatupatu') } let(:garden) { FactoryBot.create(:garden, owner: owner, name: 'Springfield Community Garden') } - it "should have a slug" do + it "has a slug" do garden.slug.should match(/hatupatu-springfield-community-garden/) end - it "should have a description" do + it "has a description" do garden.description.should == "This is a **totally** cool garden" end @@ -47,11 +47,11 @@ describe Garden do garden.should_not be_valid end - it "should have an owner" do + it "has an owner" do garden.owner.should be_an_instance_of Member end - it "should stringify as its name" do + it "stringifies as its name" do garden.to_s.should == garden.name end @@ -63,14 +63,14 @@ describe Garden do let(:pear) { FactoryBot.create(:pear) } let(:walnut) { FactoryBot.create(:walnut) } - it "should fetch < 4 featured plantings if insufficient exist" do + it "fetches < 4 featured plantings if insufficient exist" do @p1 = FactoryBot.create(:planting, crop: tomato, garden: garden, owner: garden.owner) @p2 = FactoryBot.create(:planting, crop: maize, garden: garden, owner: garden.owner) expect(garden.featured_plantings).to eq [@p2, @p1] end - it "should fetch most recent 4 featured plantings" do + it "fetches most recent 4 featured plantings" do @p1 = FactoryBot.create(:planting, crop: tomato, garden: garden, owner: garden.owner) @p2 = FactoryBot.create(:planting, crop: maize, garden: garden, owner: garden.owner) @p3 = FactoryBot.create(:planting, crop: chard, garden: garden, owner: garden.owner) @@ -80,7 +80,7 @@ describe Garden do expect(garden.featured_plantings).to eq [@p5, @p4, @p3, @p2] end - it "should skip repeated plantings" do + it "skips repeated plantings" do @p1 = FactoryBot.create(:planting, crop: tomato, garden: garden, owner: garden.owner) @p2 = FactoryBot.create(:planting, crop: maize, garden: garden, owner: garden.owner) @p3 = FactoryBot.create(:planting, crop: chard, garden: garden, owner: garden.owner) @@ -148,7 +148,7 @@ describe Garden do end end - it 'should refuse invalid unit values' do + it 'refuses invalid unit values' do garden = FactoryBot.build(:garden, area_unit: 'not valid') garden.should_not be_valid garden.errors[:area_unit].should include("not valid is not a valid area unit") diff --git a/spec/models/harvest_spec.rb b/spec/models/harvest_spec.rb index 262edd61e..35cb9ba5f 100644 --- a/spec/models/harvest_spec.rb +++ b/spec/models/harvest_spec.rb @@ -52,7 +52,7 @@ describe Harvest do end end - it 'should refuse invalid unit values' do + it 'refuses invalid unit values' do @harvest = FactoryBot.build(:harvest, unit: 'not valid') @harvest.should_not be_valid @harvest.errors[:unit].should include("not valid is not a valid unit") @@ -105,7 +105,7 @@ describe Harvest do end end - it 'should refuse invalid weight unit values' do + it 'refuses invalid weight unit values' do @harvest = FactoryBot.build(:harvest, weight_unit: 'not valid') @harvest.should_not be_valid @harvest.errors[:weight_unit].should include("not valid is not a valid unit") @@ -228,7 +228,7 @@ describe Harvest do end context 'without a photo' do - it 'should have no default photo' do + it 'has no default photo' do expect(@harvest.default_photo).to eq nil end @@ -239,7 +239,7 @@ describe Harvest do @planting.photos << @photo end - it 'should have a default photo' do + it 'has a default photo' do expect(@harvest.default_photo).to eq @photo end end @@ -276,7 +276,7 @@ describe Harvest do @planting.photos << @crop_photo end - it 'should prefer the harvest photo' do + it 'prefers the harvest photo' do expect(@harvest.default_photo).to eq @photo end end diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index 3be3f0287..0f015ae3f 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -20,7 +20,7 @@ describe 'member' do expect(member.bio).to eq 'I love seeds' end - it 'should have a default garden' do + it 'has a default garden' do expect(member.gardens.count).to eq 1 end @@ -28,16 +28,16 @@ describe 'member' do expect(member.show_email).to eq false end - it 'should stringify as the login_name' do + it 'stringifies as the login_name' do expect(member.to_s).to eq 'hinemoa' end - it 'should be able to fetch posts' do + it 'is able to fetch posts' do post = FactoryBot.create(:post, author: member) expect(member.posts).to eq [post] end - it 'should be able to fetch gardens' do + it 'is able to fetch gardens' do expect(member.gardens.first.name).to eq "Garden" end @@ -93,7 +93,7 @@ describe 'member' do context 'no TOS agreement' do let(:member) { FactoryBot.build(:no_tos_member) } - it "should refuse to save a member who hasn't agreed to the TOS" do + it "refuses to save a member who hasn't agreed to the TOS" do member.save.should_not be(true) end end @@ -108,7 +108,7 @@ describe 'member' do end context 'same :login_name' do - it "should not allow two members with the same login_name" do + it "does not allow two members with the same login_name" do FactoryBot.create(:member, login_name: "bob") member = FactoryBot.build(:member, login_name: "bob") member.should_not be_valid diff --git a/spec/models/planting_spec.rb b/spec/models/planting_spec.rb index b84388395..20ce08a24 100644 --- a/spec/models/planting_spec.rb +++ b/spec/models/planting_spec.rb @@ -218,25 +218,25 @@ describe Planting do planting.location.should eq "#{garden_owner.login_name}'s #{garden.name}" end - it "should have a slug" do + it "has a slug" do planting.slug.should match(/^hatupatu-springfield-community-garden-tomato$/) end - it 'should sort in reverse creation order' do + it 'sorts in reverse creation order' do @planting2 = FactoryBot.create(:planting) Planting.first.should eq @planting2 end describe '#planted?' do - it "should be false for future plantings" do + it "is false for future plantings" do planting = FactoryBot.create :planting, planted_at: Time.zone.today + 1 expect(planting.planted?).to eq(false) end - it "should be false for never planted" do + it "is false for never planted" do planting = FactoryBot.create :planting, planted_at: nil expect(planting.planted?).to eq(false) end - it "should be true for past plantings" do + it "is true for past plantings" do planting = FactoryBot.create :planting, planted_at: Time.zone.today - 1 expect(planting.planted?).to eq(true) end @@ -287,7 +287,7 @@ describe Planting do context 'sunniness' do let(:planting) { FactoryBot.create(:sunny_planting) } - it 'should have a sunniness value' do + it 'has a sunniness value' do planting.sunniness.should eq 'sun' end @@ -298,7 +298,7 @@ describe Planting do end end - it 'should refuse invalid sunniness values' do + it 'refuses invalid sunniness values' do @planting = FactoryBot.build(:planting, sunniness: 'not valid') @planting.should_not be_valid @planting.errors[:sunniness].should include("not valid is not a valid sunniness value") @@ -306,7 +306,7 @@ describe Planting do end context 'planted from' do - it 'should have a planted_from value' do + it 'has a planted_from value' do @planting = FactoryBot.create(:seed_planting) @planting.planted_from.should eq 'seed' end @@ -320,7 +320,7 @@ describe Planting do end end - it 'should refuse invalid planted_from values' do + it 'refuses invalid planted_from values' do @planting = FactoryBot.build(:planting, planted_from: 'not valid') @planting.should_not be_valid @planting.errors[:planted_from].should include("not valid is not a valid planting method") diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index f02a7c6a7..7d79a62a7 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -5,7 +5,7 @@ describe Post do it_behaves_like "it is likeable" - it "should have a slug" do + it "has a slug" do post = FactoryBot.create(:post, author: member) time = post.created_at datestr = time.strftime("%Y%m%d") @@ -136,16 +136,16 @@ describe Post do let!(:chard) { FactoryBot.create(:chard) } let!(:post) { FactoryBot.create(:post, body: "[maize](crop)[tomato](crop)[tomato](crop)") } - it "should be generated" do + it "is generated" do expect(tomato.posts).to eq [post] expect(maize.posts).to eq [post] end - it "should not duplicate" do + it "does not duplicate" do expect(post.crops) =~ [tomato, maize] end - it "should be updated when post was modified" do + it "is updated when post was modified" do post.update(body: "[chard](crop)") expect(post.crops).to eq [chard] @@ -159,12 +159,12 @@ describe Post do post.destroy end - it "should delete the association" do + it "deletes the association" do expect(Crop.find(tomato.id).posts).to eq [] expect(Crop.find(maize.id).posts).to eq [] end - it "should not delete the crops" do + it "does not delete the crops" do expect(Crop.find(tomato.id)).not_to eq nil expect(Crop.find(maize.id)).not_to eq nil end diff --git a/spec/models/scientific_name_spec.rb b/spec/models/scientific_name_spec.rb index 872ea6766..0b170812d 100644 --- a/spec/models/scientific_name_spec.rb +++ b/spec/models/scientific_name_spec.rb @@ -4,11 +4,11 @@ describe ScientificName do context 'all fields present' do let(:sn) { FactoryBot.create(:zea_mays) } - it 'should save a basic scientific name' do + it 'saves a basic scientific name' do sn.save.should be(true) end - it 'should be fetchable from the database' do + it 'is fetchable from the database' do sn.save @sn2 = ScientificName.find_by(name: 'Zea mays') @sn2.crop.name.should == 'maize' @@ -21,7 +21,7 @@ describe ScientificName do end context 'invalid data' do - it 'should not save a scientific name without a name' do + it 'does not save a scientific name without a name' do sn = ScientificName.new expect { sn.save! }.to raise_error ActiveRecord::RecordInvalid end diff --git a/spec/models/seed_spec.rb b/spec/models/seed_spec.rb index d2b201972..5991d336b 100644 --- a/spec/models/seed_spec.rb +++ b/spec/models/seed_spec.rb @@ -4,11 +4,11 @@ describe Seed do let(:owner) { FactoryBot.create :owner, login_name: 'tamateapokaiwhenua' } let(:seed) { FactoryBot.build(:seed, owner: owner) } - it 'should save a basic seed' do + it 'saves a basic seed' do seed.save.should be(true) end - it "should have a slug" do + it "has a slug" do seed.save seed.slug.should match(/tamateapokaiwhenua-magic-bean/) end @@ -45,7 +45,7 @@ describe Seed do end end - it 'should refuse invalid tradable_to values' do + it 'refuses invalid tradable_to values' do @seed = FactoryBot.build(:seed, tradable_to: 'not valid') @seed.should_not be_valid @seed.errors[:tradable_to].should include( @@ -54,7 +54,7 @@ describe Seed do ) end - it 'should not allow nil or blank values' do + it 'does not allow nil or blank values' do @seed = FactoryBot.build(:seed, tradable_to: nil) @seed.should_not be_valid @seed = FactoryBot.build(:seed, tradable_to: '') @@ -112,7 +112,7 @@ describe Seed do end end - it 'should refuse invalid organic/GMO/heirloom values' do + it 'refuses invalid organic/GMO/heirloom values' do %i(organic gmo heirloom).each do |field| @seed = FactoryBot.build(:seed, field => 'not valid') @seed.should_not be_valid @@ -120,7 +120,7 @@ describe Seed do end end - it 'should not allow nil or blank values' do + it 'does not allow nil or blank values' do %i(organic gmo heirloom).each do |field| @seed = FactoryBot.build(:seed, field => nil) @seed.should_not be_valid diff --git a/spec/support/is_likeable.rb b/spec/support/is_likeable.rb index ac451bd07..c402d589c 100644 --- a/spec/support/is_likeable.rb +++ b/spec/support/is_likeable.rb @@ -17,7 +17,7 @@ shared_examples "it is likeable" do expect(@likeable.members.length).to eq 2 end - it 'should destroy the like when it is destroyed' do + it 'destroys the like when it is destroyed' do like_count = -1 * @likeable.likes.count expect { @likeable.destroy }.to change(Like, :count).by like_count end diff --git a/spec/views/devise/confirmations/new_spec.rb b/spec/views/devise/confirmations/new_spec.rb index e13c0389e..de26a4ad8 100644 --- a/spec/views/devise/confirmations/new_spec.rb +++ b/spec/views/devise/confirmations/new_spec.rb @@ -7,7 +7,7 @@ describe 'devise/confirmations/new.html.haml', type: "view" do render end - it 'should contain a login field' do + it 'contains a login field' do rendered.should have_content "Enter either your login name or your email address" end end diff --git a/spec/views/devise/mailer/confirmation_instructions_spec.rb b/spec/views/devise/mailer/confirmation_instructions_spec.rb index 0dc0c0ddb..08e411796 100644 --- a/spec/views/devise/mailer/confirmation_instructions_spec.rb +++ b/spec/views/devise/mailer/confirmation_instructions_spec.rb @@ -7,11 +7,11 @@ describe 'devise/mailer/confirmation_instructions.html.haml', type: "view" do render end - it 'should have a confirmation link' do + it 'has a confirmation link' do rendered.should have_content 'Confirm my account' end - it 'should have a link to the homepage' do + it 'has a link to the homepage' do rendered.should have_content root_url end end diff --git a/spec/views/devise/mailer/reset_password_instructions_spec.rb b/spec/views/devise/mailer/reset_password_instructions_spec.rb index d3b2d4c2d..ef90f7589 100644 --- a/spec/views/devise/mailer/reset_password_instructions_spec.rb +++ b/spec/views/devise/mailer/reset_password_instructions_spec.rb @@ -9,7 +9,7 @@ describe 'devise/mailer/reset_password_instructions.html.haml', type: "view" do render end - it 'should have some of the right text' do + it 'has some of the right text' do rendered.should have_content 'Change my password' rendered.should have_content 'Someone has requested a link to reset your password' end diff --git a/spec/views/devise/mailer/unlock_instructions_spec.rb b/spec/views/devise/mailer/unlock_instructions_spec.rb index d55b24a0e..d3ac3357d 100644 --- a/spec/views/devise/mailer/unlock_instructions_spec.rb +++ b/spec/views/devise/mailer/unlock_instructions_spec.rb @@ -6,11 +6,11 @@ describe 'devise/mailer/unlock_instructions.html.haml', type: "view" do render end - it "should explain what's happened" do + it "explains what's happened" do rendered.should have_content "account has been locked" end - it "should have an unlock link" do + it "has an unlock link" do rendered.should have_content "Unlock my account" end end diff --git a/spec/views/devise/registrations/edit_spec.rb b/spec/views/devise/registrations/edit_spec.rb index b4aeeddde..b260d13a8 100644 --- a/spec/views/devise/registrations/edit_spec.rb +++ b/spec/views/devise/registrations/edit_spec.rb @@ -12,7 +12,7 @@ describe 'devise/registrations/edit.html.haml', type: "view" do @view.stub(:devise_mapping).and_return(Devise.mappings[:member]) end - it 'should have some fields' do + it 'has some fields' do render rendered.should have_content 'Email' end diff --git a/spec/views/devise/registrations/new_spec.rb b/spec/views/devise/registrations/new_spec.rb index ad9992cfb..0ee95b5b0 100644 --- a/spec/views/devise/registrations/new_spec.rb +++ b/spec/views/devise/registrations/new_spec.rb @@ -10,7 +10,7 @@ describe 'devise/registrations/new.html.haml', type: "view" do render end - it 'should have some fields' do + it 'has some fields' do rendered.should have_content 'Email' end diff --git a/spec/views/devise/sessions/new_spec.rb b/spec/views/devise/sessions/new_spec.rb index 2df578b45..d8ae1c480 100644 --- a/spec/views/devise/sessions/new_spec.rb +++ b/spec/views/devise/sessions/new_spec.rb @@ -10,7 +10,7 @@ describe 'devise/sessions/new.html.haml', type: "view" do render end - it 'should have some fields' do + it 'has some fields' do rendered.should have_content 'Remember me' rendered.should have_content 'Password' end diff --git a/spec/views/devise/shared/_links_spec.rb b/spec/views/devise/shared/_links_spec.rb index 39147113f..c19101593 100644 --- a/spec/views/devise/shared/_links_spec.rb +++ b/spec/views/devise/shared/_links_spec.rb @@ -9,14 +9,14 @@ describe 'devise/shared/_links.haml', type: "view" do dm end - it 'should have a sign-in link if not in sessions' do + it 'has a sign-in link if not in sessions' do @view.stub(:controller_name).and_return("anything but sessions") @view.stub(:resource_name).and_return("member") @view.stub(devise_mapping: devise_mapping(false, false, false, false, false)) render end - it "shouldn't have a sign-in link if in sessions" do + it "does not have a sign-in link if in sessions" do @view.stub(:controller_name).and_return("sessions") @view.stub(:resource_name).and_return("member") @view.stub(devise_mapping: devise_mapping(false, false, false, false, false)) diff --git a/spec/views/devise/unlocks/new_spec.rb b/spec/views/devise/unlocks/new_spec.rb index 04f66d08f..ba1e11215 100644 --- a/spec/views/devise/unlocks/new_spec.rb +++ b/spec/views/devise/unlocks/new_spec.rb @@ -10,7 +10,7 @@ describe 'devise/unlocks/new.html.haml', type: "view" do render end - it 'should have some fields' do + it 'has some fields' do rendered.should have_content 'Email' end end diff --git a/spec/views/layouts/_header_spec.rb b/spec/views/layouts/_header_spec.rb index 48963e00d..f4521ee88 100644 --- a/spec/views/layouts/_header_spec.rb +++ b/spec/views/layouts/_header_spec.rb @@ -11,7 +11,7 @@ describe 'layouts/_header.html.haml', type: "view" do assert_select("a.navbar-brand img[src]", href: root_path) end - it 'should have signup/signin links' do + it 'has signup/signin links' do rendered.should have_content 'Sign up' rendered.should have_content 'Sign in' end @@ -59,34 +59,34 @@ describe 'layouts/_header.html.haml', type: "view" do end context "login name" do - it 'should have member login name' do + it 'has member login name' do rendered.should have_content @member.login_name.to_s end - it "should show link to member's gardens" do + it "shows link to member's gardens" do assert_select("a[href='#{member_gardens_path(@member)}']", "Gardens") end - it "should show link to member's plantings" do + it "shows link to member's plantings" do assert_select("a[href='#{member_plantings_path(@member)}']", "Plantings") end - it "should show link to member's seeds" do + it "shows link to member's seeds" do assert_select("a[href='#{member_seeds_path(@member)}']", "Seeds") end - it "should show link to member's posts" do + it "shows link to member's posts" do assert_select("a[href='#{member_posts_path(@member)}']", "Posts") end end - it 'should show signout link' do + it 'shows signout link' do rendered.should have_content 'Sign out' end - it 'should show inbox link' do + it 'shows inbox link' do rendered.should have_content 'Inbox' rendered.should_not match(/Inbox \(\d+\)/) end context 'has notifications' do - it 'should show inbox count' do + it 'shows inbox count' do FactoryBot.create(:notification, recipient: @member) render rendered.should have_content 'Inbox (1)' diff --git a/spec/views/layouts/_meta_spec.rb b/spec/views/layouts/_meta_spec.rb index 1701a2ed4..2f729083e 100644 --- a/spec/views/layouts/_meta_spec.rb +++ b/spec/views/layouts/_meta_spec.rb @@ -5,22 +5,22 @@ describe 'layouts/_meta.html.haml', type: "view" do render end - it 'should have a Posts RSS feed' do + it 'has a Posts RSS feed' do posts_rss = url_for(controller: 'posts', format: 'rss', only_path: false) assert_select "head>link[href='#{posts_rss}']" end - it 'should have a Crops RSS feed' do + it 'has a Crops RSS feed' do crops_rss = url_for(controller: 'crops', format: 'rss', only_path: false) assert_select "head>link[href='#{crops_rss}']" end - it 'should have a Plantings RSS feed' do + it 'has a Plantings RSS feed' do plantings_rss = url_for(controller: 'plantings', format: 'rss', only_path: false) assert_select "head>link[href='#{plantings_rss}']" end - it 'should have a title' do + it 'has a title' do assert_select "head>title" end end diff --git a/spec/views/notifier/notify.html.haml_spec.rb b/spec/views/notifier/notify.html.haml_spec.rb index 5369bde44..39b52e603 100644 --- a/spec/views/notifier/notify.html.haml_spec.rb +++ b/spec/views/notifier/notify.html.haml_spec.rb @@ -9,24 +9,24 @@ describe 'notifier/notify.html.haml', type: "view" do render end - it 'should say that you have a message' do + it 'says that you have a message' do rendered.should have_content 'You have received a message' end - it 'should include notification metadata' do + it 'includes notification metadata' do rendered.should have_content @notification.sender.login_name rendered.should have_content @notification.post.subject end - it 'should include a reply link' do + it 'includes a reply link' do assert_select "a[href='#{@reply_link}']", text: /Reply/ end - it 'should contain a link to your inbox' do + it 'contains a link to your inbox' do assert_select "a[href*='notifications']" end - it 'should have fully qualified URLs' do + it 'has fully qualified URLs' do # lots of lovely fully qualified URLs assert_select "a[href^='http']", minimum: 4 # no relative URLs starting with / diff --git a/spec/views/scientific_names/show.html.haml_spec.rb b/spec/views/scientific_names/show.html.haml_spec.rb index 7bd3f6367..c8e64a6dc 100644 --- a/spec/views/scientific_names/show.html.haml_spec.rb +++ b/spec/views/scientific_names/show.html.haml_spec.rb @@ -21,7 +21,7 @@ describe "scientific_names/show" do render end - it 'should have an edit button' do + it 'has an edit button' do rendered.should have_content 'Edit' end end From 3efc0caaf78469166b1e0bf1de4f6b98124e80f0 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 10 Feb 2019 18:39:08 +0000 Subject: [PATCH 11/11] Auto corrected by following Lint Ruby EmptyLine --- spec/controllers/comments_controller_spec.rb | 1 - spec/features/signout_spec.rb | 1 - spec/models/crop_spec.rb | 1 - 3 files changed, 3 deletions(-) diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index 8181f4483..2961288dc 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -40,7 +40,6 @@ describe CommentsController do expect(assigns(:post)).to eq(post) end - it "assigns the old comments as @comments" do expect(assigns(:comments)).to eq [old_comment] end diff --git a/spec/features/signout_spec.rb b/spec/features/signout_spec.rb index d94631c67..2b020a4c2 100644 --- a/spec/features/signout_spec.rb +++ b/spec/features/signout_spec.rb @@ -30,7 +30,6 @@ feature "signout" do end end - describe 'after signout, redirect to signin page if page needs authentication' do include_examples "sign-in redirects", "/plantings/new" include_examples "sign-in redirects", "/harvests/new" diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index 3762645a5..35a429656 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -336,7 +336,6 @@ describe Crop do end end - context "harvests" do let(:h1) { FactoryBot.create(:harvest, crop: maize, plant_part: pp1) } let(:h2) { FactoryBot.create(:harvest, crop: maize, plant_part: pp2) }