diff --git a/spec/features/admin/forums_spec.rb b/spec/features/admin/forums_spec.rb index 7f4eb2d40..87f44f26d 100644 --- a/spec/features/admin/forums_spec.rb +++ b/spec/features/admin/forums_spec.rb @@ -1,15 +1,15 @@ require 'rails_helper' -describe "forums", js: true do +feature "forums", js: true do context "as an admin user" do let(:member) { create :admin_member } let(:forum) { create :forum } - before do + background do login_as member end - it "navigating to forum admin without js", js: false do + scenario "navigating to forum admin without js", js: false do visit root_path click_link "Admin" expect(current_path).to eq admin_path @@ -20,7 +20,7 @@ describe "forums", js: true do expect(page).to have_content "New forum" end - it "navigating to forum admin with js" do + scenario "navigating to forum admin with js" do visit root_path click_link member.login_name click_link "Admin" @@ -32,7 +32,7 @@ describe "forums", js: true do expect(page).to have_content "New forum" end - it "adding a forum" do + scenario "adding a forum" do visit forums_path click_link "New forum" expect(current_path).to eq new_forum_path @@ -43,7 +43,7 @@ describe "forums", js: true do expect(page).to have_content 'Forum was successfully created' end - it 'editing forum' do + scenario 'editing forum' do visit forum_path forum click_link 'Edit' fill_in 'Name', with: 'Something else' @@ -54,7 +54,7 @@ describe "forums", js: true do expect(page).to have_content 'Something else' end - it 'deleting forum' do + scenario 'deleting forum' do visit forum_path forum click_link 'Delete' expect(current_path).to eq forums_path diff --git a/spec/features/cms_spec.rb b/spec/features/cms_spec.rb index 00c27a529..176c531a8 100644 --- a/spec/features/cms_spec.rb +++ b/spec/features/cms_spec.rb @@ -1,16 +1,16 @@ require 'rails_helper' -describe "cms admin" do +feature "cms admin" do let(:member) { create :member } let(:admin_member) { create :admin_member } - it "can't view CMS admin if not signed in" do + scenario "can't view CMS admin if not signed in" do visit comfy_admin_cms_path expect(current_path).to eq root_path expect(page).to have_content "Please sign in as an admin user" end - it "can't view CMS admin if not an admin member" do + scenario "can't view CMS admin if not an admin member" do # sign in as an ordinary member login_as member visit comfy_admin_cms_path @@ -18,7 +18,7 @@ describe "cms admin" do expect(page).to have_content "Please sign in as an admin user" end - it "admin members can view CMS admin area" do + scenario "admin members can view CMS admin area" do login_as admin_member visit comfy_admin_cms_path expect(current_path).to match(/#{comfy_admin_cms_path}/) # match any CMS admin page diff --git a/spec/features/comments/commenting_a_comment_spec.rb b/spec/features/comments/commenting_a_comment_spec.rb index 1b8e27e4d..75024ffb6 100644 --- a/spec/features/comments/commenting_a_comment_spec.rb +++ b/spec/features/comments/commenting_a_comment_spec.rb @@ -1,15 +1,15 @@ require 'rails_helper' -describe 'Commenting on a post' do +feature 'Commenting on a post' do let(:member) { create :member } let(:post) { create :post, author: member } - before do + background do login_as member visit new_comment_path post_id: post.id end - it "creating a comment" do + scenario "creating a comment" do fill_in "comment_body", with: "This is a sample test for comment" click_button "Post comment" expect(page).to have_content "comment was successfully created." @@ -19,11 +19,11 @@ describe 'Commenting on a post' do context "editing a comment" do let(:existing_comment) { create :comment, post: post, author: member } - before do + background do visit edit_comment_path existing_comment end - it "saving edit" do + scenario "saving edit" do fill_in "comment_body", with: "Testing edit for comment" click_button "Post comment" expect(page).to have_content "comment was successfully updated." diff --git a/spec/features/crops/alternate_name_spec.rb b/spec/features/crops/alternate_name_spec.rb index 7f38092fc..e3b36c4a8 100644 --- a/spec/features/crops/alternate_name_spec.rb +++ b/spec/features/crops/alternate_name_spec.rb @@ -1,16 +1,16 @@ require 'rails_helper' -describe "Alternate names", js: true do +feature "Alternate names", js: true do let!(:alternate_eggplant) { create :alternate_eggplant } let(:crop) { alternate_eggplant.crop } - it "Display alternate names on crop page" do + scenario "Display alternate names on crop page" do visit crop_path(alternate_eggplant.crop) expect(page.status_code).to equal 200 expect(page).to have_content alternate_eggplant.name end - it "Index page for alternate names" do + scenario "Index page for alternate names" do visit alternate_names_path expect(page).to have_content alternate_eggplant.name end @@ -19,11 +19,11 @@ describe "Alternate names", js: true do let!(:crop_wranglers) { create_list :crop_wrangling_member, 3 } let(:member) { crop_wranglers.first } - before do + background do login_as member end - it "Crop wranglers can edit alternate names" do + scenario "Crop wranglers can edit alternate names" do visit crop_path(crop) expect(page.status_code).to equal 200 expect(page).to have_content "CROP WRANGLER" @@ -39,7 +39,7 @@ describe "Alternate names", js: true do expect(page).to have_content 'Alternate name was successfully updated' end - it "Crop wranglers can delete alternate names" do + scenario "Crop wranglers can delete alternate names" do visit crop_path(alternate_eggplant.crop) expect(page).to have_link "Delete", href: alternate_name_path(alternate_eggplant) @@ -49,7 +49,7 @@ describe "Alternate names", js: true do expect(page).to have_content 'Alternate name was successfully deleted' end - it "Crop wranglers can add alternate names" do + scenario "Crop wranglers can add alternate names" do visit crop_path(crop) expect(page).to have_link "Add", href: new_alternate_name_path(crop_id: crop.id) @@ -63,7 +63,7 @@ describe "Alternate names", js: true do expect(page).to have_content 'Alternate name was successfully created' end - it "The show-alternate-name page works" do + scenario "The show-alternate-name page works" do visit alternate_name_path(alternate_eggplant) expect(page.status_code).to equal 200 expect(page).to have_content alternate_eggplant.crop.name @@ -73,7 +73,7 @@ describe "Alternate names", js: true do let(:rejected_crop) { create :rejected_crop } let(:pending_alt_name) { create :alternate_name, crop: rejected_crop } - it "Displays crop rejection message" do + scenario "Displays crop rejection message" do visit alternate_name_path(pending_alt_name) expect(page).to have_content "This crop was rejected for the following reason: Totally fake" end diff --git a/spec/features/crops/browse_crops_spec.rb b/spec/features/crops/browse_crops_spec.rb index b58e0e5e8..72e63c8fd 100644 --- a/spec/features/crops/browse_crops_spec.rb +++ b/spec/features/crops/browse_crops_spec.rb @@ -1,28 +1,28 @@ require 'rails_helper' -describe "browse crops" do +feature "browse crops" do let(:tomato) { create :tomato } let(:maize) { create :maize } let(:pending_crop) { create :crop_request } let(:rejected_crop) { create :rejected_crop } - it "has a form for sorting by" do + scenario "has a form for sorting by" do visit crops_path expect(page).to have_css "select#sort" end - it "shows a list of crops" do + scenario "shows a list of crops" do crop1 = tomato visit crops_path expect(page).to have_content crop1.name end - it "pending crops are not listed" do + scenario "pending crops are not listed" do visit crops_path expect(page).not_to have_content pending_crop.name end - it "rejected crops are not listed" do + scenario "rejected crops are not listed" do visit crops_path expect(page).not_to have_content rejected_crop.name end diff --git a/spec/features/crops/creating_a_crop_spec.rb b/spec/features/crops/creating_a_crop_spec.rb index 09ed63df6..2b1300485 100644 --- a/spec/features/crops/creating_a_crop_spec.rb +++ b/spec/features/crops/creating_a_crop_spec.rb @@ -1,15 +1,15 @@ require 'rails_helper' -describe "Crop - " do +feature "Crop - " do let!(:crop_wrangler) { create :crop_wrangling_member } let!(:member) { create :member } - before do + background do login_as member visit new_crop_path end - it "creating a crop with multiple scientific and alternate name", :js do + scenario "creating a crop with multiple scientific and alternate name", :js do within "form#new_crop" do fill_in "crop_name", with: "Philippine flower" fill_in "en_wikipedia_url", with: "https://en.wikipedia.org/wiki/Jasminum_sambac" diff --git a/spec/features/crops/crop_detail_page_spec.rb b/spec/features/crops/crop_detail_page_spec.rb index f11b64e78..b7dca2e8d 100644 --- a/spec/features/crops/crop_detail_page_spec.rb +++ b/spec/features/crops/crop_detail_page_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "crop detail page", js: true do +feature "crop detail page", js: true do subject do # Update the medians after all the # data has been loaded @@ -13,7 +13,7 @@ describe "crop detail page", js: true do let(:crop) { create :crop } context "varieties" do - it "The crop DOES NOT have varieties" do + scenario "The crop DOES NOT have varieties" do visit crop_path(crop) within ".varieties" do @@ -22,7 +22,7 @@ describe "crop detail page", js: true do end end - it "The crop has one variety" do + scenario "The crop has one variety" do create :crop, name: 'Roma tomato 1', parent: crop subject @@ -41,7 +41,7 @@ describe "crop detail page", js: true do let!(:roma3) { create :crop, name: 'Roma tomato 3', parent: crop } let!(:roma4) { create :crop, name: 'Roma tomato 4', parent: crop } - it "The crop has 4 varieties" do + scenario "The crop has 4 varieties" do subject within ".varieties" do @@ -52,7 +52,7 @@ describe "crop detail page", js: true do end end - it "The crop has 5 varieties, including grandchild", js: true do + scenario "The crop has 5 varieties, including grandchild", js: true do create :crop, name: 'Roma tomato child 1', parent: roma4 subject @@ -96,54 +96,54 @@ describe "crop detail page", js: true do context "signed in member" do let(:member) { create :member } - before do + background do login_as(member) end context "action buttons" do - before { subject } + background { subject } - it "has a link to plant the crop" do + scenario "has a link to plant the crop" do expect(page).to have_link "Plant this", href: new_planting_path(crop_id: crop.id) end - it "has a link to harvest the crop" do + scenario "has a link to harvest the crop" do expect(page).to have_link "Harvest this", href: new_harvest_path(crop_id: crop.id) end - it "has a link to add seeds" do + scenario "has a link to add seeds" do expect(page).to have_link "Add seeds to stash", href: new_seed_path(crop_id: crop.id) end end context "SEO" do - before { subject } + background { subject } - it "has seed heading with SEO" do + scenario "has seed heading with SEO" do expect(page).to have_content "Find #{crop.name} seeds" end - it "has harvest heading with SEO" do + scenario "has harvest heading with SEO" do expect(page).to have_content "#{crop.name.capitalize} harvests" end - it "has planting heading with SEO" do + scenario "has planting heading with SEO" do expect(page).to have_content "See who's planted #{crop.name.pluralize}" end - it "has planting advice with SEO" do + scenario "has planting advice with SEO" do expect(page).to have_content "How to grow #{crop.name}" end - it "has a link to Wikipedia with SEO" do + scenario "has a link to Wikipedia with SEO" do expect(page).to have_content "Learn more about #{crop.name}" expect(page).to have_link "Wikipedia (English)", href: crop.en_wikipedia_url end - it "has a link to OpenFarm" do + scenario "has a link to OpenFarm" do expect(page).to have_link "OpenFarm - Growing guide", href: "https://openfarm.cc/en/crops/#{URI.escape crop.name}" end - it "has a link to gardenate" do + scenario "has a link to gardenate" do expect(page).to have_link "Gardenate - Planting reminders", href: "http://www.gardenate.com/plant/#{URI.escape crop.name}" end @@ -154,21 +154,21 @@ describe "crop detail page", js: true do let(:member) { create :member } let(:seed) { create :seed, crop: crop, quantity: 20, owner: member } - it "User not signed in" do + scenario "User not signed in" do visit crop_path(seed.crop) expect(page).not_to have_content "You have 20 seeds of this crop" expect(page).not_to have_content "You don't have any seeds of this crop" expect(page).not_to have_link "View your seeds" end - it "User signed in" do + scenario "User signed in" do login_as(member) visit crop_path(seed.crop) expect(page).to have_content "You have 20 seeds of this crop." expect(page).to have_link "View your seeds" end - it "click link to your owned seeds" do + scenario "click link to your owned seeds" do login_as(member) visit crop_path(seed.crop) click_link "View your seeds" diff --git a/spec/features/crops/crop_photos_spec.rb b/spec/features/crops/crop_photos_spec.rb index 1351ec39b..ccc5288f0 100644 --- a/spec/features/crops/crop_photos_spec.rb +++ b/spec/features/crops/crop_photos_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "crop detail page", js: true do +feature "crop detail page", js: true do subject { page } let(:member) { create :member } @@ -44,11 +44,11 @@ describe "crop detail page", js: true do end context "when signed in" do - before { login_as(create(:member)) } + background { login_as(create(:member)) } include_examples "shows photos" end context "when signed in as photos owner" do - before { login_as(member) } + background { login_as(member) } include_examples "shows photos" end context "when not signed in " do diff --git a/spec/features/crops/crop_search_spec.rb b/spec/features/crops/crop_search_spec.rb index 1f42fc868..f2f86980c 100644 --- a/spec/features/crops/crop_search_spec.rb +++ b/spec/features/crops/crop_search_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe "crop search" do - it "search results show the search term in title" do +feature "crop search" do + scenario "search results show the search term in title" do visit root_path within "form#navbar-search" do fill_in "term", with: "tomato" @@ -10,12 +10,12 @@ describe "crop search" do expect(page).to have_css "h1", text: "Crops matching \"tomato\"" end - it "search page with no search term shows suitable title" do + scenario "search page with no search term shows suitable title" do visit crops_search_path expect(page).to have_css "h1", text: "Crop search" end - it "search page has a search form on it" do + scenario "search page has a search form on it" do visit crops_search_path expect(page).to have_css "form#crop-search" end diff --git a/spec/features/crops/crop_wranglers_spec.rb b/spec/features/crops/crop_wranglers_spec.rb index d9f85309a..eafc7039f 100644 --- a/spec/features/crops/crop_wranglers_spec.rb +++ b/spec/features/crops/crop_wranglers_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "crop wranglers", js: true do +feature "crop wranglers", js: true do context "signed in wrangler" do let!(:crop_wranglers) { create_list :crop_wrangling_member, 3 } let(:wrangler) { crop_wranglers.first } @@ -8,9 +8,9 @@ describe "crop wranglers", js: true do let!(:requested_crop) { create :crop_request } let!(:rejected_crop) { create :rejected_crop } - before { login_as wrangler } + background { login_as wrangler } - it "sees crop wranglers listed on the crop wrangler page" do + scenario "sees crop wranglers listed on the crop wrangler page" do visit root_path click_link wrangler.login_name click_link 'Crop Wrangling' @@ -23,7 +23,7 @@ describe "crop wranglers", js: true do end end - it "can see list of crops with extra detail of who created a crop" do + scenario "can see list of crops with extra detail of who created a crop" do visit root_path click_link wrangler.login_name click_link 'Crop Wrangling' @@ -32,14 +32,14 @@ describe "crop wranglers", js: true do end end - it "visiting a crop can see wrangler links" do + scenario "visiting a crop can see wrangler links" do visit crop_path(crops.first) expect(page).to have_content 'You are a CROP WRANGLER' expect(page).to have_link 'Edit crop' expect(page).to have_link 'Delete crop' end - it "can create a new crop" do + scenario "can create a new crop" do visit root_path click_link wrangler.login_name click_link 'Crop Wrangling' @@ -52,13 +52,13 @@ describe "crop wranglers", js: true do expect(page).to have_content 'planticus maximus' end - it "View pending crops" do + scenario "View pending crops" do visit crop_path(requested_crop) expect(page).to have_content "This crop is currently pending approval." expect(page).to have_content "Please approve this even though it's fake." end - it "View rejected crops" do + scenario "View rejected crops" do visit crop_path(rejected_crop) expect(page).to have_content "This crop was rejected for the following reason: Totally fake" end @@ -68,14 +68,14 @@ describe "crop wranglers", js: true do let!(:crop_wranglers) { create_list :crop_wrangling_member, 3 } let(:member) { create :member } - before { login_as member } + background { login_as member } - it "can't see wrangling page without js", js: false do + scenario "can't see wrangling page without js", js: false do visit root_path expect(page).not_to have_link "Crop Wrangling" end - it "can't see wrangling page with js" do + scenario "can't see wrangling page with js" do visit root_path click_link member.login_name expect(page).not_to have_link "Crop Wrangling" diff --git a/spec/features/crops/crop_wrangling_button_spec.rb b/spec/features/crops/crop_wrangling_button_spec.rb index fbe200934..ede88f003 100644 --- a/spec/features/crops/crop_wrangling_button_spec.rb +++ b/spec/features/crops/crop_wrangling_button_spec.rb @@ -1,27 +1,27 @@ require 'rails_helper' -describe "crop wrangling button" do +feature "crop wrangling button" do let(:crop_wrangler) { create :crop_wrangling_member } let(:member) { create :member } context "crop wrangling button" do - before do + background do login_as crop_wrangler visit crops_path end - it "has a link to crop wrangling page" do + scenario "has a link to crop wrangling page" do expect(page).to have_link "Wrangle Crops", href: wrangle_crops_path end end context "crop wrangling button" do - before do + background do login_as member visit crops_path end - it "has no link to crop wrangling page" do + scenario "has no link to crop wrangling page" do expect(page).to have_no_link "Wrangle Crops", href: wrangle_crops_path end end diff --git a/spec/features/crops/inflections_spec.rb b/spec/features/crops/inflections_spec.rb index c11f4caae..d08f2490b 100644 --- a/spec/features/crops/inflections_spec.rb +++ b/spec/features/crops/inflections_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe "irregular crop inflections" do +feature "irregular crop inflections" do # We're just testing a couple of representative crops to # check that inflection works: you don't need to add # every crop here. - it "crops which are mass nouns" do + scenario "crops which are mass nouns" do expect("kale".pluralize).to eq "kale" expect("broccoli".pluralize).to eq "broccoli" expect("square foot".pluralize).to eq "square feet" diff --git a/spec/features/crops/request_new_crop_spec.rb b/spec/features/crops/request_new_crop_spec.rb index d69c9c0cc..9cccac4f8 100644 --- a/spec/features/crops/request_new_crop_spec.rb +++ b/spec/features/crops/request_new_crop_spec.rb @@ -1,15 +1,15 @@ require 'rails_helper' -describe "Requesting a new crop" do +feature "Requesting a new crop" do context "As a regular member" do let(:member) { create :member } let!(:wrangler) { create :crop_wrangling_member } - before do + background do login_as member end - it "Submit request" do + scenario "Submit request" do visit new_crop_path fill_in "Name", with: "Couch potato" fill_in "request_notes", with: "Couch potatoes are real for real." @@ -24,9 +24,9 @@ describe "Requesting a new crop" do let!(:crop) { create :crop_request } let!(:already_approved) { create :crop } - before { login_as wrangler } + background { login_as wrangler } - it "Approve a request" do + scenario "Approve a request" do visit edit_crop_path(crop) select "approved", from: "Approval status" click_button "Save" @@ -36,7 +36,7 @@ describe "Requesting a new crop" do expect(page).to have_content "crop was successfully updated." end - it "Rejecting a crop" do + scenario "Rejecting a crop" do visit edit_crop_path(crop) select "rejected", from: "Approval status" select "not edible", from: "Reason for rejection" diff --git a/spec/features/crops/requested_crops_spec.rb b/spec/features/crops/requested_crops_spec.rb index 3e19d85a6..15226efe4 100644 --- a/spec/features/crops/requested_crops_spec.rb +++ b/spec/features/crops/requested_crops_spec.rb @@ -1,15 +1,15 @@ require 'rails_helper' -describe "Crop - " do +feature "Crop - " do let(:member) { create :member } let!(:requested_crop) { create :crop, requester: member, approval_status: 'pending', name: 'puha for dinner' } - before do + background do login_as member visit requested_crops_path end - it "creating a crop with multiple scientific and alternate name", :js do + scenario "creating a crop with multiple scientific and alternate name", :js do expect(page).to have_content "puha for dinner" end end diff --git a/spec/features/following_spec.rb b/spec/features/following_spec.rb index fe6e4f1ae..735883e77 100644 --- a/spec/features/following_spec.rb +++ b/spec/features/following_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe "follows", :js do +feature "follows", :js do context "when signed out" do let(:member) { create :member } - it "follow buttons on member profile page" do + scenario "follow buttons on member profile page" do visit member_path(member) expect(page).not_to have_link "Follow" expect(page).not_to have_link "Unfollow" @@ -15,43 +15,43 @@ describe "follows", :js do let(:member) { create :member } let(:other_member) { create :member } - before do + background do login_as(member) end - it "your profile doesn't have a follow button" do + scenario "your profile doesn't have a follow button" do visit member_path(member) expect(page).not_to have_link "Follow" expect(page).not_to have_link "Unfollow" end context "following another member" do - before do + background do visit member_path(other_member) end - it "has a follow button" do + scenario "has a follow button" do expect(page).to have_link "Follow", href: follows_path(followed_id: other_member.id) end - it "has correct message and unfollow button" do + scenario "has correct message and unfollow button" do click_link 'Follow' expect(page).to have_content "Followed #{other_member.login_name}" expect(page).to have_link "Unfollow", href: follow_path(member.get_follow(other_member)) end - it "has a followed member listed in the following page" do + scenario "has a followed member listed in the following page" do click_link 'Follow' visit member_follows_path(member) expect(page).to have_content other_member.login_name.to_s end - it "does not die when passed an authenticity_token" do + scenario "does not die when passed an authenticity_token" do visit member_follows_path member, params: { authenticity_token: "Ultima ratio regum" } expect(page.status_code).to equal 200 end - it "has correct message and follow button after unfollow" do + scenario "has correct message and follow button after unfollow" do click_link 'Follow' click_link 'Unfollow' expect(page).to have_content "Unfollowed #{other_member.login_name}" @@ -59,19 +59,19 @@ describe "follows", :js do expect(page).to have_link "Follow", href: follows_path(followed_id: other_member.id) end - it "has member in following list" do + scenario "has member in following list" do click_link 'Follow' visit member_follows_path(member) expect(page).to have_content other_member.login_name.to_s end - it "appears in in followed member's followers list" do + scenario "appears in in followed member's followers list" do click_link 'Follow' visit member_followers_path(other_member) expect(page).to have_content member.login_name.to_s end - it "removes members from following and followers lists after unfollow" do + scenario "removes members from following and followers lists after unfollow" do click_link 'Follow' click_link 'Unfollow' visit member_follows_path(member) diff --git a/spec/features/footer_spec.rb b/spec/features/footer_spec.rb index 59d65b4db..b7d109773 100644 --- a/spec/features/footer_spec.rb +++ b/spec/features/footer_spec.rb @@ -1,9 +1,9 @@ require 'rails_helper' -describe "footer", js: true do +feature "footer", js: true do before { visit root_path } - it "footer is on home page" do + scenario "footer is on home page" do expect(page).to have_css 'footer' end diff --git a/spec/features/gardens/actions_spec.rb b/spec/features/gardens/actions_spec.rb index 3b7a57784..7342fe55e 100644 --- a/spec/features/gardens/actions_spec.rb +++ b/spec/features/gardens/actions_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' require 'custom_matchers' -describe "Gardens" do +feature "Gardens" do context 'logged in' do let(:member) { FactoryBot.create :member } - before { login_as member } + background { login_as member } subject { page } let(:garden) { member.gardens.first } diff --git a/spec/features/gardens/adding_gardens_spec.rb b/spec/features/gardens/adding_gardens_spec.rb index 437d2812f..c3f78dd18 100644 --- a/spec/features/gardens/adding_gardens_spec.rb +++ b/spec/features/gardens/adding_gardens_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' require 'custom_matchers' -describe "Gardens", :js do +feature "Gardens", :js do let(:member) { FactoryBot.create :member } - before do + background do login_as member visit new_garden_path end @@ -20,14 +20,14 @@ describe "Gardens", :js do expect(page).to have_optional 'input#garden_area' end - it "Create new garden" do + scenario "Create new garden" do fill_in "Name", with: "New garden" click_button "Save" expect(page).to have_content "Garden was successfully created" expect(page).to have_content "New garden" end - it "Refuse to create new garden with negative area" do + scenario "Refuse to create new garden with negative area" do visit new_garden_path fill_in "Name", with: "Negative Garden" fill_in "Area", with: -5 diff --git a/spec/features/gardens/gardens_index_spec.rb b/spec/features/gardens/gardens_index_spec.rb index 78db1369c..0a973e305 100644 --- a/spec/features/gardens/gardens_index_spec.rb +++ b/spec/features/gardens/gardens_index_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' require 'custom_matchers' -describe "Gardens#index", :js do +feature "Gardens#index", :js do context "Logged in as member" do let(:member) { FactoryBot.create :member, login_name: 'shadow' } - before { login_as member } + background { login_as member } context "with 10 gardens" do before do diff --git a/spec/features/gardens_spec.rb b/spec/features/gardens_spec.rb index 0cf352114..368389719 100644 --- a/spec/features/gardens_spec.rb +++ b/spec/features/gardens_spec.rb @@ -1,17 +1,17 @@ require 'rails_helper' -describe "Planting a crop", js: true do +feature "Planting a crop", js: true do # name is aaa to ensure it is ordered first let!(:garden) { create :garden, name: 'aaa' } let!(:planting) { create :planting, garden: garden, owner: garden.owner, planted_at: Date.parse("2013-3-10") } let!(:tomato) { create :tomato } let!(:finished_planting) { create :finished_planting, owner: garden.owner, garden: garden, crop: tomato } - before do + background do login_as garden.owner end - it "View gardens" do + scenario "View gardens" do visit gardens_path expect(page).to have_content "Everyone's gardens" click_link "My Gardens" @@ -20,7 +20,7 @@ describe "Planting a crop", js: true do expect(page).to have_content "Everyone's gardens" end - it "Marking a garden as inactive" do + scenario "Marking a garden as inactive" do visit garden_path(garden) click_link "Mark as inactive" expect(page).to have_content "Garden was successfully updated" @@ -29,14 +29,14 @@ describe "Planting a crop", js: true do expect(page).not_to have_content "Mark as inactive" end - it "List only active gardens" do + scenario "List only active gardens" do visit garden_path(garden) click_link "Mark as inactive" visit gardens_path expect(page).not_to have_link garden_path(garden) end - it "Create new garden" do + scenario "Create new garden" do visit new_garden_path fill_in "Name", with: "New garden" click_button "Save" @@ -44,7 +44,7 @@ describe "Planting a crop", js: true do expect(page).to have_content "New garden" end - it "Refuse to create new garden with negative area" do + scenario "Refuse to create new garden with negative area" do visit new_garden_path fill_in "Name", with: "Negative Garden" fill_in "Area", with: -5 @@ -54,17 +54,17 @@ describe "Planting a crop", js: true do end context "Clicking edit from the index page" do - before do + background do visit gardens_path end - it "button on index to edit garden" do + scenario "button on index to edit garden" do click_link href: edit_garden_path(garden) expect(page).to have_content 'Edit garden' end end - it "Edit garden" do + scenario "Edit garden" do visit new_garden_path fill_in "Name", with: "New garden" click_button "Save" @@ -77,7 +77,7 @@ describe "Planting a crop", js: true do expect(page).to have_content "Different name" end - it "Delete garden" do + scenario "Delete garden" do visit new_garden_path fill_in "Name", with: "New garden" click_button "Save" @@ -94,7 +94,7 @@ describe "Planting a crop", js: true do it_behaves_like "append date" end - it "List only active plantings on a garden" do + scenario "List only active plantings on a garden" do visit gardens_path expect(page).not_to have_content finished_planting.crop_name end diff --git a/spec/features/harvests/browse_harvests_spec.rb b/spec/features/harvests/browse_harvests_spec.rb index d42d3eed4..c51be9f41 100644 --- a/spec/features/harvests/browse_harvests_spec.rb +++ b/spec/features/harvests/browse_harvests_spec.rb @@ -1,28 +1,28 @@ require 'rails_helper' -describe "browse harvests" do +feature "browse harvests" do let!(:member) { create :member } let!(:harvest) { create :harvest, owner: member } - before { login_as member } + background { login_as member } subject { page } - describe 'blank optional fields' do + feature 'blank optional fields' do let!(:harvest) { create :harvest, :no_description } before { visit harvests_path } - it 'read more' do + scenario 'read more' do is_expected.not_to have_link "Read more" end end - describe "filled in optional fields" do + feature "filled in optional fields" do let!(:harvest) { create :harvest, :long_description } before(:each) do visit harvests_path end - it 'read more' do + scenario 'read more' do is_expected.to have_link "Read more" end diff --git a/spec/features/harvests/harvesting_a_crop_spec.rb b/spec/features/harvests/harvesting_a_crop_spec.rb index eb0ec8d19..5f6d85fa2 100644 --- a/spec/features/harvests/harvesting_a_crop_spec.rb +++ b/spec/features/harvests/harvesting_a_crop_spec.rb @@ -1,13 +1,13 @@ require 'rails_helper' require 'custom_matchers' -describe "Harvesting a crop", :js, :elasticsearch do +feature "Harvesting a crop", :js, :elasticsearch do let(:member) { create :member } let!(:maize) { create :maize } let!(:plant_part) { create :plant_part } let(:planting) { create :planting, crop: maize, owner: member } - before do + background do login_as member visit new_harvest_path sync_elasticsearch [maize] @@ -26,7 +26,7 @@ describe "Harvesting a crop", :js, :elasticsearch do expect(page).to have_optional 'textarea#harvest_description' end - it "Creating a new harvest", :js do + scenario "Creating a new harvest", :js do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" @@ -45,24 +45,24 @@ describe "Harvesting a crop", :js, :elasticsearch do context "Clicking edit from the index page" do let!(:harvest) { create :harvest, crop: maize, owner: member } - before do + background do visit harvests_path end - it "button on index to edit harvest" do + scenario "button on index to edit harvest" do click_link "edit_harvest_glyphicon" expect(current_path).to eq edit_harvest_path(harvest) expect(page).to have_content 'Editing harvest' end end - it "Clicking link to owner's profile" do + scenario "Clicking link to owner's profile" do visit harvests_by_owner_path(member) click_link "View #{member}'s profile >>" expect(current_path).to eq member_path member end - it "Harvesting from crop page" do + scenario "Harvesting from crop page" do visit crop_path(maize) click_link "Harvest this" within "form#new_harvest" do @@ -75,7 +75,7 @@ describe "Harvesting a crop", :js, :elasticsearch do expect(page).to have_content "maize" end - it "Harvesting from planting page" do + scenario "Harvesting from planting page" do planting = create :planting, crop: maize, owner: member, garden: member.gardens.first visit planting_path(planting) within ".planting-actions" do @@ -94,12 +94,12 @@ describe "Harvesting a crop", :js, :elasticsearch do let(:existing_harvest) { create :harvest, crop: maize, owner: member } let!(:other_plant_part) { create :plant_part, name: 'chocolate' } - before do + background do visit harvest_path(existing_harvest) click_link "Edit" end - it "Saving without edits" do + scenario "Saving without edits" do # Check that the autosuggest helper properly fills inputs with # existing resource's data click_button "Save" @@ -107,7 +107,7 @@ describe "Harvesting a crop", :js, :elasticsearch do expect(page).to have_content "maize" end - it "change plant part" do + scenario "change plant part" do select other_plant_part.name, from: 'harvest[plant_part_id]' click_button "Save" expect(page).to have_content "harvest was successfully updated." @@ -125,11 +125,11 @@ describe "Harvesting a crop", :js, :elasticsearch do planted_at: Time.zone.yesterday end - before do + background do visit harvest_path(existing_harvest) end - it "linking to a planting" do + scenario "linking to a planting" do expect(page).to have_content existing_planting.to_s choose("harvest_planting_id_#{existing_planting.id}") click_button "save" diff --git a/spec/features/home/home_spec.rb b/spec/features/home/home_spec.rb index e0ff6b923..4137b5e5a 100644 --- a/spec/features/home/home_spec.rb +++ b/spec/features/home/home_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "home page" do +feature "home page" do let(:member) { FactoryBot.create :member } # let(:seed_photo) { FactoryBot.create :photo } let(:photo) { FactoryBot.create :photo } @@ -13,7 +13,7 @@ describe "home page" do let!(:tradable_seed) { FactoryBot.create :tradable_seed, finished: false } let!(:finished_seed) { FactoryBot.create :tradable_seed, finished: true } let!(:untradable_seed) { FactoryBot.create :untradable_seed } - before do + background do # Add photos, so they can appear on home page planting.photos << photo seed.photos << photo @@ -75,7 +75,7 @@ describe "home page" do end context "when signed in" do - before { login_as member } + background { login_as member } include_examples 'show crops' include_examples 'show plantings' include_examples 'show harvests' diff --git a/spec/features/likeable_spec.rb b/spec/features/likeable_spec.rb index fe6531e6d..f0bfd15a8 100644 --- a/spec/features/likeable_spec.rb +++ b/spec/features/likeable_spec.rb @@ -1,17 +1,17 @@ require 'rails_helper' -describe 'Likeable', js: true do +feature 'Likeable', js: true do let(:member) { FactoryBot.create(:member) } let(:another_member) { FactoryBot.create(:london_member) } let(:post) { FactoryBot.create(:post) } context 'logged in member' do - before do + background do login_as member visit post_path(post) end - it 'can be liked' do + scenario 'can be liked' do expect(page).to have_link 'Like' click_link 'Like' expect(page).to have_content '1 like' @@ -23,7 +23,7 @@ describe 'Likeable', js: true do expect(page).to have_content '0 likes' end - it 'displays correct number of likes' do + scenario 'displays correct number of likes' do expect(page).to have_link 'Like' click_link 'Like' expect(page).to have_content '1 like' diff --git a/spec/features/locale_spec.rb b/spec/features/locale_spec.rb index 863fac079..01d164f3c 100644 --- a/spec/features/locale_spec.rb +++ b/spec/features/locale_spec.rb @@ -1,9 +1,9 @@ require 'rails_helper' -describe "Changing locales", js: true do +feature "Changing locales", js: true do after { I18n.locale = :en } - it "Locale can be set with a query param" do + scenario "Locale can be set with a query param" do visit root_path expect(page).to have_content("a community of food gardeners.") visit root_path(locale: 'ja') diff --git a/spec/features/member_profile_spec.rb b/spec/features/member_profile_spec.rb index 1bffb5795..db7d4f595 100644 --- a/spec/features/member_profile_spec.rb +++ b/spec/features/member_profile_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe "member profile", js: true do +feature "member profile", js: true do context "signed out member" do let(:member) { create :member } - it "basic details on member profile page" do + scenario "basic details on member profile page" do visit member_path(member) expect(page).to have_css("h1", text: member.login_name) expect(page).to have_content member.bio @@ -12,20 +12,20 @@ describe "member profile", js: true do expect(page).to have_link "More about this garden...", href: garden_path(member.gardens.first) end - it "no bio" do + scenario "no bio" do member.bio = nil member.save visit member_path(member) expect(page).to have_content "hasn't written a bio yet" end - it "gravatar" do + scenario "gravatar" do visit member_path(member) expect(page).to have_css "img.avatar" end context "location" do - it "member has set location" do + scenario "member has set location" do london_member = create :london_member visit member_path(london_member) expect(page).to have_css("h1>small", text: london_member.location) @@ -33,7 +33,7 @@ describe "member profile", js: true do expect(page).to have_content "See other members, plantings, seeds and more near #{london_member.location}" end - it "member has not set location" do + scenario "member has not set location" do visit member_path(member) expect(page).not_to have_css("h1>small") expect(page).not_to have_css("#membermap") @@ -42,31 +42,31 @@ describe "member profile", js: true do end context "email privacy" do - it "public email address" do + scenario "public email address" do public_member = create :public_member visit member_path(public_member) expect(page).to have_content public_member.email end - it "private email address" do + scenario "private email address" do visit member_path(member) expect(page).not_to have_content member.email end end context "email privacy" do - it "public email address" do + scenario "public email address" do public_member = create :public_member visit member_path(public_member) expect(page).to have_content public_member.email end - it "private email address" do + scenario "private email address" do visit member_path(member) expect(page).not_to have_content member.email end end context "activity stats" do - it "with no activity" do + scenario "with no activity" do visit member_path(member) expect(page).to have_content "Activity" expect(page).to have_content "0 plantings" @@ -75,7 +75,7 @@ describe "member profile", js: true do expect(page).to have_content "0 posts" end - it "with some activity" do + scenario "with some activity" do create_list :planting, 2, owner: member create_list :harvest, 3, owner: member create_list :seed, 4, owner: member @@ -88,13 +88,13 @@ describe "member profile", js: true do end end - it "twitter link" do + scenario "twitter link" do twitter_auth = create :authentication, member: member visit member_path(member) expect(page).to have_link twitter_auth.name, href: "http://twitter.com/#{twitter_auth.name}" end - it "flickr link" do + scenario "flickr link" do flickr_auth = create :flickr_authentication, member: member visit member_path(member) expect(page).to have_link flickr_auth.name, href: "http://flickr.com/photos/#{flickr_auth.uid}" @@ -107,56 +107,56 @@ describe "member profile", js: true do let(:admin_member) { create :admin_member } let(:crop_wrangler) { create :crop_wrangling_member } - before do + background do login_as(member) end - it "admin user's page" do + scenario "admin user's page" do visit member_path(admin_member) expect(page).to have_text "Admin" end - it "crop wrangler's page" do + scenario "crop wrangler's page" do visit member_path(crop_wrangler) expect(page).to have_text "Crop Wrangler" end - it "ordinary user's page" do + scenario "ordinary user's page" do visit member_path(other_member) expect(page).not_to have_text "Crop Wrangler" expect(page).not_to have_text "Admin" end context "your own profile page" do - before do + background do visit member_path(member) end - it "has a link to create new garden" do + scenario "has a link to create new garden" do expect(page).to have_link "New Garden", href: new_garden_path end - it "has a button to edit profile" do + scenario "has a button to edit profile" do expect(page).to have_link "Edit profile", href: edit_member_registration_path end end context "someone else's profile page" do - before do + background do visit member_path(other_member) end - it "has a private message button" do + scenario "has a private message button" do expect(page).to have_link "Send message", href: new_notification_path(recipient_id: other_member.id) end end context "home page" do - before do + background do visit root_path end - it "does not have a button to edit profile" do + scenario "does not have a button to edit profile" do expect(page).not_to have_link "Edit profile", href: edit_member_registration_path end end diff --git a/spec/features/members/deletion_spec.rb b/spec/features/members/deletion_spec.rb index 7b45483b3..22b91a33b 100644 --- a/spec/features/members/deletion_spec.rb +++ b/spec/features/members/deletion_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "member deletion" do +feature "member deletion" do context "with activity and followers" do let(:member) { FactoryBot.create(:member) } let(:other_member) { FactoryBot.create(:member) } @@ -12,7 +12,7 @@ describe "member deletion" do let!(:secondgarden) { FactoryBot.create(:garden, owner: member) } let(:admin) { FactoryBot.create(:admin_member) } - before do + background do login_as(member) visit member_path(other_member) click_link 'Follow' @@ -30,13 +30,13 @@ describe "member deletion" do FactoryBot.create(:member, login_name: "ex_member") end - it "has option to delete on member profile page" do + scenario "has option to delete on member profile page" do visit member_path(member) click_link 'Edit profile' expect(page).to have_link "Delete Account" end - it "asks for password before deletion" do + scenario "asks for password before deletion" do visit member_path(member) click_link 'Edit profile' click_link 'Delete Account' @@ -44,7 +44,7 @@ describe "member deletion" do expect(page).to have_content "Current password can't be blank" end - it "password must be correct" do + scenario "password must be correct" do visit member_path(member) click_link 'Edit profile' click_link 'Delete Account' @@ -53,7 +53,7 @@ describe "member deletion" do expect(page).to have_content "Current password is invalid" end - it "deletes and removes bio" do + scenario "deletes and removes bio" do visit member_path(member) click_link 'Edit profile' click_link 'Delete Account' @@ -64,7 +64,7 @@ describe "member deletion" do end context "deletes and" do - before do + background do logout login_as(member) visit member_path(member) @@ -75,46 +75,46 @@ describe "member deletion" do logout end - it "removes plantings" do + scenario "removes plantings" do visit planting_path(planting) expect(page.status_code).to eq(404) end - it "removes gardens" do + scenario "removes gardens" do visit garden_path(secondgarden) expect(page.status_code).to eq(404) end - it "removes harvests and seeds" do + scenario "removes harvests and seeds" do visit harvest_path(harvest) expect(page.status_code).to eq(404) end - it "removes seeds" do + scenario "removes seeds" do visit seed_path(seed) expect(page.status_code).to eq(404) end - it "removes members from following" do + scenario "removes members from following" do visit member_follows_path(other_member) expect(page).not_to have_content member.login_name.to_s visit member_followers_path(other_member) expect(page).not_to have_content member.login_name.to_s end - it "replaces posts with deletion note" do + scenario "replaces posts with deletion note" do visit post_path(memberpost) expect(page.status_code).to eq(404) end - it "replaces comments on others' posts with deletion note, leaving post intact" do + scenario "replaces comments on others' posts with deletion note, leaving post intact" do visit post_path(othermemberpost) expect(page).not_to have_content member.login_name expect(page).to have_content other_member.login_name expect(page).to have_content "Member Deleted" end - it "can't be interesting" do + scenario "can't be interesting" do expect(Member.interesting).not_to include(member) expect(Planting.interesting).not_to include(planting) expect(Seed.interesting).not_to include(seed) @@ -122,7 +122,7 @@ describe "member deletion" do pending "doesn't show in nearby" - it "can no longer sign in" do + scenario "can no longer sign in" do visit new_member_session_path fill_in 'Login', with: member.login_name fill_in 'Password', with: member.password @@ -139,7 +139,7 @@ describe "member deletion" do FactoryBot.create(:cropbot) let!(:ex_wrangler) { FactoryBot.create(:crop_wrangling_member, login_name: "ex_wrangler") } - it "leaves crops behind" do + scenario "leaves crops behind" do login_as(otherwrangler) visit edit_crop_path(crop) expect(page).to have_content member.login_name diff --git a/spec/features/members_list_spec.rb b/spec/features/members_list_spec.rb index 3fd048a7b..01b6ee8bd 100644 --- a/spec/features/members_list_spec.rb +++ b/spec/features/members_list_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -describe "members list" do +feature "members list" do context "list all members" do let!(:member1) { create :member, login_name: "Archaeopteryx", confirmed_at: Time.zone.parse('2013-02-10') } let!(:member2) { create :member, login_name: "Zephyrosaurus", confirmed_at: Time.zone.parse('2014-01-11') } let!(:member3) { create :member, login_name: "Testingname", confirmed_at: Time.zone.parse('2014-05-09') } - it "default alphabetical sort" do + scenario "default alphabetical sort" do visit members_path expect(page).to have_css "#sort" expect(page).to have_selector "form" @@ -16,7 +16,7 @@ describe "members list" do expect(all_links.last).to have_text member2.login_name end - it "recently joined sort" do + scenario "recently joined sort" do visit members_path expect(page).to have_css "#sort" expect(page).to have_selector "form" diff --git a/spec/features/notifications_spec.rb b/spec/features/notifications_spec.rb index c59befa7c..669890fd1 100644 --- a/spec/features/notifications_spec.rb +++ b/spec/features/notifications_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "Notifications", :js do +feature "Notifications", :js do let(:sender) { create :member } let(:recipient) { create :member } @@ -13,12 +13,12 @@ describe "Notifications", :js do post_id: nil end - before do + background do login_as recipient visit notification_path(notification) end - it "Replying to the notification" do + scenario "Replying to the notification" do click_link "Reply" expect(page).to have_content "Notification body" diff --git a/spec/features/photos/new_photo_spec.rb b/spec/features/photos/new_photo_spec.rb index 019b43404..ee2a50691 100644 --- a/spec/features/photos/new_photo_spec.rb +++ b/spec/features/photos/new_photo_spec.rb @@ -1,17 +1,17 @@ require 'rails_helper' -describe "new photo page" do +feature "new photo page" do let(:photo) { FactoryBot.create :photo } context "signed in member" do let(:member) { FactoryBot.create :member } - before { login_as member } + background { login_as member } context "viewing a planting" do let(:planting) { FactoryBot.create :planting, owner: member } - it "add photo" do + scenario "add photo" do visit planting_path(planting) click_link('Add photo', match: :first) expect(page).to have_text planting.crop.name @@ -21,7 +21,7 @@ describe "new photo page" do context "viewing a harvest" do let(:harvest) { FactoryBot.create :harvest, owner: member } - it "add photo" do + scenario "add photo" do visit harvest_path(harvest) click_link "Add photo" expect(page).to have_text harvest.crop.name @@ -31,7 +31,7 @@ describe "new photo page" do context "viewing a garden" do let(:garden) { FactoryBot.create :garden, owner: member } - it "add photo" do + scenario "add photo" do visit garden_path(garden) within '.garden-actions' do click_link "Add photo" @@ -43,7 +43,7 @@ describe "new photo page" do pending "viewing a seed" do let(:seed) { FactoryBot.create :seed, owner: member } - it "add photo" do + scenario "add photo" do visit seed_path(seed) click_link "Add photo" expect(page).to have_text seed.to_s diff --git a/spec/features/photos/show_photo_spec.rb b/spec/features/photos/show_photo_spec.rb index c5c1578db..bac25b370 100644 --- a/spec/features/photos/show_photo_spec.rb +++ b/spec/features/photos/show_photo_spec.rb @@ -1,17 +1,17 @@ require 'rails_helper' -describe "show photo page" do +feature "show photo page" do let(:photo) { create :photo } context "signed in member" do let(:member) { create :member } - before { login_as member } + background { login_as member } context "linked to planting" do let(:planting) { create :planting } - it "shows linkback to planting" do + scenario "shows linkback to planting" do planting.photos << photo visit photo_path(photo) expect(page).to have_link "#{planting.crop.name} planting in #{planting.garden.name} by #{planting.owner}", @@ -22,7 +22,7 @@ describe "show photo page" do context "linked to harvest" do let(:harvest) { create :harvest } - it "shows linkback to harvest" do + scenario "shows linkback to harvest" do harvest.photos << photo visit photo_path(photo) expect(page).to have_link "#{harvest.crop.name} harvest by #{harvest.owner}", href: harvest_path(harvest) @@ -32,7 +32,7 @@ describe "show photo page" do context "linked to garden" do let(:garden) { create :garden } - it "shows linkback to garden" do + scenario "shows linkback to garden" do garden.photos << photo visit photo_path(photo) expect(page).to have_link "garden named \"#{garden.name}\" by #{garden.owner}", href: garden_path(garden) @@ -42,7 +42,7 @@ describe "show photo page" do context "linked to seed" do let(:seed) { create :seed } - it "shows linkback to seed" do + scenario "shows linkback to seed" do seed.photos << photo visit photo_path(photo) expect(page).to have_link "#{seed.crop.name} seeds belonging to #{seed.owner}", href: seed_path(seed) diff --git a/spec/features/places/searching_a_place_spec.rb b/spec/features/places/searching_a_place_spec.rb index e01c2f247..edbb06e59 100644 --- a/spec/features/places/searching_a_place_spec.rb +++ b/spec/features/places/searching_a_place_spec.rb @@ -1,13 +1,13 @@ require "rails_helper" -describe "User searches" do +feature "User searches" do let(:member) { create :member, location: "Philippines" } let!(:maize) { create :maize } let(:garden) { create :garden, owner: member } let!(:seed1) { create :seed, owner: member } let!(:planting) { create :planting, garden: garden, owner: member, planted_at: Date.parse("2013-3-10") } - it "with a valid place" do + scenario "with a valid place" do visit places_path search_with "Philippines" expect(page).to have_content "community near Philippines" @@ -16,7 +16,7 @@ describe "User searches" do expect(page).not_to have_content "No results found" end - it "with a blank search string" do + scenario "with a blank search string" do visit places_path search_with "" expect(page).to have_content "Please enter a valid location" diff --git a/spec/features/planting_reminder_spec.rb b/spec/features/planting_reminder_spec.rb index 3a7cf4a43..3b407c3df 100644 --- a/spec/features/planting_reminder_spec.rb +++ b/spec/features/planting_reminder_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' require 'capybara/email/rspec' -describe "Planting reminder email", :js do +feature "Planting reminder email", :js do let(:member) { create :member } let(:mail) { Notifier.planting_reminder(member) } @@ -11,16 +11,16 @@ describe "Planting reminder email", :js do { host: 'localhost', port: 8080 } end - it "has a greeting" do + scenario "has a greeting" do expect(mail).to have_content "Hello" end context "when member has no plantings" do - it "tells you to track your plantings" do + scenario "tells you to track your plantings" do expect(mail).to have_content "planting your first crop" end - it "doesn't list plantings" do + scenario "doesn't list plantings" do expect(mail).not_to have_content "most recent plantings you've told us about" end end @@ -31,7 +31,7 @@ describe "Planting reminder email", :js do let!(:p1) { create :planting, garden: member.gardens.first, owner: member } let!(:p2) { create :planting, garden: member.gardens.first, owner: member } - it "lists plantings" do + scenario "lists plantings" do expect(mail).to have_content "most recent plantings you've told us about" expect(mail).to have_link p1.to_s, href: planting_url(p1) expect(mail).to have_link p2.to_s, href: planting_url(p2) @@ -40,11 +40,11 @@ describe "Planting reminder email", :js do end context "when member has no harvests" do - it "tells you to tracking plantings" do + scenario "tells you to tracking plantings" do expect(mail).to have_content "Get started now by tracking your first harvest" end - it "doesn't list plantings" do + scenario "doesn't list plantings" do expect(mail).not_to have_content "the last few things you harvested were" end end @@ -55,7 +55,7 @@ describe "Planting reminder email", :js do let!(:h1) { create :harvest, owner: member } let!(:h2) { create :harvest, owner: member } - it "lists harvests" do + scenario "lists harvests" do expect(mail).to have_content "the last few things you harvested were" expect(mail).to have_link h1.to_s, href: harvest_url(h1) expect(mail).to have_link h2.to_s, href: harvest_url(h2) diff --git a/spec/features/plantings/planting_a_crop_spec.rb b/spec/features/plantings/planting_a_crop_spec.rb index db71445b9..0e26d7078 100644 --- a/spec/features/plantings/planting_a_crop_spec.rb +++ b/spec/features/plantings/planting_a_crop_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" require 'custom_matchers' -describe "Planting a crop", :js, :elasticsearch do +feature "Planting a crop", :js, :elasticsearch do let(:member) { create :member } let!(:maize) { create :maize } let(:garden) { create :garden, owner: member } @@ -9,7 +9,7 @@ describe "Planting a crop", :js, :elasticsearch do create :planting, garden: garden, owner: member, planted_at: Date.parse("2013-3-10") end - before do + background do login_as member visit new_planting_path sync_elasticsearch [maize] @@ -32,7 +32,7 @@ describe "Planting a crop", :js, :elasticsearch do expect(page).to have_optional 'input#planting_finished_at' end - it "Creating a new planting" do + scenario "Creating a new planting" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do @@ -48,7 +48,7 @@ describe "Planting a crop", :js, :elasticsearch do expect(page).to have_content "Progress: Not enough data" end - it "Clicking link to owner's profile" do + scenario "Clicking link to owner's profile" do visit plantings_by_owner_path(member) click_link "View #{member}'s profile >>" expect(current_path).to eq member_path(member) @@ -150,7 +150,7 @@ describe "Planting a crop", :js, :elasticsearch do end end - it "Planting from crop page" do + scenario "Planting from crop page" do visit crop_path(maize) click_link "Plant this" within "form#new_planting" do @@ -162,7 +162,7 @@ describe "Planting a crop", :js, :elasticsearch do expect(page).to have_content "maize" end - it "Editing a planting to add details" do + scenario "Editing a planting to add details" do visit planting_path(planting) click_link "Edit" fill_in "Tell us more about it", with: "Some extra notes" @@ -170,7 +170,7 @@ describe "Planting a crop", :js, :elasticsearch do expect(page).to have_content "planting was successfully updated" end - it "Editing a planting to fill in the finished date" do + scenario "Editing a planting to fill in the finished date" do visit planting_path(planting) expect(page).to have_content "Progress: Not enough data" click_link "Edit" @@ -181,7 +181,7 @@ describe "Planting a crop", :js, :elasticsearch do expect(page).not_to have_content "Progress: Not enough data" end - it "Marking a planting as finished" do + scenario "Marking a planting as finished" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do @@ -222,7 +222,7 @@ describe "Planting a crop", :js, :elasticsearch do expect(page).to have_content "August 30, 2014" end - it "Marking a planting as finished without a date" do + scenario "Marking a planting as finished without a date" do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_planting" do diff --git a/spec/features/posts/posting_a_post_spec.rb b/spec/features/posts/posting_a_post_spec.rb index 7467517c5..ac31b6fec 100644 --- a/spec/features/posts/posting_a_post_spec.rb +++ b/spec/features/posts/posting_a_post_spec.rb @@ -1,14 +1,14 @@ require 'rails_helper' -describe 'Post a post' do +feature 'Post a post' do let(:member) { create :member } - before do + background do login_as member visit new_post_path end - it "creating a post" do + scenario "creating a post" do fill_in "post_subject", with: "Testing" fill_in "post_body", with: "This is a sample test" click_button "Post" @@ -19,11 +19,11 @@ describe 'Post a post' do context "editing a post" do let(:existing_post) { create :post, author: member } - before do + background do visit edit_post_path(existing_post) end - it "saving edit" do + scenario "saving edit" do fill_in "post_subject", with: "Testing Edit" click_button "Post" expect(page).to have_content "Post was successfully updated" diff --git a/spec/features/rss/comments_spec.rb b/spec/features/rss/comments_spec.rb index fef92010a..f053a7e26 100644 --- a/spec/features/rss/comments_spec.rb +++ b/spec/features/rss/comments_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -describe 'Comments RSS feed' do - it 'The index feed exists' do +feature 'Comments RSS feed' do + scenario 'The index feed exists' do visit comments_path(format: 'rss') expect(page.status_code).to equal 200 end - it 'The index title is what we expect' do + scenario 'The index title is what we expect' do visit comments_path(format: 'rss') expect(page).to have_content "Recent comments on all posts (#{ENV['GROWSTUFF_SITE_NAME']})" end diff --git a/spec/features/rss/crops_spec.rb b/spec/features/rss/crops_spec.rb index 80ca34b29..ef45af20b 100644 --- a/spec/features/rss/crops_spec.rb +++ b/spec/features/rss/crops_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -describe 'Crops RSS feed' do - it 'The index feed exists' do +feature 'Crops RSS feed' do + scenario 'The index feed exists' do visit crops_path(format: 'rss') expect(page.status_code).to equal 200 end - it 'The index title is what we expect' do + scenario 'The index title is what we expect' do visit crops_path(format: 'rss') expect(page).to have_content "Recently added crops (#{ENV['GROWSTUFF_SITE_NAME']})" end diff --git a/spec/features/rss/members_spec.rb b/spec/features/rss/members_spec.rb index 8bf13b3c5..3849f9d80 100644 --- a/spec/features/rss/members_spec.rb +++ b/spec/features/rss/members_spec.rb @@ -1,14 +1,14 @@ require 'rails_helper' -describe 'Members RSS feed' do +feature 'Members RSS feed' do let(:member) { create :member } - it 'The show action exists' do + scenario 'The show action exists' do visit member_path(member, format: 'rss') expect(page.status_code).to equal 200 end - it 'The show action title is what we expect' do + scenario 'The show action title is what we expect' do visit member_path(member, format: 'rss') expect(page).to have_content "#{member.login_name}'s recent posts (#{ENV['GROWSTUFF_SITE_NAME']})" end diff --git a/spec/features/rss/plantings_spec.rb b/spec/features/rss/plantings_spec.rb index 875db25ed..59833eff1 100644 --- a/spec/features/rss/plantings_spec.rb +++ b/spec/features/rss/plantings_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -describe 'Plantings RSS feed' do - it 'The index feed exists' do +feature 'Plantings RSS feed' do + scenario 'The index feed exists' do visit plantings_path(format: 'rss') expect(page.status_code).to equal 200 end - it 'The index title is what we expect' do + scenario 'The index title is what we expect' do visit plantings_path(format: 'rss') expect(page).to have_content "Recent plantings from "\ "#{@owner ? @owner : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})" diff --git a/spec/features/rss/posts_spec.rb b/spec/features/rss/posts_spec.rb index f7704042c..445a50cca 100644 --- a/spec/features/rss/posts_spec.rb +++ b/spec/features/rss/posts_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -describe 'Posts RSS feed' do - it 'The index feed exists' do +feature 'Posts RSS feed' do + scenario 'The index feed exists' do visit posts_path(format: 'rss') expect(page.status_code).to equal 200 end - it 'The index title is what we expect' do + scenario 'The index title is what we expect' do visit posts_path(format: 'rss') expect(page).to have_content "Recent posts from "\ "#{@author ? @author : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})" diff --git a/spec/features/rss/seeds_spec.rb b/spec/features/rss/seeds_spec.rb index 84acbf44e..888cc42ec 100644 --- a/spec/features/rss/seeds_spec.rb +++ b/spec/features/rss/seeds_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -describe 'Seeds RSS feed' do - it 'The index feed exists' do +feature 'Seeds RSS feed' do + scenario 'The index feed exists' do visit seeds_path(format: 'rss') expect(page.status_code).to equal 200 end - it 'The index title is what we expect' do + scenario 'The index title is what we expect' do visit seeds_path(format: 'rss') expect(page).to have_content "Recent seeds from "\ "#{@owner ? @owner : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})" diff --git a/spec/features/scientific_name_spec.rb b/spec/features/scientific_name_spec.rb index 545aedacb..d6daf709b 100644 --- a/spec/features/scientific_name_spec.rb +++ b/spec/features/scientific_name_spec.rb @@ -1,16 +1,16 @@ require 'rails_helper' -describe "Scientific names", js: true do +feature "Scientific names", js: true do let!(:zea_mays) { create :zea_mays } let(:crop) { zea_mays.crop } - it "Display scientific names on crop page" do + scenario "Display scientific names on crop page" do visit crop_path(zea_mays.crop) expect(page.status_code).to equal 200 expect(page).to have_content zea_mays.name end - it "Index page for scientific names" do + scenario "Index page for scientific names" do visit scientific_names_path expect(page.status_code).to equal 200 expect(page).to have_content zea_mays.name @@ -20,11 +20,11 @@ describe "Scientific names", js: true do let!(:crop_wranglers) { create_list :crop_wrangling_member, 3 } let(:member) { crop_wranglers.first } - before do + background do login_as(member) end - it "Crop wranglers can edit scientific names" do + scenario "Crop wranglers can edit scientific names" do visit crop_path(crop) expect(page.status_code).to equal 200 expect(page).to have_content "CROP WRANGLER" @@ -39,7 +39,7 @@ describe "Scientific names", js: true do expect(page).to have_content 'crop was successfully updated' end - it "Crop wranglers can delete scientific names" do + scenario "Crop wranglers can delete scientific names" do visit crop_path(zea_mays.crop) expect(page).to have_link "Delete", href: scientific_name_path(zea_mays) @@ -49,7 +49,7 @@ describe "Scientific names", js: true do expect(page).to have_content 'Scientific name was successfully deleted.' end - it "Crop wranglers can add scientific names" do + scenario "Crop wranglers can add scientific names" do visit crop_path(crop) expect(page).to have_link "Add", href: new_scientific_name_path(crop_id: crop.id) @@ -63,7 +63,7 @@ describe "Scientific names", js: true do expect(page).to have_content 'crop was successfully created.' end - it "The show-scientific-name page works" do + scenario "The show-scientific-name page works" do visit scientific_name_path(zea_mays) expect(page.status_code).to equal 200 expect(page).to have_link zea_mays.crop.name, @@ -74,7 +74,7 @@ describe "Scientific names", js: true do let(:pending_crop) { create :crop_request } let(:pending_sci_name) { create :scientific_name, crop: pending_crop } - it "Displays crop pending message" do + scenario "Displays crop pending message" do visit scientific_name_path(pending_sci_name) expect(page).to have_content "This crop is currently pending approval" end diff --git a/spec/features/seeds/adding_seeds_spec.rb b/spec/features/seeds/adding_seeds_spec.rb index 846b9678f..4c183ae24 100644 --- a/spec/features/seeds/adding_seeds_spec.rb +++ b/spec/features/seeds/adding_seeds_spec.rb @@ -1,11 +1,11 @@ require 'rails_helper' require 'custom_matchers' -describe "Seeds", :js, :elasticsearch do +feature "Seeds", :js, :elasticsearch do let(:member) { create :member } let!(:maize) { create :maize } - before do + background do login_as member visit new_seed_path sync_elasticsearch [maize] @@ -30,7 +30,7 @@ describe "Seeds", :js, :elasticsearch do expect(page).to have_selector '.form-group.required', text: 'Will trade:' end - it "Adding a new seed", js: true do + scenario "Adding a new seed", js: true do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" within "form#new_seed" do @@ -55,7 +55,7 @@ describe "Seeds", :js, :elasticsearch do expect(page).to have_content "It's killer." end - it "Adding a seed from crop page" do + scenario "Adding a seed from crop page" do visit crop_path(maize) click_link "Add seeds to stash" within "form#new_seed" do diff --git a/spec/features/seeds/misc_seeds_spec.rb b/spec/features/seeds/misc_seeds_spec.rb index 3a73c4e29..ec1946d2c 100644 --- a/spec/features/seeds/misc_seeds_spec.rb +++ b/spec/features/seeds/misc_seeds_spec.rb @@ -1,13 +1,13 @@ require 'rails_helper' -describe "seeds", js: true do +feature "seeds", js: true do context "signed in user" do let(:member) { create :member } let(:crop) { create :crop } - before { login_as member } + background { login_as member } - it "button on index to edit seed" do + scenario "button on index to edit seed" do seed = create :seed, owner: member visit seeds_path click_link "edit_seed_glyphicon" @@ -15,14 +15,14 @@ describe "seeds", js: true do expect(page).to have_content 'Editing seeds' end - it "button on front page to add seeds" do + scenario "button on front page to add seeds" do visit root_path click_link "Add seeds" expect(current_path).to eq new_seed_path expect(page).to have_content 'Add seeds' end - it "Clicking link to owner's profile" do + scenario "Clicking link to owner's profile" do visit seeds_by_owner_path(member) click_link "View #{member}'s profile >>" expect(current_path).to eq member_path(member) @@ -30,7 +30,7 @@ describe "seeds", js: true do # actually adding seeds is in spec/features/seeds_new_spec.rb - it "edit seeds" do + scenario "edit seeds" do seed = create :seed, owner: member visit seed_path(seed) click_link 'Edit' @@ -40,32 +40,32 @@ describe "seeds", js: true do expect(current_path).to eq seed_path(seed) end - it "delete seeds" do + scenario "delete seeds" do seed = create :seed, owner: member visit seed_path(seed) click_link 'Delete' expect(current_path).to eq seeds_path end - it "view seeds with max and min days until maturity" do + scenario "view seeds with max and min days until maturity" do seed = create :seed, days_until_maturity_min: 5, days_until_maturity_max: 7 visit seed_path(seed) expect(page).to have_content "Days until maturity: 5–7" end - it "view seeds with only max days until maturity" do + scenario "view seeds with only max days until maturity" do seed = create :seed, days_until_maturity_max: 7 visit seed_path(seed) expect(page).to have_content "Days until maturity: 7" end - it "view seeds with only min days until maturity" do + scenario "view seeds with only min days until maturity" do seed = create :seed, days_until_maturity_min: 5 visit seed_path(seed) expect(page).to have_content "Days until maturity: 5" end - it "view seeds with neither max nor min days until maturity" do + scenario "view seeds with neither max nor min days until maturity" do seed = create :seed visit seed_path(seed) expect(page).to have_content "Days until maturity: unknown" diff --git a/spec/features/seeds/seed_photos.rb b/spec/features/seeds/seed_photos.rb index 40ef4c792..7e26ece28 100644 --- a/spec/features/seeds/seed_photos.rb +++ b/spec/features/seeds/seed_photos.rb @@ -1,7 +1,7 @@ require 'rails_helper' require 'custom_matchers' -describe "Seeds", :js do +feature "Seeds", :js do subject do login_as member visit seed_path(seed) diff --git a/spec/features/signin_spec.rb b/spec/features/signin_spec.rb index 8edef538e..acd9f5295 100644 --- a/spec/features/signin_spec.rb +++ b/spec/features/signin_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "signin", js: true do +feature "signin", js: true do let(:member) { create :member } let(:recipient) { create :member } let(:wrangler) { create :crop_wrangling_member } @@ -12,34 +12,34 @@ describe "signin", js: true do click_button 'Sign in' end - it "via email address" do + scenario "via email address" do visit crops_path # some random page click_link 'Sign in' login expect(page).to have_content("Sign out") end - it "redirect to previous page after signin" do + scenario "redirect to previous page after signin" do visit crops_path # some random page click_link 'Sign in' login expect(current_path).to eq crops_path end - it "don't redirect to devise pages after signin" do + scenario "don't redirect to devise pages after signin" do visit new_member_registration_path # devise signup page click_link 'Sign in' login expect(current_path).to eq root_path end - it "redirect to signin page for if not authenticated to view notification" do + scenario "redirect to signin page for if not authenticated to view notification" do visit notification_path(notification) expect(current_path).to eq new_member_session_path end shared_examples "redirects to what you were trying to do" do - it do + scenario do visit "/#{model_name}/new" expect(current_path).to eq new_member_session_path login @@ -55,14 +55,14 @@ describe "signin", js: true do end end - it "after signin, redirect to new notifications page" do + scenario "after signin, redirect to new notifications page" do visit new_notification_path(recipient: recipient) expect(current_path).to eq new_member_session_path login expect(current_path).to eq new_notification_path end - it "after crop wrangler signs in and crops await wrangling, show alert" do + scenario "after crop wrangler signs in and crops await wrangling, show alert" do create :crop_request visit crops_path # some random page click_link 'Sign in' @@ -73,7 +73,7 @@ describe "signin", js: true do end context "with facebook" do - it "sign in" do + scenario "sign in" do # Ordinarily done by database_cleaner Member.where(login_name: 'tdawg').delete_all diff --git a/spec/features/signout_spec.rb b/spec/features/signout_spec.rb index 774c71b70..35cd8af9b 100644 --- a/spec/features/signout_spec.rb +++ b/spec/features/signout_spec.rb @@ -1,9 +1,9 @@ require 'rails_helper' -describe "signout" do +feature "signout" do let(:member) { create :member } - it "redirect to previous page after signout" do + scenario "redirect to previous page after signout" do visit crops_path # some random page click_link 'Sign in' fill_in 'Login', with: member.login_name @@ -14,7 +14,7 @@ describe "signout" do end shared_examples "sign-in redirects" do |path| - it "after signout, redirect to signin page if page needs authentication" do + scenario "after signout, redirect to signin page if page needs authentication" do visit path expect(current_path).to eq new_member_session_path expect(page).to have_http_status(200) @@ -39,7 +39,7 @@ describe "signout" do include_examples "sign-in redirects", "/seeds/new" end - it 'photos' do + scenario 'photos' do garden = FactoryBot.create :garden, owner: member visit "/photos/new?id=#{garden.id}&type=garden" expect(current_path).to eq new_member_session_path diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb index 331dedaa7..6afb28119 100644 --- a/spec/features/signup_spec.rb +++ b/spec/features/signup_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe "signup", js: true do - it "sign up for new account from top menubar" do +feature "signup", js: true do + scenario "sign up for new account from top menubar" do visit crops_path # something other than front page, which has multiple signup links click_link 'Sign up' fill_in 'Login name', with: 'person123' @@ -13,7 +13,7 @@ describe "signup", js: true do expect(current_path).to eq root_path end - it "sign up for new account with existing username" do + scenario "sign up for new account with existing username" do visit crops_path # something other than front page, which has multiple signup links click_link 'Sign up' fill_in 'Login name', with: 'person123' @@ -32,7 +32,7 @@ describe "signup", js: true do click_button 'Sign up' end - it "sign up for new account without accepting TOS" do + scenario "sign up for new account without accepting TOS" do visit root_path first('.signup a').click # click the 'Sign up' button in the middle of the page fill_in 'Login name', with: 'person123' @@ -45,7 +45,7 @@ describe "signup", js: true do end context "with facebook" do - it "sign up" do + scenario "sign up" do # Ordinarily done by database_cleaner Member.where(login_name: 'tdawg').delete_all Member.where(email: 'tdawg@hotmail.com').delete_all diff --git a/spec/features/unsubscribing_spec.rb b/spec/features/unsubscribing_spec.rb index ff7a9c33d..8244d207a 100644 --- a/spec/features/unsubscribing_spec.rb +++ b/spec/features/unsubscribing_spec.rb @@ -1,15 +1,15 @@ require 'rails_helper' require 'capybara/email/rspec' -describe "unsubscribe" do +feature "unsubscribe" do let(:member) { create :member } let(:notification) { create :notification } - before do + background do clear_emails end - it "from planting reminder mailing list" do + scenario "from planting reminder mailing list" do # verifying the initial subscription status of the member expect(member.send_planting_reminder).to eq(true) expect(member.send_notification_email).to eq(true) @@ -26,7 +26,7 @@ describe "unsubscribe" do expect(updated_member.send_notification_email).to eq(true) end - it "from inbox notification mailing list" do + scenario "from inbox notification mailing list" do # verifying the initial subscription status of the member expect(member.send_planting_reminder).to eq(true) expect(member.send_notification_email).to eq(true) @@ -44,7 +44,7 @@ describe "unsubscribe" do expect(updated_member.send_notification_email).to eq(false) end - it "visit unsubscribe page with a non-encrypted parameter" do + scenario "visit unsubscribe page with a non-encrypted parameter" do # verifying the initial subscription status of the member expect(member.send_planting_reminder).to eq(true) expect(member.send_notification_email).to eq(true) diff --git a/spec/requests/api/v1/gardens_request_spec.rb b/spec/requests/api/v1/gardens_request_spec.rb index a016f1328..d6005e286 100644 --- a/spec/requests/api/v1/gardens_request_spec.rb +++ b/spec/requests/api/v1/gardens_request_spec.rb @@ -37,27 +37,27 @@ RSpec.describe 'Gardens', type: :request do "related" => "#{resource_url}/photos" } } end - it '#index' do + scenario '#index' do get '/api/v1/gardens', {}, headers expect(subject['data']).to include(garden_encoded_as_json_api) end - it '#show' do + scenario '#show' do get "/api/v1/gardens/#{garden.id}", {}, headers expect(subject['data']).to include(garden_encoded_as_json_api) end - it '#create' do + scenario '#create' do post '/api/v1/gardens', { 'garden' => { 'name' => 'can i make this' } }, headers expect(response.code).to eq "404" end - it '#update' do + scenario '#update' do post "/api/v1/gardens/#{garden.id}", { 'garden' => { 'name' => 'can i modify this' } }, headers expect(response.code).to eq "404" end - it '#delete' do + scenario '#delete' do delete "/api/v1/gardens/#{garden.id}", {}, headers expect(response.code).to eq "404" end diff --git a/spec/requests/api/v1/plantings_request_spec.rb b/spec/requests/api/v1/plantings_request_spec.rb index a37d08891..4e96cefb4 100644 --- a/spec/requests/api/v1/plantings_request_spec.rb +++ b/spec/requests/api/v1/plantings_request_spec.rb @@ -67,12 +67,12 @@ RSpec.describe 'Plantings', type: :request do } end - it '#index' do + scenario '#index' do get '/api/v1/plantings', {}, headers expect(subject['data']).to include(planting_encoded_as_json_api) end - it '#show' do + scenario '#show' do get "/api/v1/plantings/#{planting.id}", {}, headers expect(subject['data']['relationships']).to include("garden" => garden_as_json_api) expect(subject['data']['relationships']).to include("crop" => crop_as_json_api) @@ -82,17 +82,17 @@ RSpec.describe 'Plantings', type: :request do expect(subject['data']).to eq(planting_encoded_as_json_api) end - it '#create' do + scenario '#create' do post '/api/v1/plantings', { 'planting' => { 'description' => 'can i make this' } }, headers expect(response.code).to eq "404" end - it '#update' do + scenario '#update' do post "/api/v1/plantings/#{planting.id}", { 'planting' => { 'description' => 'can i modify this' } }, headers expect(response.code).to eq "404" end - it '#delete' do + scenario '#delete' do delete "/api/v1/plantings/#{planting.id}", {}, headers expect(response.code).to eq "404" end