mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 13:35:20 -05:00
DEV: Apply syntax_tree formatting to spec/*
This commit is contained in:
@@ -11,20 +11,22 @@ RSpec.describe DirectoryColumnsController do
|
||||
|
||||
get "/directory-columns.json"
|
||||
|
||||
expect(response.parsed_body["directory_columns"].map { |dc| dc["name"] }).not_to include("likes_given")
|
||||
expect(response.parsed_body["directory_columns"].map { |dc| dc["name"] }).not_to include(
|
||||
"likes_given",
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#edit-index" do
|
||||
fab!(:public_user_field) { Fabricate(:user_field, show_on_profile: true) }
|
||||
fab!(:private_user_field) { Fabricate(:user_field, show_on_profile: false, show_on_user_card: false) }
|
||||
fab!(:private_user_field) do
|
||||
Fabricate(:user_field, show_on_profile: false, show_on_user_card: false)
|
||||
end
|
||||
|
||||
it "creates directory column records for public user fields" do
|
||||
sign_in(admin)
|
||||
|
||||
expect {
|
||||
get "/edit-directory-columns.json"
|
||||
}.to change { DirectoryColumn.count }.by(1)
|
||||
expect { get "/edit-directory-columns.json" }.to change { DirectoryColumn.count }.by(1)
|
||||
end
|
||||
|
||||
it "returns a 403 when not logged in as staff member" do
|
||||
@@ -38,29 +40,29 @@ RSpec.describe DirectoryColumnsController do
|
||||
describe "#update" do
|
||||
let(:first_directory_column_id) { DirectoryColumn.first.id }
|
||||
let(:second_directory_column_id) { DirectoryColumn.second.id }
|
||||
let(:params) {
|
||||
let(:params) do
|
||||
{
|
||||
directory_columns: {
|
||||
"0": {
|
||||
id: first_directory_column_id,
|
||||
enabled: false,
|
||||
position: 1
|
||||
position: 1,
|
||||
},
|
||||
"1": {
|
||||
id: second_directory_column_id,
|
||||
enabled: true,
|
||||
position: 1
|
||||
}
|
||||
}
|
||||
position: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it "updates exising directory columns" do
|
||||
sign_in(admin)
|
||||
|
||||
expect {
|
||||
put "/edit-directory-columns.json", params: params
|
||||
}.to change { DirectoryColumn.find(first_directory_column_id).enabled }.from(true).to(false)
|
||||
expect { put "/edit-directory-columns.json", params: params }.to change {
|
||||
DirectoryColumn.find(first_directory_column_id).enabled
|
||||
}.from(true).to(false)
|
||||
end
|
||||
|
||||
it "does not let all columns be disabled" do
|
||||
|
||||
Reference in New Issue
Block a user