FEATURE: Log staff actions for Category changes.

This commit is contained in:
Guo Xiang Tan
2015-09-17 15:51:32 +08:00
parent c29b7ce498
commit f39b9124b6
13 changed files with 228 additions and 7 deletions

View File

@ -64,6 +64,7 @@ describe CategoriesController do
expect(category.slug).to eq("hello-cat")
expect(category.color).to eq("ff0")
expect(category.auto_close_hours).to eq(72)
expect(UserHistory.count).to eq(1)
end
end
end
@ -90,6 +91,7 @@ describe CategoriesController do
it "deletes the record" do
Guardian.any_instance.expects(:can_delete_category?).returns(true)
expect { xhr :delete, :destroy, id: @category.slug}.to change(Category, :count).by(-1)
expect(UserHistory.count).to eq(1)
end
end
@ -215,6 +217,17 @@ describe CategoriesController do
expect(@category.auto_close_hours).to eq(72)
expect(@category.custom_fields).to eq({"dancing" => "frogs"})
end
it 'logs the changes correctly' do
xhr :put , :update, id: @category.id, name: 'new name',
color: @category.color, text_color: @category.text_color,
slug: @category.slug,
permissions: {
"everyone" => CategoryGroup.permission_types[:create_post]
}
expect(UserHistory.count).to eq(2)
end
end
end