DEV: Use proper wording for contexts in specs

This commit is contained in:
Loïc Guitaut
2022-07-27 18:14:14 +02:00
committed by Loïc Guitaut
parent 02987e05d5
commit 3eaac56797
337 changed files with 2172 additions and 2723 deletions

View File

@ -3,7 +3,6 @@
require 'suggested_topics_builder'
RSpec.describe SuggestedTopicsBuilder do
fab!(:topic) { Fabricate(:topic) }
let(:builder) { SuggestedTopicsBuilder.new(topic) }
@ -11,8 +10,7 @@ RSpec.describe SuggestedTopicsBuilder do
SiteSetting.suggested_topics = 5
end
context "splicing category results" do
describe "splicing category results" do
def fake_topic(topic_id, category_id)
build(:topic, id: topic_id, category_id: category_id)
end
@ -57,8 +55,7 @@ RSpec.describe SuggestedTopicsBuilder do
expect(builder).to be_full
end
context "adding results" do
describe "adding results" do
it "adds nothing with nil results" do
builder.add_results(nil)
expect(builder.results_left).to eq(5)
@ -66,7 +63,7 @@ RSpec.describe SuggestedTopicsBuilder do
expect(builder).not_to be_full
end
context "adding topics" do
context "when adding topics" do
fab!(:other_topic) { Fabricate(:topic) }
before do
@ -81,10 +78,9 @@ RSpec.describe SuggestedTopicsBuilder do
expect(builder.excluded_topic_ids.include?(topic.id)).to eq(true)
expect(builder.excluded_topic_ids.include?(other_topic.id)).to eq(true)
end
end
context "adding topics that are not open" do
context "when adding topics that are not open" do
fab!(:archived_topic) { Fabricate(:topic, archived: true) }
fab!(:closed_topic) { Fabricate(:topic, closed: true) }
fab!(:invisible_topic) { Fabricate(:topic, visible: false) }
@ -96,7 +92,7 @@ RSpec.describe SuggestedTopicsBuilder do
end
end
context "category definition topics" do
context "when category definition topics" do
fab!(:category) { Fabricate(:category_with_definition) }
it "doesn't add a category definition topic" do
@ -106,7 +102,5 @@ RSpec.describe SuggestedTopicsBuilder do
expect(builder).not_to be_full
end
end
end
end