mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 06:25:11 -05:00
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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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' }
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Vendored
+1
-1
@@ -8,5 +8,5 @@ Content-Type: text/plain; charset=UTF-8
|
||||
|
||||
Do you like liquorice?
|
||||
|
||||
I really like them. One could even say that I am *addicted* to liquorice. Anf if
|
||||
I really like them. One could even say that I am *addicted* to liquorice. And if
|
||||
you can mix it up with some anise, then I'm in heaven ;)
|
||||
|
||||
@@ -81,7 +81,7 @@ describe Jobs::BulkInvite do
|
||||
expect(existing_user.reload.groups).to eq([group1])
|
||||
end
|
||||
|
||||
it 'can create staged users and prepulate user fields' do
|
||||
it 'can create staged users and prepopulate user fields' do
|
||||
user_field = Fabricate(:user_field, name: "Location")
|
||||
user_field_color = Fabricate(:user_field, field_type: "dropdown", name: "Color")
|
||||
user_field_color.user_field_options.create!(value: "Red")
|
||||
|
||||
@@ -42,7 +42,7 @@ describe Jobs do
|
||||
end
|
||||
expect(jobs.length).to eq(2)
|
||||
|
||||
# Failed transation
|
||||
# Failed transaction
|
||||
ActiveRecord::Base.transaction do
|
||||
Jobs.enqueue(:process_post, post_id: 1)
|
||||
raise ActiveRecord::Rollback
|
||||
|
||||
@@ -34,9 +34,9 @@ describe BackupRestore::MetaDataHandler do
|
||||
end
|
||||
|
||||
it "raises an exception when the metadata file contains invalid JSON" do
|
||||
currupt_metadata = '{"version":20160329101122'
|
||||
corrupt_metadata = '{"version":20160329101122'
|
||||
|
||||
with_metadata_file(currupt_metadata) do |dir|
|
||||
with_metadata_file(corrupt_metadata) do |dir|
|
||||
expect { validate_metadata(backup_filename, dir) }
|
||||
.to raise_error(BackupRestore::MetaDataError)
|
||||
end
|
||||
|
||||
@@ -266,7 +266,7 @@ shared_examples "remote backup store" do
|
||||
expect(url).to match(upload_url_regex("default", filename, multisite: false))
|
||||
end
|
||||
|
||||
it "raises an exeption when a file with same filename exists" do
|
||||
it "raises an exception when a file with same filename exists" do
|
||||
expect { store.generate_upload_url(backup1.filename) }
|
||||
.to raise_exception(BackupRestore::BackupStore::BackupFileExists)
|
||||
end
|
||||
|
||||
@@ -109,7 +109,7 @@ RSpec.describe BookmarkManager do
|
||||
end
|
||||
end
|
||||
|
||||
context "when the post is inaccessable for the user" do
|
||||
context "when the post is inaccessible for the user" do
|
||||
before do
|
||||
post.trash!
|
||||
end
|
||||
@@ -118,7 +118,7 @@ RSpec.describe BookmarkManager do
|
||||
end
|
||||
end
|
||||
|
||||
context "when the topic is inaccessable for the user" do
|
||||
context "when the topic is inaccessible for the user" do
|
||||
before do
|
||||
post.topic.update(category: Fabricate(:private_category, group: Fabricate(:group)))
|
||||
end
|
||||
@@ -182,7 +182,7 @@ RSpec.describe BookmarkManager do
|
||||
)
|
||||
end
|
||||
|
||||
it "saves the time and new reminder type and new name sucessfully" do
|
||||
it "saves the time and new reminder type and new name successfully" do
|
||||
update_bookmark
|
||||
bookmark.reload
|
||||
expect(bookmark.name).to eq(new_name)
|
||||
|
||||
@@ -15,7 +15,7 @@ describe Webauthn::ChallengeGenerator do
|
||||
describe "#commit_to_session" do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
it "stores the challenge, rpid, and name in the provided session object" do
|
||||
it "stores the challenge, rp id, and rp name in the provided session object" do
|
||||
secure_session = {}
|
||||
generated_session = Webauthn::ChallengeGenerator.generate
|
||||
generated_session.commit_to_session(secure_session, user)
|
||||
|
||||
@@ -5,7 +5,7 @@ require 'rails_helper'
|
||||
describe About do
|
||||
|
||||
describe 'stats cache' do
|
||||
include_examples 'stats cachable'
|
||||
include_examples 'stats cacheable'
|
||||
end
|
||||
|
||||
describe "#category_moderators" do
|
||||
|
||||
@@ -221,7 +221,7 @@ describe AdminDashboardData do
|
||||
end
|
||||
|
||||
describe 'stats cache' do
|
||||
include_examples 'stats cachable'
|
||||
include_examples 'stats cacheable'
|
||||
end
|
||||
|
||||
describe '#problem_message_check' do
|
||||
|
||||
@@ -120,7 +120,7 @@ describe CategoryList do
|
||||
expect(category.notification_level).to eq(NotificationLevels.all[:regular])
|
||||
end
|
||||
|
||||
it "returns the users notication level" do
|
||||
it "returns the users notification level" do
|
||||
CategoryUser.set_notification_level_for_category(user, NotificationLevels.all[:watching], topic_category.id)
|
||||
category_list = CategoryList.new(Guardian.new(user))
|
||||
category = category_list.categories.find { |c| c.id == topic_category.id }
|
||||
@@ -128,7 +128,7 @@ describe CategoryList do
|
||||
expect(category.notification_level).to eq(NotificationLevels.all[:watching])
|
||||
end
|
||||
|
||||
it "returns default notication level for anonymous users" do
|
||||
it "returns default notification level for anonymous users" do
|
||||
category_list = CategoryList.new(Guardian.new(nil))
|
||||
category = category_list.categories.find { |c| c.id == topic_category.id }
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ describe EmailToken do
|
||||
context '#create' do
|
||||
fab!(:user) { Fabricate(:user, active: false) }
|
||||
let!(:original_token) { user.email_tokens.first }
|
||||
let!(:email_token) { user.email_tokens.create(email: 'bubblegum@adevnturetime.ooo') }
|
||||
let!(:email_token) { user.email_tokens.create(email: 'bubblegum@adventuretime.ooo') }
|
||||
|
||||
it 'should create the email token' do
|
||||
expect(email_token).to be_present
|
||||
|
||||
@@ -298,7 +298,7 @@ describe Notification do
|
||||
expect(user.unread_notifications).to eq(0)
|
||||
expect(user.total_unread_notifications).to eq(3)
|
||||
# NOTE: because of deprecation this will be equal to unread_high_priority_notifications,
|
||||
# to be remonved in 2.5
|
||||
# to be removed in 2.5
|
||||
expect(user.unread_private_messages).to eq(2)
|
||||
expect(user.unread_high_priority_notifications).to eq(2)
|
||||
end
|
||||
|
||||
@@ -253,7 +253,7 @@ describe PostAction do
|
||||
admin4 = Fabricate(:admin)
|
||||
PostActionCreator.like(admin4, post)
|
||||
|
||||
# first happend within the same day, no need to notify
|
||||
# first happened within the same day, no need to notify
|
||||
expect(Notification.where(post_number: 1, topic_id: post.topic_id).count)
|
||||
.to eq(2)
|
||||
end
|
||||
@@ -419,7 +419,7 @@ describe PostAction do
|
||||
end.to_not change { Notification.count }
|
||||
end
|
||||
|
||||
it "should generate a notification if liker is an admin irregardles of \
|
||||
it "should generate a notification if liker is an admin irregardless of \
|
||||
muting" do
|
||||
|
||||
MutedUser.create!(user_id: post.user.id, muted_user_id: admin.id)
|
||||
@@ -663,7 +663,7 @@ describe PostAction do
|
||||
expect(result.reviewable.payload['targets_topic']).to eq(false)
|
||||
end
|
||||
|
||||
it "will unhide the post when a moderator undos the flag on which s/he took action" do
|
||||
it "will unhide the post when a moderator undoes the flag on which s/he took action" do
|
||||
Discourse.stubs(:site_contact_user).returns(admin)
|
||||
|
||||
post = create_post
|
||||
|
||||
@@ -224,7 +224,7 @@ describe Report do
|
||||
end
|
||||
|
||||
it 'returns a report with data' do
|
||||
# expected number of recoords
|
||||
# expected number of records
|
||||
expect(report.data.count).to eq 4
|
||||
|
||||
# sorts the data from oldest to latest dates
|
||||
@@ -724,7 +724,7 @@ describe Report do
|
||||
post.revise(sam, raw: 'updated body')
|
||||
end
|
||||
|
||||
it "doesn't count a revison on your own post" do
|
||||
it "doesn't count a revision on your own post" do
|
||||
expect(report.data[0][:revision_count]).to eq(1)
|
||||
expect(report.data[0][:username]).to eq('sam')
|
||||
end
|
||||
|
||||
@@ -135,7 +135,7 @@ RSpec.describe ReviewableUser, type: :model do
|
||||
reviewable.perform(moderator, :reject_user_block, reject_reason: "reject reason")
|
||||
end
|
||||
|
||||
it "optionaly sends email with reject reason" do
|
||||
it "optionally sends email with reject reason" do
|
||||
SiteSetting.must_approve_users = true
|
||||
Jobs::CriticalUserEmail.any_instance.expects(:execute).with(type: :signup_after_reject, user_id: reviewable.target_id, reject_reason: "reject reason").once
|
||||
reviewable.perform(moderator, :reject_user_block, reject_reason: "reject reason", send_email: true)
|
||||
|
||||
@@ -196,7 +196,7 @@ describe SiteSetting do
|
||||
end
|
||||
|
||||
describe 'cached settings' do
|
||||
it 'should recalcualte cached setting when dependent settings are changed' do
|
||||
it 'should recalculate cached setting when dependent settings are changed' do
|
||||
SiteSetting.blocked_attachment_filenames = 'foo'
|
||||
expect(SiteSetting.blocked_attachment_filenames_regex).to eq(/foo/)
|
||||
|
||||
|
||||
@@ -2118,7 +2118,7 @@ describe Topic do
|
||||
expect(topic.all_allowed_users).to include moderator
|
||||
end
|
||||
|
||||
it 'includes moderators if offical warning' do
|
||||
it 'includes moderators if official warning' do
|
||||
topic.stubs(:subtype).returns(TopicSubtype.moderator_warning)
|
||||
topic.stubs(:private_message?).returns(true)
|
||||
expect(topic.all_allowed_users).to include moderator
|
||||
@@ -2307,10 +2307,10 @@ describe Topic do
|
||||
end
|
||||
end
|
||||
|
||||
describe ".count_exceeds_minimun?" do
|
||||
describe ".count_exceeds_minimum?" do
|
||||
before { SiteSetting.minimum_topics_similar = 20 }
|
||||
|
||||
context "when Topic count is geater than minimum_topics_similar" do
|
||||
context "when Topic count is greater than minimum_topics_similar" do
|
||||
it "should be true" do
|
||||
Topic.stubs(:count).returns(30)
|
||||
expect(Topic.count_exceeds_minimum?).to be_truthy
|
||||
@@ -2334,7 +2334,7 @@ describe Topic do
|
||||
expect(topic.expandable_first_post?).to eq(false)
|
||||
end
|
||||
|
||||
describe 'with an emeddable host' do
|
||||
describe 'with an embeddable host' do
|
||||
before do
|
||||
Fabricate(:embeddable_host)
|
||||
SiteSetting.embed_truncate = true
|
||||
|
||||
@@ -679,7 +679,7 @@ describe User do
|
||||
expect(User.username_available?('tESt')).to eq(false)
|
||||
end
|
||||
|
||||
it 'returns true when reserved username is explicity allowed' do
|
||||
it 'returns true when reserved username is explicitly allowed' do
|
||||
SiteSetting.reserved_usernames = 'test|donkey'
|
||||
|
||||
expect(User.username_available?(
|
||||
@@ -727,7 +727,7 @@ describe User do
|
||||
expect(User.reserved_username?('test')).to eq(true)
|
||||
end
|
||||
|
||||
it 'should not allow usernames matched against an expession' do
|
||||
it 'should not allow usernames matched against an expression' do
|
||||
SiteSetting.reserved_usernames = "test)|*admin*|foo*|*bar|abc.def|löwe|ka\u0308fer"
|
||||
|
||||
expect(User.reserved_username?('test')).to eq(false)
|
||||
@@ -1901,7 +1901,7 @@ describe User do
|
||||
|
||||
expect(message.data[:unread_notifications]).to eq(1)
|
||||
# NOTE: because of deprecation this will be equal to unread_high_priority_notifications,
|
||||
# to be remonved in 2.5
|
||||
# to be removed in 2.5
|
||||
expect(message.data[:unread_private_messages]).to eq(2)
|
||||
expect(message.data[:unread_high_priority_notifications]).to eq(2)
|
||||
end
|
||||
@@ -2359,7 +2359,7 @@ describe User do
|
||||
expect(User.system_avatar_template("बहुत")).to match(%r|/letter_avatar_proxy/v\d/letter/%E0%A4%AC/ea5d25/{size}.png|)
|
||||
end
|
||||
|
||||
it "substitues {username} with the URL encoded username" do
|
||||
it "substitutes {username} with the URL encoded username" do
|
||||
SiteSetting.external_system_avatars_url = "https://{hostname}/{username}.png"
|
||||
expect(User.system_avatar_template("बहुत")).to eq("https://#{Discourse.current_hostname}/%E0%A4%AC%E0%A4%B9%E0%A5%81%E0%A4%A4.png")
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ describe UsernameValidator do
|
||||
error_message: I18n.t(:'user.username.short', min: 4))
|
||||
end
|
||||
|
||||
it 'is valid when the username has the minimum lenght' do
|
||||
it 'is valid when the username has the minimum length' do
|
||||
SiteSetting.min_username_length = 4
|
||||
|
||||
expect_valid('abcd')
|
||||
@@ -50,7 +50,7 @@ describe UsernameValidator do
|
||||
error_message: I18n.t(:'user.username.long', max: 8))
|
||||
end
|
||||
|
||||
it 'is valid when the username has the maximum lenght' do
|
||||
it 'is valid when the username has the maximum length' do
|
||||
SiteSetting.max_username_length = 8
|
||||
|
||||
expect_valid('abcdefgh')
|
||||
@@ -122,7 +122,7 @@ describe UsernameValidator do
|
||||
error_message: I18n.t(:'user.username.short', min: 3))
|
||||
end
|
||||
|
||||
it 'is valid when the username has the minimum lenght' do
|
||||
it 'is valid when the username has the minimum length' do
|
||||
SiteSetting.min_username_length = 2
|
||||
|
||||
expect_valid('পাখি', 'طائر')
|
||||
@@ -135,7 +135,7 @@ describe UsernameValidator do
|
||||
error_message: I18n.t(:'user.username.long', max: 8))
|
||||
end
|
||||
|
||||
it 'is valid when the username has the maximum lenght' do
|
||||
it 'is valid when the username has the maximum length' do
|
||||
SiteSetting.max_username_length = 9
|
||||
|
||||
expect_valid('Дровосек', 'چوب-لباسی', 'தமிழ்-தமிழ்')
|
||||
|
||||
@@ -40,7 +40,7 @@ describe WebHook do
|
||||
fab!(:post_hook) { Fabricate(:web_hook, payload_url: " https://example.com ") }
|
||||
fab!(:topic_hook) { Fabricate(:topic_web_hook) }
|
||||
|
||||
it "removes whitspace from payload_url before saving" do
|
||||
it "removes whitespace from payload_url before saving" do
|
||||
expect(post_hook.payload_url).to eq("https://example.com")
|
||||
end
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ module TestSetup
|
||||
# This is run before each test and before each before_all block
|
||||
def self.test_setup(x = nil)
|
||||
# TODO not sure about this, we could use a mock redis implementation here:
|
||||
# this gives us really clean "flush" semantics, howere the side-effect is that
|
||||
# this gives us really clean "flush" semantics, however the side-effect is that
|
||||
# we are no longer using a clean redis implementation, a preferable solution may
|
||||
# be simply flushing before tests, trouble is that redis may be reused with dev
|
||||
# so that would mean the dev would act weird
|
||||
|
||||
@@ -32,7 +32,7 @@ describe Admin::ReportsController do
|
||||
end
|
||||
|
||||
context "invalid params" do
|
||||
context "inexisting report" do
|
||||
context "nonexistent report" do
|
||||
it "returns not found reports" do
|
||||
get "/admin/reports/bulk.json", params: {
|
||||
reports: {
|
||||
|
||||
@@ -32,7 +32,7 @@ RSpec.describe Admin::UsersController do
|
||||
end
|
||||
end
|
||||
|
||||
it "logs only 1 enty" do
|
||||
it "logs only 1 entry" do
|
||||
expect do
|
||||
get "/admin/users/list.json", params: { show_emails: "true" }
|
||||
end.to change { UserHistory.where(action: UserHistory.actions[:check_email], acting_user_id: admin.id).count }.by(1)
|
||||
@@ -98,7 +98,7 @@ RSpec.describe Admin::UsersController do
|
||||
|
||||
let(:evil_trout) { Fabricate(:evil_trout) }
|
||||
|
||||
it "does nothing without uesrs" do
|
||||
it "does nothing without users" do
|
||||
put "/admin/users/approve-bulk.json"
|
||||
evil_trout.reload
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
@@ -118,7 +118,7 @@ describe 'posts' do
|
||||
|
||||
path '/posts/{id}.json' do
|
||||
|
||||
get 'Retreive a single post' do
|
||||
get 'Retrieve a single post' do
|
||||
tags 'Posts'
|
||||
parameter name: 'Api-Key', in: :header, type: :string, required: true
|
||||
parameter name: 'Api-Username', in: :header, type: :string, required: true
|
||||
|
||||
@@ -260,7 +260,7 @@ RSpec.describe ApplicationController do
|
||||
if (log.include? 'exception app middleware')
|
||||
# heisentest diagnostics
|
||||
puts
|
||||
puts "EXTRA DIAGNOSTICS FOR INTERMITENT TEST FAIL"
|
||||
puts "EXTRA DIAGNOSTICS FOR INTERMITTENT TEST FAIL"
|
||||
puts log
|
||||
puts ">> action_dispatch.exception"
|
||||
ex = request.env['action_dispatch.exception']
|
||||
|
||||
@@ -333,11 +333,11 @@ describe CategoriesController do
|
||||
end
|
||||
|
||||
it "returns 422 if email_in address is already in use for other category" do
|
||||
_other_category = Fabricate(:category, name: "Other", email_in: "mail@examle.com")
|
||||
_other_category = Fabricate(:category, name: "Other", email_in: "mail@example.com")
|
||||
|
||||
put "/categories/#{category.id}.json", params: {
|
||||
name: "Email",
|
||||
email_in: "mail@examle.com",
|
||||
email_in: "mail@example.com",
|
||||
color: "ff0",
|
||||
text_color: "fff",
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ describe ExtraLocalesController do
|
||||
"admin" => {
|
||||
"site_settings" => {
|
||||
"categories" => {
|
||||
"github_badges" => "Github Badges"
|
||||
"github_badges" => "GitHub Badges"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1102,7 +1102,7 @@ describe GroupsController do
|
||||
fab!(:group) { Fabricate(:group) }
|
||||
|
||||
context 'when user is not signed in' do
|
||||
it 'should be fobidden' do
|
||||
it 'should be forbidden' do
|
||||
put "/groups/#{group.id}/members.json", params: { usernames: "bob" }
|
||||
expect(response).to be_forbidden
|
||||
|
||||
@@ -1111,7 +1111,7 @@ describe GroupsController do
|
||||
end
|
||||
|
||||
context 'public group' do
|
||||
it 'should be fobidden' do
|
||||
it 'should be forbidden' do
|
||||
group.update!(
|
||||
public_admission: true,
|
||||
public_exit: true
|
||||
@@ -1447,7 +1447,7 @@ describe GroupsController do
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it 'should not allow an underprivilege user to add another user to a group' do
|
||||
it 'should not allow an underprivileged user to add another user to a group' do
|
||||
sign_in(user)
|
||||
|
||||
put "/groups/#{group.id}/members.json",
|
||||
@@ -1549,7 +1549,7 @@ describe GroupsController do
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it 'should not allow a underprivilege user to leave a group for another user' do
|
||||
it 'should not allow a underprivileged user to leave a group for another user' do
|
||||
sign_in(user)
|
||||
|
||||
delete "/groups/#{group.id}/members.json",
|
||||
|
||||
@@ -49,7 +49,7 @@ describe HashtagsController do
|
||||
sign_in(admin)
|
||||
end
|
||||
|
||||
it "returns restricted categories and hidden tagss" do
|
||||
it "returns restricted categories and hidden tags" do
|
||||
group.add(admin)
|
||||
|
||||
get "/hashtags.json", params: { slugs: [private_category.slug, hidden_tag.name] }
|
||||
|
||||
@@ -4,7 +4,7 @@ require 'rails_helper'
|
||||
|
||||
describe PermalinksController do
|
||||
fab!(:topic) { Fabricate(:topic) }
|
||||
fab!(:permalink) { Fabricate(:permalink, url: "deadroutee/topic/546") }
|
||||
fab!(:permalink) { Fabricate(:permalink, url: "deadroute/topic/546") }
|
||||
|
||||
describe 'show' do
|
||||
it "should redirect to a permalink's target_url with status 301" do
|
||||
|
||||
@@ -48,7 +48,7 @@ describe PostReadersController do
|
||||
assert_reader_is_correctly_serialized(reader_data, reader, @post)
|
||||
end
|
||||
|
||||
it 'return an empty list when nodobody read unti that post' do
|
||||
it 'return an empty list when nodobody read until that post' do
|
||||
TopicUser.create!(user: reader, topic: @group_message, last_read_post_number: 1)
|
||||
|
||||
get '/post_readers.json', params: { id: @post.id }
|
||||
|
||||
@@ -577,7 +577,7 @@ describe PostsController do
|
||||
before do
|
||||
Fabricate(:bookmark, user: user, post: Fabricate(:post, topic: post.topic), topic: post.topic)
|
||||
end
|
||||
it "marks topic_bookmaked as true" do
|
||||
it "marks topic_bookmarked as true" do
|
||||
delete "/posts/#{post.id}/bookmark.json"
|
||||
expect(response.parsed_body['topic_bookmarked']).to eq(true)
|
||||
end
|
||||
@@ -1903,7 +1903,7 @@ describe PostsController do
|
||||
end
|
||||
|
||||
describe '#cooked' do
|
||||
it 'returns the cooked conent' do
|
||||
it 'returns the cooked content' do
|
||||
post = Fabricate(:post, cooked: "WAt")
|
||||
get "/posts/#{post.id}/cooked.json"
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ describe ReviewablesController do
|
||||
expect(response.code).to eq("404")
|
||||
end
|
||||
|
||||
it "validates the presenece of an action" do
|
||||
it "validates the presence of an action" do
|
||||
put "/review/#{reviewable.id}/perform/nope.json?version=#{reviewable.version}"
|
||||
expect(response.code).to eq("403")
|
||||
end
|
||||
|
||||
@@ -534,7 +534,7 @@ describe SearchController do
|
||||
expect(data["posts"][3]["id"]).to eq(very_low_priority_post.id)
|
||||
end
|
||||
|
||||
it "doesn't sort posts with search piority when query with order" do
|
||||
it "doesn't sort posts with search priority when query with order" do
|
||||
get "/search.json", params: { q: 'status:open order:latest Priority Post' }
|
||||
expect(response.status).to eq(200)
|
||||
data = response.parsed_body
|
||||
@@ -601,7 +601,7 @@ describe SearchController do
|
||||
SearchLog.clear_debounce_cache!
|
||||
end
|
||||
|
||||
it "doesn't work wthout the necessary parameters" do
|
||||
it "doesn't work without the necessary parameters" do
|
||||
post "/search/click.json"
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
||||
@@ -495,7 +495,7 @@ RSpec.describe SessionController do
|
||||
expect(session[:current_user_id]).to be_blank
|
||||
end
|
||||
|
||||
it "works in developmenet mode" do
|
||||
it "works in development mode" do
|
||||
Rails.env.stubs(:development?).returns(true)
|
||||
get "/session/#{user.username}/become.json"
|
||||
expect(response).to be_redirect
|
||||
@@ -543,7 +543,7 @@ RSpec.describe SessionController do
|
||||
sso
|
||||
end
|
||||
|
||||
it 'does not create superflous auth tokens when already logged in' do
|
||||
it 'does not create superfluous auth tokens when already logged in' do
|
||||
user = Fabricate(:user)
|
||||
sign_in(user)
|
||||
|
||||
@@ -2188,7 +2188,7 @@ RSpec.describe SessionController do
|
||||
|
||||
describe '#current' do
|
||||
context "when not logged in" do
|
||||
it "retuns 404" do
|
||||
it "returns 404" do
|
||||
get "/session/current.json"
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
|
||||
@@ -105,7 +105,7 @@ describe TagsController do
|
||||
end
|
||||
|
||||
context "when user can admin tags" do
|
||||
it "succesfully retrieve all tags" do
|
||||
it "successfully retrieve all tags" do
|
||||
sign_in(admin)
|
||||
|
||||
get "/tags.json"
|
||||
|
||||
@@ -24,7 +24,7 @@ describe ThemeJavascriptsController do
|
||||
get "/theme-javascripts/#{digest}.js"
|
||||
end
|
||||
|
||||
it 'only accepts 40-char hexdecimal digest name' do
|
||||
it 'only accepts 40-char hexadecimal digest name' do
|
||||
update_digest_and_get('0123456789abcdefabcd0123456789abcdefabcd')
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
|
||||
@@ -1767,14 +1767,14 @@ RSpec.describe TopicsController do
|
||||
let(:deleted_topic) { Fabricate(:deleted_topic) }
|
||||
let(:deleted_secure_topic) { Fabricate(:topic, category: secure_category, deleted_at: 1.day.ago) }
|
||||
let(:deleted_private_topic) { Fabricate(:private_message_topic, user: allowed_user, deleted_at: 1.day.ago) }
|
||||
let!(:nonexist_topic_id) { Topic.last.id + 10000 }
|
||||
let!(:nonexistent_topic_id) { Topic.last.id + 10000 }
|
||||
fab!(:secure_accessible_topic) { Fabricate(:topic, category: accessible_category) }
|
||||
|
||||
shared_examples "various scenarios" do |expected|
|
||||
expected.each do |key, value|
|
||||
it "returns #{value} for #{key}" do
|
||||
slug = key == :nonexist ? "garbage-slug" : send(key.to_s).slug
|
||||
topic_id = key == :nonexist ? nonexist_topic_id : send(key.to_s).id
|
||||
slug = key == :nonexistent ? "garbage-slug" : send(key.to_s).slug
|
||||
topic_id = key == :nonexistent ? nonexistent_topic_id : send(key.to_s).id
|
||||
get "/t/#{slug}/#{topic_id}.json"
|
||||
expect(response.status).to eq(value)
|
||||
end
|
||||
@@ -1800,7 +1800,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 404,
|
||||
deleted_secure_topic: 404,
|
||||
deleted_private_topic: 404,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 404
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1817,7 +1817,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 302,
|
||||
deleted_secure_topic: 302,
|
||||
deleted_private_topic: 302,
|
||||
nonexist: 302,
|
||||
nonexistent: 302,
|
||||
secure_accessible_topic: 302
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1835,7 +1835,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 404,
|
||||
deleted_secure_topic: 404,
|
||||
deleted_private_topic: 404,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 404
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1853,7 +1853,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 404,
|
||||
deleted_secure_topic: 404,
|
||||
deleted_private_topic: 404,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 404
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1871,7 +1871,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 200,
|
||||
deleted_secure_topic: 404,
|
||||
deleted_private_topic: 404,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 404
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1889,7 +1889,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 200,
|
||||
deleted_secure_topic: 200,
|
||||
deleted_private_topic: 200,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 200
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1909,7 +1909,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 410,
|
||||
deleted_secure_topic: 403,
|
||||
deleted_private_topic: 403,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 403
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1926,7 +1926,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 302,
|
||||
deleted_secure_topic: 302,
|
||||
deleted_private_topic: 302,
|
||||
nonexist: 302,
|
||||
nonexistent: 302,
|
||||
secure_accessible_topic: 302
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1944,7 +1944,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 410,
|
||||
deleted_secure_topic: 403,
|
||||
deleted_private_topic: 403,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 403
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1962,7 +1962,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 410,
|
||||
deleted_secure_topic: 410,
|
||||
deleted_private_topic: 410,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 403
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1980,7 +1980,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 200,
|
||||
deleted_secure_topic: 403,
|
||||
deleted_private_topic: 403,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 403
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -1998,7 +1998,7 @@ RSpec.describe TopicsController do
|
||||
deleted_topic: 200,
|
||||
deleted_secure_topic: 200,
|
||||
deleted_private_topic: 200,
|
||||
nonexist: 404,
|
||||
nonexistent: 404,
|
||||
secure_accessible_topic: 200
|
||||
}
|
||||
include_examples "various scenarios", expected
|
||||
@@ -3776,7 +3776,7 @@ RSpec.describe TopicsController do
|
||||
freeze_time page3_time
|
||||
Fabricate(:post, topic: topic)
|
||||
|
||||
# ugly, but no inteface to set this and we don't want to create
|
||||
# ugly, but no interface to set this and we don't want to create
|
||||
# 100 posts to test this thing
|
||||
TopicView.stubs(:chunk_size).returns(2)
|
||||
|
||||
@@ -3852,7 +3852,7 @@ RSpec.describe TopicsController do
|
||||
end
|
||||
end
|
||||
|
||||
it "should fail for non-existend topic" do
|
||||
it "should fail for non-existent topic" do
|
||||
max_id = Topic.maximum(:id)
|
||||
sign_in(admin)
|
||||
put "/t/#{max_id + 1}/reset-bump-date.json"
|
||||
|
||||
@@ -633,7 +633,7 @@ describe UsersController do
|
||||
post "/u.json", params: {
|
||||
name: @user.name,
|
||||
username: @user.username,
|
||||
password: 'tesing12352343'
|
||||
password: 'testing12352343'
|
||||
}
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
@@ -1369,7 +1369,7 @@ describe UsersController do
|
||||
end
|
||||
|
||||
context 'while logged in' do
|
||||
let(:old_username) { "OrigUsrname" }
|
||||
let(:old_username) { "OrigUsername" }
|
||||
let(:new_username) { "#{old_username}1234" }
|
||||
let(:user) { Fabricate(:user, username: old_username) }
|
||||
|
||||
@@ -2497,7 +2497,7 @@ describe UsersController do
|
||||
expect(user.user_avatar.reload.custom_upload_id).to eq(avatar1.id)
|
||||
end
|
||||
|
||||
it 'can succesfully select an avatar using a cooked URL' do
|
||||
it 'can successfully select an avatar using a cooked URL' do
|
||||
events = DiscourseEvent.track_events do
|
||||
put "/u/#{user.username}/preferences/avatar/select.json", params: { url: UrlHelper.cook_url(avatar1.url) }
|
||||
end
|
||||
|
||||
@@ -47,7 +47,7 @@ describe PostRevisionSerializer do
|
||||
expect(json[:tags_changes][:current]).to eq([public_tag2.name])
|
||||
end
|
||||
|
||||
it 'does not show tag modificiatons if changes are not visible to the user' do
|
||||
it 'does not show tag modifications if changes are not visible to the user' do
|
||||
json = PostRevisionSerializer.new(post_revision2, scope: Guardian.new(Fabricate(:user)), root: false).as_json
|
||||
expect(json[:tags_changes]).to_not be_present
|
||||
end
|
||||
|
||||
@@ -467,7 +467,7 @@ describe TopicViewSerializer do
|
||||
end
|
||||
end
|
||||
|
||||
context 'Wwhen the slow mode is enabled' do
|
||||
context 'When the slow mode is enabled' do
|
||||
before { topic.update!(slow_mode_seconds: 1000) }
|
||||
|
||||
it 'returns nil if no user is given' do
|
||||
|
||||
@@ -391,7 +391,7 @@ describe BadgeGranter do
|
||||
expect(UserBadge.where(user_id: user.id, badge_id: Badge::Autobiographer).count).to eq(1)
|
||||
end
|
||||
|
||||
it "grants read guidlines" do
|
||||
it "grants read guidelines" do
|
||||
user.user_stat.read_faq = Time.now
|
||||
user.user_stat.save
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ describe DestroyTask do
|
||||
destroy_task = DestroyTask.new(StringIO.new)
|
||||
destroy_task.destroy_users
|
||||
expect(User.where(admin: false).count).to eq 0
|
||||
# admin does not get detroyed
|
||||
# admin does not get destroyed
|
||||
expect(User.count).to eq before_count + 1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -681,13 +681,13 @@ RSpec.describe InlineUploads do
|
||||
|
||||
it "should correct markdown references" do
|
||||
md = <<~MD
|
||||
This is a [some reference] somethign
|
||||
This is a [some reference] something
|
||||
|
||||
[some reference]: https:#{upload.url}
|
||||
MD
|
||||
|
||||
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||
This is a [some reference] somethign
|
||||
This is a [some reference] something
|
||||
|
||||
[some reference]: #{Discourse.base_url}#{upload.short_path}
|
||||
MD
|
||||
|
||||
@@ -145,7 +145,7 @@ describe PostActionNotifier do
|
||||
}.to change(post.user.notifications, :count).by(1)
|
||||
end
|
||||
|
||||
it 'does not notifiy a user of the revision made by the system user' do
|
||||
it 'does not notify a user of the revision made by the system user' do
|
||||
expect {
|
||||
post.revise(Discourse.system_user, raw: "world is the new body of the message")
|
||||
}.not_to change(post.user.notifications, :count)
|
||||
|
||||
@@ -442,7 +442,7 @@ describe PostAlerter do
|
||||
expect(n.data_hash["original_username"]).to eq(admin.username)
|
||||
end
|
||||
|
||||
it "doesn't notify the last post editor if they mention themself" do
|
||||
it "doesn't notify the last post editor if they mention themselves" do
|
||||
post = create_post_with_alerts(user: user, raw: 'Post without a mention.')
|
||||
expect {
|
||||
post.revise(evil_trout, raw: "O hai, @eviltrout!")
|
||||
@@ -1215,7 +1215,7 @@ describe PostAlerter do
|
||||
post.topic.allowed_users << staged
|
||||
end
|
||||
|
||||
it "only notifes staff watching added tag" do
|
||||
it "only notifies staff watching added tag" do
|
||||
expect(PostRevisor.new(post).revise!(Fabricate(:admin), tags: [other_tag.name])).to be true
|
||||
expect(Notification.where(user_id: staged.id).count).to eq(0)
|
||||
expect(PostRevisor.new(post).revise!(Fabricate(:admin), tags: [other_tag2.name])).to be true
|
||||
|
||||
@@ -202,7 +202,7 @@ describe SearchIndexer do
|
||||
|
||||
post = Fabricate(:post, topic: topic, raw: <<~RAW)
|
||||
a https://abc.com?bob=1, http://efg.com.au?bill=1 b hij.net/xyz=1
|
||||
www.klm.net/?IGNORE=1 <a href="http://abc.de.nop.co.uk?IGNORE=1&ingore2=2">test</a>
|
||||
www.klm.net/?IGNORE=1 <a href="http://abc.de.nop.co.uk?IGNORE=1&ignore2=2">test</a>
|
||||
RAW
|
||||
|
||||
post.rebake!
|
||||
|
||||
@@ -47,7 +47,7 @@ describe SiteSettingsTask do
|
||||
expect(counts[:not_found]).to eq 1
|
||||
end
|
||||
|
||||
it "will log that an error has occured" do
|
||||
it "will log that an error has occurred" do
|
||||
yml = "min_password_length: 0"
|
||||
log, counts = SiteSettingsTask.import(yml)
|
||||
expect(log[0]).to eq "ERROR: min_password_length: Value must be between 8 and 500."
|
||||
|
||||
@@ -198,7 +198,7 @@ describe UserAnonymizer do
|
||||
expect(history.details).not_to match(orig_username)
|
||||
end
|
||||
|
||||
it "removes external auth assocations" do
|
||||
it "removes external auth associations" do
|
||||
user.user_associated_accounts = [UserAssociatedAccount.create(user_id: user.id, provider_uid: "example", provider_name: "facebook")]
|
||||
user.single_sign_on_record = SingleSignOnRecord.create(user_id: user.id, external_id: "example", last_payload: "looks good")
|
||||
user.oauth2_user_infos = [Oauth2UserInfo.create(user_id: user.id, uid: "example", provider: "example")]
|
||||
|
||||
@@ -44,7 +44,7 @@ describe UserAuthenticator do
|
||||
context "#finish" do
|
||||
fab!(:group) { Fabricate(:group, automatic_membership_email_domains: "discourse.org") }
|
||||
|
||||
it "confirms email and adds the user to appropraite groups based on email" do
|
||||
it "confirms email and adds the user to appropriate groups based on email" do
|
||||
user = Fabricate(:user, email: "user53@discourse.org")
|
||||
expect(group.usernames).not_to include(user.username)
|
||||
|
||||
|
||||
@@ -837,7 +837,7 @@ describe UserMerger do
|
||||
expect(UserEmail.where(user_id: source_user.id).count).to eq(0)
|
||||
end
|
||||
|
||||
it "skips merging email adresses when a secondary email address exists" do
|
||||
it "skips merging email addresses when a secondary email address exists" do
|
||||
merge_users!(source_user, target_user)
|
||||
|
||||
alice2 = Fabricate(:user, username: 'alice2', email: 'alice@foo.com')
|
||||
|
||||
@@ -28,7 +28,7 @@ describe UserNotificationScheduleProcessor do
|
||||
UserNotificationScheduleProcessor.create_do_not_disturb_timings_for(standard_schedule)
|
||||
|
||||
# The default schedule is 8am - 5pm.
|
||||
# Expext DND timings to fill gaps before/after those times for 3 days.
|
||||
# Expect DND timings to fill gaps before/after those times for 3 days.
|
||||
dnd_timings = user.do_not_disturb_timings
|
||||
offset = timezone_info[:offset]
|
||||
expect(dnd_timings[0].starts_at).to eq_time(Time.new(2020, 1, 4, 0, 0, 0, offset))
|
||||
|
||||
@@ -173,7 +173,7 @@ describe UserUpdater do
|
||||
expect(user.user_option.mailing_list_mode).to eq true
|
||||
end
|
||||
|
||||
it "filters theme_ids blank values before updating perferences" do
|
||||
it "filters theme_ids blank values before updating preferences" do
|
||||
user = Fabricate(:user)
|
||||
user.user_option.update!(theme_ids: [1])
|
||||
updater = UserUpdater.new(acting_user, user)
|
||||
|
||||
@@ -4,7 +4,7 @@ require 'rails_helper'
|
||||
|
||||
describe WordWatcher do
|
||||
|
||||
let(:raw) { "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 ;)" }
|
||||
let(:raw) { "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 ;)" }
|
||||
|
||||
after do
|
||||
Discourse.redis.flushdb
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
shared_examples_for 'stats cachable' do
|
||||
shared_examples_for 'stats cacheable' do
|
||||
describe 'fetch_cached_stats' do
|
||||
after do
|
||||
Discourse.redis.del(described_class.stats_cache_key)
|
||||
|
||||
Reference in New Issue
Block a user