mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-10 16:54:38 -04:00
Swap to modern expect style (#4571)
This commit is contained in:
@@ -15,11 +15,11 @@ describe 'comments/index.rss.haml' do
|
||||
end
|
||||
|
||||
it 'shows RSS feed title' do
|
||||
rendered.should have_content "Recent comments on all posts"
|
||||
expect(rendered).to have_content "Recent comments on all posts"
|
||||
end
|
||||
|
||||
it 'shows item title' do
|
||||
rendered.should have_content "Comment by #{@author.login_name}"
|
||||
expect(rendered).to have_content "Comment by #{@author.login_name}"
|
||||
end
|
||||
|
||||
it 'escapes html for link to post' do
|
||||
@@ -28,6 +28,6 @@ describe 'comments/index.rss.haml' do
|
||||
end
|
||||
|
||||
it 'shows content of comments' do
|
||||
rendered.should have_content "OMG LOL"
|
||||
expect(rendered).to have_content "OMG LOL"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ describe "crops/_grown_for" do
|
||||
|
||||
it 'shows plant parts' do
|
||||
render partial: 'crops/grown_for', locals: { crop: }
|
||||
rendered.should have_content plant_path.name
|
||||
expect(rendered).to have_content plant_path.name
|
||||
assert_select "a", href: plant_part_path(plant_path)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,10 +12,10 @@ describe "crops/_popover" do
|
||||
end
|
||||
|
||||
it 'has a scientific name' do
|
||||
rendered.should have_content 'Solanum lycopersicum'
|
||||
expect(rendered).to have_content 'Solanum lycopersicum'
|
||||
end
|
||||
|
||||
it 'shows count of plantings' do
|
||||
rendered.should have_content '1 time'
|
||||
expect(rendered).to have_content '1 time'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ describe "crops/index.html.haml" do
|
||||
context "downloads" do
|
||||
it "offers data downloads" do
|
||||
render
|
||||
rendered.should have_content "The data on this page is available in the following formats:"
|
||||
expect(rendered).to have_content "The data on this page is available in the following formats:"
|
||||
assert_select "a", href: crops_path(format: 'csv')
|
||||
assert_select "a", href: crops_path(format: 'json')
|
||||
assert_select "a", href: crops_path(format: 'rss')
|
||||
|
||||
@@ -13,11 +13,11 @@ describe 'crops/index.rss.haml' do
|
||||
end
|
||||
|
||||
it 'shows RSS feed title' do
|
||||
rendered.should have_content "Recently added crops"
|
||||
expect(rendered).to have_content "Recently added crops"
|
||||
end
|
||||
|
||||
it 'shows names of crops' do
|
||||
rendered.should have_content @tomato.name
|
||||
rendered.should have_content @maize.name
|
||||
expect(rendered).to have_content @tomato.name
|
||||
expect(rendered).to have_content @maize.name
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,6 +10,6 @@ describe 'devise/confirmations/new.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'contains a login field' do
|
||||
rendered.should have_content "Enter either your login name or your email address"
|
||||
expect(rendered).to have_content "Enter either your login name or your email address"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,11 +10,11 @@ describe 'devise/mailer/confirmation_instructions.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'has a confirmation link' do
|
||||
rendered.should have_content 'Confirm my account'
|
||||
expect(rendered).to have_content 'Confirm my account'
|
||||
end
|
||||
|
||||
it 'has a link to the homepage' do
|
||||
rendered.should have_content root_url
|
||||
expect(rendered).to have_content root_url
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,8 +12,8 @@ describe 'devise/mailer/reset_password_instructions.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
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'
|
||||
expect(rendered).to have_content 'Change my password'
|
||||
expect(rendered).to have_content 'Someone has requested a link to reset your password'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,11 +9,11 @@ describe 'devise/mailer/unlock_instructions.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it "explains what's happened" do
|
||||
rendered.should have_content "account has been locked"
|
||||
expect(rendered).to have_content "account has been locked"
|
||||
end
|
||||
|
||||
it "has an unlock link" do
|
||||
rendered.should have_content "Unlock my account"
|
||||
expect(rendered).to have_content "Unlock my account"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ describe 'devise/registrations/edit.html.haml', type: "view" do
|
||||
|
||||
it 'has some fields' do
|
||||
render
|
||||
rendered.should have_content 'Email'
|
||||
expect(rendered).to have_content 'Email'
|
||||
end
|
||||
|
||||
context 'email section' do
|
||||
|
||||
@@ -13,7 +13,7 @@ describe 'devise/registrations/new.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'has some fields' do
|
||||
rendered.should have_content 'Email'
|
||||
expect(rendered).to have_content 'Email'
|
||||
end
|
||||
|
||||
it 'has a checkbox for newsletter subscription' do
|
||||
|
||||
@@ -13,8 +13,8 @@ describe 'devise/sessions/new.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'has some fields' do
|
||||
rendered.should have_content 'Remember me'
|
||||
rendered.should have_content 'Password'
|
||||
expect(rendered).to have_content 'Remember me'
|
||||
expect(rendered).to have_content 'Password'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ describe 'home/_blurb.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'has description' do
|
||||
rendered.should have_content 'is a community of food gardeners'
|
||||
expect(rendered).to have_content 'is a community of food gardeners'
|
||||
end
|
||||
|
||||
it 'has signup section' do
|
||||
@@ -19,7 +19,7 @@ describe 'home/_blurb.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'has a link to sign in' do
|
||||
rendered.should have_content "Or sign in if you already have an account"
|
||||
expect(rendered).to have_content "Or sign in if you already have an account"
|
||||
assert_select "a", href: new_member_session_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,6 +5,6 @@ require 'rails_helper'
|
||||
describe 'home/_stats.html.haml', type: "view" do
|
||||
it 'has activity stats' do
|
||||
render
|
||||
rendered.should have_content "So far, 0 members have planted 0 crops"
|
||||
expect(rendered).to have_content "So far, 0 members have planted 0 crops"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,8 +29,8 @@ describe 'home/index.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'show interesting members' do
|
||||
rendered.should have_content @member.login_name
|
||||
rendered.should have_content @member.location
|
||||
expect(rendered).to have_content @member.login_name
|
||||
expect(rendered).to have_content @member.location
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,24 +14,24 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'has signup/signin links' do
|
||||
rendered.should have_content 'Sign up'
|
||||
rendered.should have_content 'Sign in'
|
||||
expect(rendered).to have_content 'Sign up'
|
||||
expect(rendered).to have_content 'Sign in'
|
||||
end
|
||||
|
||||
it 'has a Crops link' do
|
||||
rendered.should have_content "Crops"
|
||||
expect(rendered).to have_content "Crops"
|
||||
end
|
||||
|
||||
it 'has a Seeds link' do
|
||||
rendered.should have_content "Seeds"
|
||||
expect(rendered).to have_content "Seeds"
|
||||
end
|
||||
|
||||
it 'has a Places link' do
|
||||
rendered.should have_content "Community Map"
|
||||
expect(rendered).to have_content "Community Map"
|
||||
end
|
||||
|
||||
it 'has a Community section' do
|
||||
rendered.should have_content "Community"
|
||||
expect(rendered).to have_content "Community"
|
||||
end
|
||||
|
||||
it 'links to members' do
|
||||
@@ -62,7 +62,7 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
|
||||
context "login name" do
|
||||
it 'has member login name' do
|
||||
rendered.should have_content @member.login_name.to_s
|
||||
expect(rendered).to have_content @member.login_name.to_s
|
||||
end
|
||||
|
||||
it "shows link to member's gardens" do
|
||||
@@ -83,19 +83,19 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'shows signout link' do
|
||||
rendered.should have_content 'Sign out'
|
||||
expect(rendered).to have_content 'Sign out'
|
||||
end
|
||||
|
||||
it 'shows inbox link' do
|
||||
rendered.should have_content 'Inbox'
|
||||
rendered.should_not match(/Inbox \d+/)
|
||||
expect(rendered).to have_content 'Inbox'
|
||||
expect(rendered).not_to match(/Inbox \d+/)
|
||||
end
|
||||
|
||||
context 'has notifications' do
|
||||
it 'shows inbox count' do
|
||||
create(:notification, recipient: @member)
|
||||
render
|
||||
rendered.should have_content 'Inbox 1'
|
||||
expect(rendered).to have_content 'Inbox 1'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,6 +11,6 @@ describe 'layouts/application.html.haml', type: "view" do
|
||||
Rails.application.config.analytics_code = '<script>console.log("foo!");</script>'
|
||||
render
|
||||
assert_select "script", text: 'console.log("foo!");'
|
||||
rendered.should_not have_content 'script'
|
||||
expect(rendered).to have_no_content 'script'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,7 +109,7 @@ describe "photos/show" do
|
||||
end
|
||||
|
||||
it "contains the phrase 'All rights reserved'" do
|
||||
rendered.should have_content "All rights reserved"
|
||||
expect(rendered).to have_content "All rights reserved"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ describe "places/show" do
|
||||
|
||||
it "shows the names of nearby members" do
|
||||
@nearby_members.each do |m|
|
||||
rendered.should have_content m.login_name
|
||||
expect(rendered).to have_content m.login_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,7 +45,7 @@ describe "plantings/index.html.haml" do
|
||||
|
||||
it "provides data links" do
|
||||
render
|
||||
rendered.should have_content "The data on this page is available in the following formats:"
|
||||
expect(rendered).to have_content "The data on this page is available in the following formats:"
|
||||
assert_select "a", href: plantings_path(format: 'csv')
|
||||
assert_select "a", href: plantings_path(format: 'json')
|
||||
assert_select "a", href: plantings_path(format: 'rss')
|
||||
|
||||
@@ -54,11 +54,11 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "shows edited at" do
|
||||
rendered.should have_content "edited at"
|
||||
expect(rendered).to have_content "edited at"
|
||||
end
|
||||
|
||||
it "shows the updated time" do
|
||||
rendered.should have_content @post.updated_at.to_fs(:default)
|
||||
expect(rendered).to have_content @post.updated_at.to_fs(:default)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -74,11 +74,11 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "shows edited at time" do
|
||||
rendered.should have_content "edited at"
|
||||
expect(rendered).to have_content "edited at"
|
||||
end
|
||||
|
||||
it "shows updated time" do
|
||||
rendered.should have_content @comment.updated_at
|
||||
expect(rendered).to have_content @comment.updated_at
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,7 +93,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "does not show edited at" do
|
||||
rendered.should_not have_content "edited at #{@post.updated_at}"
|
||||
expect(rendered).to have_no_content "edited at #{@post.updated_at}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,7 +109,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "does not show edited at" do
|
||||
rendered.should_not have_content "edited at #{@comment.updated_at}"
|
||||
expect(rendered).to have_no_content "edited at #{@comment.updated_at}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ describe "posts/edit" do
|
||||
end
|
||||
|
||||
it 'no forum mentioned' do
|
||||
rendered.should_not have_content "This post will be posted in the forum"
|
||||
expect(rendered).to have_no_content "This post will be posted in the forum"
|
||||
end
|
||||
|
||||
context "forum specified" do
|
||||
@@ -44,7 +44,7 @@ describe "posts/edit" do
|
||||
end
|
||||
|
||||
it 'tells the user what forum it will be posted in' do
|
||||
rendered.should have_content "This post will be posted in the forum #{@forum.name}"
|
||||
expect(rendered).to have_content "This post will be posted in the forum #{@forum.name}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,19 +14,19 @@ describe 'posts/show.rss.haml' do
|
||||
end
|
||||
|
||||
it 'shows RSS feed title' do
|
||||
rendered.should have_content "Recent comments on #{@post.subject}"
|
||||
expect(rendered).to have_content "Recent comments on #{@post.subject}"
|
||||
end
|
||||
|
||||
it 'shows item title' do
|
||||
rendered.should have_content "Comment by #{@author.login_name}"
|
||||
expect(rendered).to have_content "Comment by #{@author.login_name}"
|
||||
end
|
||||
|
||||
it 'escapes html for link to post' do
|
||||
# it's then unescaped by 'render' so we don't actually look for <
|
||||
rendered.should have_content '<a href='
|
||||
expect(rendered).to have_content '<a href='
|
||||
end
|
||||
|
||||
it 'shows content of comments' do
|
||||
rendered.should have_content "OMG LOL"
|
||||
expect(rendered).to have_content "OMG LOL"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user