mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: update syntax tree to latest (#24623)
update format to latest syntax tree
This commit is contained in:
@@ -25,27 +25,27 @@ RSpec.describe BackupRestore::S3BackupStore do
|
||||
|
||||
@s3_client.stub_responses(
|
||||
:list_objects_v2,
|
||||
->(context) {
|
||||
->(context) do
|
||||
check_context(context)
|
||||
|
||||
{ contents: objects_with_prefix(context) }
|
||||
},
|
||||
end,
|
||||
)
|
||||
|
||||
@s3_client.stub_responses(
|
||||
:delete_object,
|
||||
->(context) {
|
||||
->(context) do
|
||||
check_context(context)
|
||||
|
||||
expect do @objects.delete_if { |obj| obj[:key] == context.params[:key] } end.to change {
|
||||
@objects
|
||||
}
|
||||
},
|
||||
end,
|
||||
)
|
||||
|
||||
@s3_client.stub_responses(
|
||||
:head_object,
|
||||
->(context) {
|
||||
->(context) do
|
||||
check_context(context)
|
||||
|
||||
if object = @objects.find { |obj| obj[:key] == context.params[:key] }
|
||||
@@ -53,12 +53,12 @@ RSpec.describe BackupRestore::S3BackupStore do
|
||||
else
|
||||
{ status_code: 404, headers: {}, body: "" }
|
||||
end
|
||||
},
|
||||
end,
|
||||
)
|
||||
|
||||
@s3_client.stub_responses(
|
||||
:get_object,
|
||||
->(context) {
|
||||
->(context) do
|
||||
check_context(context)
|
||||
|
||||
if object = @objects.find { |obj| obj[:key] == context.params[:key] }
|
||||
@@ -66,12 +66,12 @@ RSpec.describe BackupRestore::S3BackupStore do
|
||||
else
|
||||
{ status_code: 404, headers: {}, body: "" }
|
||||
end
|
||||
},
|
||||
end,
|
||||
)
|
||||
|
||||
@s3_client.stub_responses(
|
||||
:put_object,
|
||||
->(context) {
|
||||
->(context) do
|
||||
check_context(context)
|
||||
|
||||
@objects << {
|
||||
@@ -79,7 +79,7 @@ RSpec.describe BackupRestore::S3BackupStore do
|
||||
size: context.params[:body].size,
|
||||
last_modified: Time.zone.now,
|
||||
}
|
||||
},
|
||||
end,
|
||||
)
|
||||
|
||||
SiteSetting.s3_backup_bucket = "s3-backup-bucket"
|
||||
|
||||
@@ -130,9 +130,9 @@ RSpec.describe InlineOneboxer do
|
||||
topic = Fabricate(:topic, title: "Inline oneboxer")
|
||||
Fabricate(:post, topic: topic) # OP
|
||||
Fabricate(:post, topic: topic)
|
||||
lookup = ->(number) {
|
||||
lookup = ->(number) do
|
||||
InlineOneboxer.lookup("#{topic.url}/#{number}", skip_cache: true)[:title]
|
||||
}
|
||||
end
|
||||
posts = topic.reload.posts.order("post_number ASC")
|
||||
|
||||
expect(lookup.call(0)).to eq("Inline oneboxer")
|
||||
|
||||
@@ -667,10 +667,10 @@ RSpec.describe Middleware::RequestTracker do
|
||||
end
|
||||
|
||||
let(:logger) do
|
||||
->(env, data) {
|
||||
->(env, data) do
|
||||
@env = env
|
||||
@data = data
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
before { Middleware::RequestTracker.register_detailed_request_logger(logger) }
|
||||
|
||||
@@ -382,9 +382,9 @@ RSpec.describe NewPostManager do
|
||||
result
|
||||
end
|
||||
|
||||
@queue_handler = ->(manager) {
|
||||
@queue_handler = ->(manager) do
|
||||
manager.args[:raw] =~ /queue me/ ? manager.enqueue("default") : nil
|
||||
}
|
||||
end
|
||||
|
||||
NewPostManager.add_handler(&@counter_handler)
|
||||
NewPostManager.add_handler(&@queue_handler)
|
||||
|
||||
@@ -771,12 +771,12 @@ RSpec.describe Plugin::Instance do
|
||||
to: Notification.types[:code_review_commit_approved],
|
||||
threshold: 1,
|
||||
consolidation_window: 1.minute,
|
||||
unconsolidated_query_blk: ->(notifications, _data) {
|
||||
unconsolidated_query_blk: ->(notifications, _data) do
|
||||
notifications.where("(data::json ->> 'consolidated') IS NULL")
|
||||
},
|
||||
consolidated_query_blk: ->(notifications, _data) {
|
||||
end,
|
||||
consolidated_query_blk: ->(notifications, _data) do
|
||||
notifications.where("(data::json ->> 'consolidated') IS NOT NULL")
|
||||
},
|
||||
end,
|
||||
).set_mutations(
|
||||
set_data_blk: ->(notification) { notification.data_hash.merge(consolidated: true) },
|
||||
)
|
||||
|
||||
@@ -391,11 +391,11 @@ RSpec.describe PostDestroyer do
|
||||
user_stat = post2.user.user_stat
|
||||
|
||||
called = 0
|
||||
topic_destroyed = ->(topic, user) {
|
||||
topic_destroyed = ->(topic, user) do
|
||||
expect(topic).to eq(post2.topic)
|
||||
expect(user).to eq(post2.user)
|
||||
called += 1
|
||||
}
|
||||
end
|
||||
|
||||
DiscourseEvent.on(:topic_destroyed, &topic_destroyed)
|
||||
|
||||
@@ -414,11 +414,11 @@ RSpec.describe PostDestroyer do
|
||||
expect(user_stat.reload.topic_count).to eq(1)
|
||||
|
||||
called = 0
|
||||
topic_recovered = ->(topic, user) {
|
||||
topic_recovered = ->(topic, user) do
|
||||
expect(topic).to eq(post2.topic)
|
||||
expect(user).to eq(post2.user)
|
||||
called += 1
|
||||
}
|
||||
end
|
||||
|
||||
DiscourseEvent.on(:topic_recovered, &topic_recovered)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ RSpec.describe "S3Inventory" do
|
||||
|
||||
client.stub_responses(
|
||||
:list_objects,
|
||||
->(context) {
|
||||
->(context) do
|
||||
expect(context.params[:prefix]).to eq(
|
||||
"#{S3Inventory::INVENTORY_PREFIX}/#{S3Inventory::INVENTORY_VERSION}/bucket/original/hive",
|
||||
)
|
||||
@@ -48,7 +48,7 @@ RSpec.describe "S3Inventory" do
|
||||
],
|
||||
next_marker: "eyJNYXJrZXIiOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==",
|
||||
}
|
||||
},
|
||||
end,
|
||||
)
|
||||
|
||||
inventory.stubs(:cleanup!)
|
||||
|
||||
@@ -206,14 +206,14 @@ RSpec.describe Report do
|
||||
if arg == :flag
|
||||
user = Fabricate(:user)
|
||||
topic = Fabricate(:topic, user: user)
|
||||
builder = ->(dt) {
|
||||
builder = ->(dt) do
|
||||
PostActionCreator.create(
|
||||
user,
|
||||
Fabricate(:post, topic: topic, user: user),
|
||||
:spam,
|
||||
created_at: dt,
|
||||
)
|
||||
}
|
||||
end
|
||||
elsif arg == :signup
|
||||
builder = ->(dt) { Fabricate(:user, created_at: dt) }
|
||||
else
|
||||
|
||||
@@ -590,10 +590,10 @@ RSpec.describe TopicUser do
|
||||
|
||||
called = 0
|
||||
visits = []
|
||||
user_first_visit = ->(topic_id, user_id) {
|
||||
user_first_visit = ->(topic_id, user_id) do
|
||||
visits << "#{topic_id}-#{user_id}"
|
||||
called += 1
|
||||
}
|
||||
end
|
||||
|
||||
DiscourseEvent.on(:topic_first_visited_by_user, &user_first_visit)
|
||||
|
||||
|
||||
@@ -309,11 +309,11 @@ RSpec.describe TopicsController do
|
||||
begin
|
||||
called = false
|
||||
|
||||
assert = ->(original_topic, destination_topic) {
|
||||
assert = ->(original_topic, destination_topic) do
|
||||
called = true
|
||||
expect(original_topic).to eq(topic)
|
||||
expect(destination_topic).to eq(dest_topic)
|
||||
}
|
||||
end
|
||||
|
||||
DiscourseEvent.on(:topic_merged, &assert)
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ RSpec.describe UserSilencer do
|
||||
|
||||
context "with a plugin hook" do
|
||||
before do
|
||||
@override_silence_message = ->(opts) {
|
||||
@override_silence_message = ->(opts) do
|
||||
opts[:silence_message_params][:message_title] = "override title"
|
||||
opts[:silence_message_params][:message_raw] = "override raw"
|
||||
}
|
||||
end
|
||||
|
||||
DiscourseEvent.on(:user_silenced, &@override_silence_message)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user