mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 04:53:51 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
24 lines
838 B
Ruby
24 lines
838 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe TopicsHelper do
|
|
|
|
describe "#categories_breadcrumb" do
|
|
let(:user) { Fabricate(:user) }
|
|
|
|
let(:category) { Fabricate(:category_with_definition) }
|
|
let(:subcategory) { Fabricate(:category_with_definition, parent_category_id: category.id) }
|
|
let(:subsubcategory) { Fabricate(:category_with_definition, parent_category_id: subcategory.id) }
|
|
|
|
it "works with sub-sub-categories" do
|
|
SiteSetting.max_category_nesting = 3
|
|
topic = Fabricate(:topic, category: subsubcategory)
|
|
|
|
breadcrumbs = helper.categories_breadcrumb(topic)
|
|
expect(breadcrumbs.length).to eq(3)
|
|
expect(breadcrumbs[0][:name]).to eq(category.name)
|
|
expect(breadcrumbs[1][:name]).to eq(subcategory.name)
|
|
expect(breadcrumbs[2][:name]).to eq(subsubcategory.name)
|
|
end
|
|
end
|
|
end
|