mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: should not raise error when minimum_required_tags value not defined for category. (#27658)
While creating a new category if the user didn't specify a value for `minimum_required_tags` input but clicked it then it returned the "PG::NotNullViolation: null value in column 'minimum_required_tags'" error.
This commit is contained in:
parent
0b3b101c97
commit
e8a41011eb
@ -57,6 +57,7 @@ export default class NewCategory extends DiscourseRoute {
|
|||||||
search_priority: SEARCH_PRIORITIES.normal,
|
search_priority: SEARCH_PRIORITIES.normal,
|
||||||
required_tag_groups: [],
|
required_tag_groups: [],
|
||||||
form_template_ids: [],
|
form_template_ids: [],
|
||||||
|
minimum_required_tags: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
spec/system/new_category_spec.rb
Normal file
24
spec/system/new_category_spec.rb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
describe "New Category", type: :system do
|
||||||
|
fab!(:admin)
|
||||||
|
let(:category_page) { PageObjects::Pages::Category.new }
|
||||||
|
|
||||||
|
before { sign_in(admin) }
|
||||||
|
|
||||||
|
it "should create category with 0 in minimum_required_tags column when not defined" do
|
||||||
|
category_page.visit_new_category
|
||||||
|
|
||||||
|
category_page.find(".edit-category-tab-general input.category-name").fill_in(
|
||||||
|
with: "New Category",
|
||||||
|
)
|
||||||
|
category_page.find(".edit-category-nav .edit-category-tags a").click
|
||||||
|
category_page.find(".edit-category-tab-tags #category-minimum-tags").click
|
||||||
|
category_page.save_settings
|
||||||
|
|
||||||
|
expect(page).to have_current_path("/c/new-category/edit/general")
|
||||||
|
|
||||||
|
category_page.find(".edit-category-nav .edit-category-tags a").click
|
||||||
|
expect(category_page.find(".edit-category-tab-tags #category-minimum-tags").value).to eq("0")
|
||||||
|
end
|
||||||
|
end
|
@ -20,6 +20,16 @@ module PageObjects
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def visit_categories
|
||||||
|
page.visit("/categories")
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def visit_new_category
|
||||||
|
page.visit("/new-category")
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
def back_to_category
|
def back_to_category
|
||||||
find(".edit-category-title-bar span", text: "Back to category").click
|
find(".edit-category-title-bar span", text: "Back to category").click
|
||||||
self
|
self
|
||||||
|
Loading…
Reference in New Issue
Block a user