DEV: Correct typos and spelling mistakes (#12812)

Over the years we accrued many spelling mistakes in the code base. 

This PR attempts to fix spelling mistakes and typos in all areas of the code that are extremely safe to change 

- comments
- test descriptions
- other low risk areas
This commit is contained in:
Josh Soref
2021-05-20 21:43:47 -04:00
committed by GitHub
parent 6421fabb02
commit 59097b207f
207 changed files with 315 additions and 315 deletions

View File

@@ -33,7 +33,7 @@ describe AdminUserIndexQuery do
expect(query.find_users_query.to_sql).to match("trust_level ASC")
end
it "allows custom ordering for stats wtih default direction" do
it "allows custom ordering for stats with default direction" do
query = ::AdminUserIndexQuery.new(order: "topics_viewed")
expect(query.find_users_query.to_sql).to match("topics_entered DESC")
end

View File

@@ -38,7 +38,7 @@ describe Auth::GithubAuthenticator do
expect(result.email).to eq(user.email)
expect(result.email_valid).to eq(true)
# Authenticates again when user has Github user info
# Authenticates again when user has GitHub user info
result = authenticator.after_authenticate(data)
expect(result.email).to eq(user.email)

View File

@@ -146,7 +146,7 @@ describe HasCustomFields do
expect(db_item.custom_fields).to eq("a" => ["b", "10", "d"])
end
it "supportes type coersion" do
it "supports type coercion" do
test_item = CustomFieldsTestItem.new
CustomFieldsTestItem.register_custom_field_type("bool", :boolean)
CustomFieldsTestItem.register_custom_field_type("int", :integer)

View File

@@ -129,20 +129,20 @@ RSpec.describe SecondFactorManager do
describe "#has_multiple_second_factor_methods?" do
context "when security keys and totp are enabled" do
it "retrns true" do
it "returns true" do
expect(user.has_multiple_second_factor_methods?).to eq(true)
end
end
context "if the totp gets disabled" do
it "retrns false" do
it "returns false" do
disable_totp
expect(user.has_multiple_second_factor_methods?).to eq(false)
end
end
context "if the security key gets disabled" do
it "retrns false" do
it "returns false" do
disable_security_key
expect(user.has_multiple_second_factor_methods?).to eq(false)
end

View File

@@ -67,7 +67,7 @@ describe DiscourseEvent do
context 'when multiple events exist' do
let(:event_handler_2) do
Proc.new { |user| user.job = 'Supervillian' }
Proc.new { |user| user.job = 'Supervillain' }
end
before do
@@ -80,7 +80,7 @@ describe DiscourseEvent do
end
it 'triggers both events' do
expect(harvey.job).to eq('Supervillian')
expect(harvey.job).to eq('Supervillain')
expect(harvey.name).to eq('Two Face')
end

View File

@@ -414,7 +414,7 @@ describe Email::Receiver do
it "handles multiple paragraphs" do
expect { process(:paragraphs) }.to change { topic.posts.count }
expect(topic.posts.last.raw).to eq("Do you like liquorice?\n\nI really like them. One could even say that I am *addicted* to liquorice. Anf if\nyou can mix it up with some anise, then I'm in heaven ;)")
expect(topic.posts.last.raw).to eq("Do you like liquorice?\n\nI really like them. One could even say that I am *addicted* to liquorice. And if\nyou can mix it up with some anise, then I'm in heaven ;)")
end
it "handles invalid from header" do
@@ -1167,7 +1167,7 @@ describe Email::Receiver do
SiteSetting.alternative_reply_by_email_addresses = nil
end
it "it maches nothing if there is not reply_by_email_address" do
it "it matches nothing if there is not reply_by_email_address" do
expect(Email::Receiver.reply_by_email_address_regex).to eq(/$a/)
end
@@ -1366,7 +1366,7 @@ describe Email::Receiver do
SiteSetting.forwarded_emails_behaviour = "create_replies"
end
context "when a reply contains a forwareded email" do
context "when a reply contains a forwarded email" do
include_examples "does not create staged users", :reply_and_forwarded
end

View File

@@ -326,7 +326,7 @@ describe Email::Styles do
strip_and_inline
expect(@frag.to_s).to include("cid:email/test.png")
expect(@frag.to_s).to include("cid:email/test2.ico")
expect(@frag.css('[data-sripped-secure-media]')).not_to be_present
expect(@frag.css('[data-stripped-secure-media]')).not_to be_present
expect(@frag.css('[data-embedded-secure-image]')[0].attr('style')).to eq('width: 16px; height: 16px;')
expect(@frag.css('[data-embedded-secure-image]')[1].attr('style')).to eq('width: 60px; max-height: 80%; max-width: 20%; height: auto; float: left; margin-right: 10px;')
end
@@ -358,7 +358,7 @@ describe Email::Styles do
strip_and_inline
expect(@frag.to_s).to include("cid:email/test.png")
expect(@frag.to_s).to include("cid:email/test2.ico")
expect(@frag.css('[data-sripped-secure-media]')).not_to be_present
expect(@frag.css('[data-stripped-secure-media]')).not_to be_present
expect(@frag.css('[data-embedded-secure-image]')[1].attr('style')).to eq('width: 60px; max-height: 80%; max-width: 20%; height: auto; float: left; margin-right: 10px;')
end
end
@@ -410,7 +410,7 @@ describe Email::Styles do
it "keeps the special onebox styles" do
strip_and_inline
expect(@frag.to_s).to include("cid:email/test.png")
expect(@frag.css('[data-sripped-secure-media]')).not_to be_present
expect(@frag.css('[data-stripped-secure-media]')).not_to be_present
expect(@frag.css('[data-embedded-secure-image]')[0].attr('style')).to eq('width: 20px; height: 20px; float: none; vertical-align: middle; max-height: 80%; max-width: 20%; height: auto; float: left; margin-right: 10px;')
end
end

View File

@@ -91,16 +91,16 @@ describe EmailCook do
long = plaintext(<<~LONG_EMAIL)
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
this is indended by 4 spaces
this is indended by 1 space
this is intended by 4 spaces
this is intended by 1 space
no indentation, but lots of spaces
LONG_EMAIL
long_cooked = (+<<~LONG_COOKED).strip!
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<br>
<br>#{nbsp}#{nbsp}#{nbsp}#{nbsp}this is indended by 4 spaces
<br> this is indended by 1 space
<br>#{nbsp}#{nbsp}#{nbsp}#{nbsp}this is intended by 4 spaces
<br> this is intended by 1 space
<br>no indentation, but lots of spaces
<br>
LONG_COOKED

View File

@@ -16,7 +16,7 @@ describe FileStore::S3Store do
let(:optimized_image_file) { file_from_fixtures("logo.png") }
let(:uploaded_file) { file_from_fixtures("logo.png") }
fab!(:upload) do
Fabricate(:upload, sha1: Digest::SHA1.hexdigest('secreet image string'))
Fabricate(:upload, sha1: Digest::SHA1.hexdigest('secret image string'))
end
before do

View File

@@ -273,7 +273,7 @@ describe UserGuardian do
expect(guardian.can_delete_user?(user)).to eq(true)
end
it "is allowed when user created multiple posts in PMs to themself" do
it "is allowed when user created multiple posts in PMs to themselves" do
topic = Fabricate(:private_message_topic, user: user, topic_allowed_users: [
Fabricate.build(:topic_allowed_user, user: user)
])

View File

@@ -664,7 +664,7 @@ describe Guardian do
end
end
context "when PM has receached the maximum number of recipients" do
context "when PM has reached the maximum number of recipients" do
before do
SiteSetting.max_allowed_message_recipients = 2
end
@@ -706,7 +706,7 @@ describe Guardian do
expect(Guardian.new(admin).can_invite_via_email?(topic)).to be_falsey
end
it 'returns correct valuse when user approval is required' do
it 'returns correct values when user approval is required' do
SiteSetting.must_approve_users = true
expect(Guardian.new(trust_level_2).can_invite_via_email?(topic)).to be_falsey

View File

@@ -149,7 +149,7 @@ describe HtmlToMarkdown do
expect(html_to_markdown(%Q{<img src="foo.bar">})).to eq("")
end
it "keeps <img> with src='cid:' whith 'keep_cid_imgs'" do
it "keeps <img> with src='cid:' with 'keep_cid_imgs'" do
expect(html_to_markdown(HTML_WITH_CID_IMG, keep_cid_imgs: true)).to eq(HTML_WITH_CID_IMG)
end
@@ -391,7 +391,7 @@ describe HtmlToMarkdown do
end
it "supoorts <table>" do
it "supports <table>" do
html = <<~HTML
<table>
<thead>

View File

@@ -32,7 +32,7 @@ describe ImageSizer do
@w, @h = ImageSizer.resize(600, 123)
end
it 'returns the maxmimum width if larger than the maximum' do
it 'returns the maximum width if larger than the maximum' do
expect(@w).to eq(500)
end
@@ -48,7 +48,7 @@ describe ImageSizer do
@w, @h = ImageSizer.resize(123, 600)
end
it 'returns the maxmimum height if larger than the maximum' do
it 'returns the maximum height if larger than the maximum' do
expect(@h).to eq(500)
end

View File

@@ -19,7 +19,7 @@ def EmailFabricator(options)
email += "In-Reply-To: #{options[:in_reply_to]}\n" if options[:in_reply_to]
email += "References: #{options[:in_reply_to]}\n" if options[:in_reply_to]
email += "Message-ID: <#{options[:message_id]}>\n" if options[:message_id]
email += "Subject: #{options[:subject] || "This is a test email subhect"}\n"
email += "Subject: #{options[:subject] || "This is a test email subject"}\n"
email += "Mime-Version: 1.0\n"
email += "Content-Type: #{options[:content_type] || "text/plain;\n charset=UTF-8"}\n"
email += "Content-Transfer-Encoding: 7bit\n"

View File

@@ -530,7 +530,7 @@ describe Imap::Sync do
end
context 'invaidated previous sync' do
context 'invalidated previous sync' do
let(:subject) { 'Testing email post' }
let(:first_from) { 'john@free.fr' }

View File

@@ -116,7 +116,7 @@ describe InlineOneboxer do
expect(onebox[:title]).to eq("Hello 🍕 with an emoji")
end
it "will append the post number post auther's username to the title" do
it "will append the post number post author's username to the title" do
topic = Fabricate(:topic, title: "Inline oneboxer")
Fabricate(:post, topic: topic) # OP
Fabricate(:post, topic: topic)

View File

@@ -42,7 +42,7 @@ describe JsonError do
end
end
describe "an activerecord objec with errors" do
describe "an activerecord object with errors" do
let(:invalid_user) { User.new }
it "returns the errors correctly" do
expect(invalid_user).not_to be_valid

View File

@@ -14,7 +14,7 @@ describe Middleware::AnonymousCache do
Middleware::AnonymousCache::Helper.new(env(opts))
end
context "cachable?" do
context "cacheable?" do
it "true by default" do
expect(new_helper.cacheable?).to eq(true)
end

View File

@@ -713,7 +713,7 @@ describe NewPostManager do
end
context "private message via email" do
it "doesn't enqueue authentiation results failure" do
it "doesn't enqueue authentication results failure" do
manager = NewPostManager.new(
topic.user,
raw: 'this is emailed content',

View File

@@ -33,7 +33,7 @@ describe ONPDiff do
expect(ONPDiff.new("abc", "acd").short_diff).to eq([["a", :common], ["b", :delete], ["c", :common], ["d", :add]])
end
it "returns an array with sequencially similar operations merged" do
it "returns an array with sequentially similar operations merged" do
expect(ONPDiff.new("abcd", "abef").short_diff).to eq([["ab", :common], ["ef", :add], ["cd", :delete]])
end

View File

@@ -178,7 +178,7 @@ describe PostActionCreator do
expect(reviewable.reviewable_scores.select(&:pending?).count).to eq(1)
end
it "succesfully flags the post if it was reviewed more than 24 hours ago" do
it "successfully flags the post if it was reviewed more than 24 hours ago" do
reviewable.update!(updated_at: 25.hours.ago)
post.last_version_at = 30.hours.ago
@@ -188,7 +188,7 @@ describe PostActionCreator do
expect(result.reviewable).to be_present
end
it "succesfully flags the post if it was edited after being reviewed" do
it "successfully flags the post if it was edited after being reviewed" do
reviewable.update!(updated_at: 10.minutes.ago)
post.last_version_at = 1.minute.ago

View File

@@ -674,7 +674,7 @@ describe PostCreator do
SiteSetting.unique_posts_mins = 10
end
it "fails for dupe post accross topic" do
it "fails for dupe post across topic" do
first = create_post(raw: "this is a test #{SecureRandom.hex}")
second = create_post(raw: "this is a test #{SecureRandom.hex}")
@@ -1233,7 +1233,7 @@ describe PostCreator do
DiscourseEvent.off(:topic_created, &@increase_topics)
end
it "fires boths event when creating a topic" do
it "fires both event when creating a topic" do
pc = PostCreator.new(user, raw: 'this is the new content for my topic', title: 'this is my new topic title')
_post = pc.create
expect(@posts_created).to eq(1)

View File

@@ -1304,7 +1304,7 @@ HTML
expect(cooked.split("img").length - 1).to eq(3)
end
it "handles emoji boundries correctly" do
it "handles emoji boundaries correctly" do
expect(PrettyText.cook(",:)")).to include("emoji")
expect(PrettyText.cook(":-)\n")).to include("emoji")
expect(PrettyText.cook("a :)")).to include("emoji")
@@ -1798,7 +1798,7 @@ HTML
HTML
end
it "has a proper data whitlist on div" do
it "has a proper data whitelist on div" do
cooked = PrettyText.cook("<div data-theme-a='a'>test</div>")
expect(cooked).to include("data-theme-a")
end

View File

@@ -84,7 +84,7 @@ describe Promotion do
expect(job["args"][0]["message_type"]).to eq("welcome_tl1_user")
end
it "does not not send when the user already has the tl1 badge when recalculcating" do
it "does not not send when the user already has the tl1 badge when recalculating" do
SiteSetting.send_tl1_welcome_message = true
BadgeGranter.grant(Badge.find(1), user)
stat = user.user_stat

View File

@@ -135,7 +135,7 @@ describe Search do
expect(search.term).to eq('a b c okaylength')
end
context 'query sanitizaton' do
context 'query sanitization' do
let!(:post) { Fabricate(:post, raw: 'hello world') }
it 'escapes backslash' do
@@ -1406,7 +1406,7 @@ describe Search do
raw: 'Relevant Relevant Topic'
)
latest_irelevant_topic_post = Fabricate(:post,
latest_irrelevant_topic_post = Fabricate(:post,
topic: latest_topic,
created_at: today,
raw: 'Not Relevant'
@@ -1415,14 +1415,14 @@ describe Search do
# Expecting the default results
expect(Search.execute('Topic').posts.map(&:id)).to eq([
old_relevant_topic_post.id,
latest_irelevant_topic_post.id,
latest_irrelevant_topic_post.id,
category.topic.first_post.id
])
# Expecting the ordered by topic creation results
expect(Search.execute('Topic order:latest_topic').posts.map(&:id)).to eq([
category.topic.first_post.id,
latest_irelevant_topic_post.id,
latest_irrelevant_topic_post.id,
old_relevant_topic_post.id
])
end
@@ -1667,7 +1667,7 @@ describe Search do
expect(ts_query).to include("baz")
end
it 'esacpes the term correctly' do
it 'escapes the term correctly' do
expect(Search.ts_query(term: 'Title with trailing backslash\\'))
.to eq("TO_TSQUERY('english', '''Title with trailing backslash\\\\\\\\'':*')")
@@ -1801,7 +1801,7 @@ describe Search do
Fabricate(:post, raw: '場サアマネ織企ういかせ竹域ヱイマ穂基ホ神3予読ずねいぱ松査ス禁多サウ提懸イふ引小43改こょドめ。深とつぐ主思料農ぞかル者杯検める活分えほづぼ白犠')
end
it('does not include superflous spaces in blurbs') do
it('does not include superfluous spaces in blurbs') do
results = Search.execute('ういかせ竹域', type_filter: 'topic')
expect(results.posts.length).to eq(1)

View File

@@ -5,11 +5,11 @@ require 'rails_helper'
describe SiteSettingExtension do
# We disable message bus here to avoid a large amount
# of uneeded messaging, tests are careful to call refresh
# of unneeded messaging, tests are careful to call refresh
# when they need to.
#
# DistributedCache used by locale handler can under certain
# cases take a tiny bit to stabalize.
# cases take a tiny bit to stabilize.
#
# TODO: refactor SiteSettingExtension not to rely on statics in
# DefaultsProvider

View File

@@ -159,7 +159,7 @@ describe Slug do
before { SiteSetting.slug_generation_method = 'encoded' }
after { SiteSetting.slug_generation_method = 'ascii' }
it 'generates precentage encoded string' do
it 'generates percentage encoded string' do
expect(Slug.encoded_generator("뉴스피드")).to eq("%EB%89%B4%EC%8A%A4%ED%94%BC%EB%93%9C")
expect(Slug.encoded_generator("آموزش اضافه کردن لینک اختیاری به هدر")).to eq("%D8%A2%D9%85%D9%88%D8%B2%D8%B4-%D8%A7%D8%B6%D8%A7%D9%81%D9%87-%DA%A9%D8%B1%D8%AF%D9%86-%D9%84%DB%8C%D9%86%DA%A9-%D8%A7%D8%AE%D8%AA%DB%8C%D8%A7%D8%B1%DB%8C-%D8%A8%D9%87-%D9%87%D8%AF%D8%B1")
expect(Slug.encoded_generator("熱帶風暴畫眉")).to eq("%E7%86%B1%E5%B8%B6%E9%A2%A8%E6%9A%B4%E7%95%AB%E7%9C%89")

View File

@@ -598,7 +598,7 @@ describe TopicQuery do
end
context 'after clearring a pinned topic' do
context 'after clearing a pinned topic' do
before do
pinned_topic.clear_pin_for(user)
end
@@ -926,7 +926,7 @@ describe TopicQuery do
let!(:archived_topic) { Fabricate(:topic, user: creator, archived: true) }
let!(:invisible_topic) { Fabricate(:topic, user: creator, visible: false) }
it "should omit the closed/archived/invisbiel topics from suggested" do
it "should omit the closed/archived/invisible topics from suggested" do
expect(TopicQuery.new.list_suggested_for(topic).topics).to eq([regular_topic])
end
end
@@ -1158,7 +1158,7 @@ describe TopicQuery do
expect(topics).to contain_exactly(topic1, topic2, topic6)
end
it 'should retun the right list for users in the same group' do
it 'should return the right list for users in the same group' do
topics = TopicQuery.new(user).list_group_topics(group).topics
expect(topics).to contain_exactly(topic1, topic2, topic3, topic6)

View File

@@ -25,7 +25,7 @@ describe TopicRetriever do
end
end
context "when topics have been retrieived recently" do
context "when topics have been retrieved recently" do
before do
topic_retriever.stubs(:retrieved_recently?).returns(true)
end
@@ -41,7 +41,7 @@ describe TopicRetriever do
topic_retriever.stubs(:invalid_url?).returns(false)
end
context "when topics have been retrieived recently" do
context "when topics have been retrieved recently" do
before do
topic_retriever.stubs(:retrieved_recently?).returns(true)
end
@@ -52,7 +52,7 @@ describe TopicRetriever do
end
end
context "when topics have not been retrieived recently" do
context "when topics have not been retrieved recently" do
before do
topic_retriever.stubs(:retrieved_recently?).returns(false)
end

View File

@@ -26,7 +26,7 @@ describe Unread do
end
describe 'staff counts' do
it 'shoule correctly return based on staff post number' do
it 'should correctly return based on staff post number' do
user.admin = true

View File

@@ -21,7 +21,7 @@ describe MaxEmojisValidator do
validate
expect(record.errors[:title][0]).to eq(I18n.t("errors.messages.max_emojis", max_emojis_count: 3))
record.title = ':joy: :blush: :smile: is not only about emojis: Happyness::start()'
record.title = ':joy: :blush: :smile: is not only about emojis: Happiness::start()'
validate
expect(record.valid?).to be true
end