mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06: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
25 lines
999 B
Ruby
25 lines
999 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe ChildTheme do
|
|
describe "validations" do
|
|
it "doesn't allow children to become parents or parents to become children" do
|
|
theme = Fabricate(:theme)
|
|
child = Fabricate(:theme, component: true)
|
|
|
|
child_theme = ChildTheme.new(parent_theme: theme, child_theme: child)
|
|
expect(child_theme.valid?).to eq(true)
|
|
child_theme.save!
|
|
|
|
grandchild = Fabricate(:theme, component: true)
|
|
child_theme = ChildTheme.new(parent_theme: child, child_theme: grandchild)
|
|
expect(child_theme.valid?).to eq(false)
|
|
expect(child_theme.errors.full_messages).to contain_exactly(I18n.t("themes.errors.no_multilevels_components"))
|
|
|
|
grandparent = Fabricate(:theme)
|
|
child_theme = ChildTheme.new(parent_theme: grandparent, child_theme: theme)
|
|
expect(child_theme.valid?).to eq(false)
|
|
expect(child_theme.errors.full_messages).to contain_exactly(I18n.t("themes.errors.no_multilevels_components"))
|
|
end
|
|
end
|
|
end
|