mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 17:13:25 +08:00
DEV: Allow new_features URL to be configurable (#24306)
This is so the new features plugin can be tested easier locally.
This commit is contained in:
@ -218,6 +218,11 @@ module DiscourseUpdates
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new_features_endpoint
|
||||||
|
return "https://meta.discourse.org/new-features.json" if Rails.env.production?
|
||||||
|
ENV["DISCOURSE_NEW_FEATURES_ENDPOINT"] || "http://localhost:4200/new-features.json"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def last_installed_version_key
|
def last_installed_version_key
|
||||||
@ -248,10 +253,6 @@ module DiscourseUpdates
|
|||||||
"missing_version"
|
"missing_version"
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_features_endpoint
|
|
||||||
"https://meta.discourse.org/new-features.json"
|
|
||||||
end
|
|
||||||
|
|
||||||
def new_features_key
|
def new_features_key
|
||||||
"new_features"
|
"new_features"
|
||||||
end
|
end
|
||||||
|
@ -15,8 +15,8 @@ RSpec.describe Jobs::CheckNewFeatures do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def stub_meta_new_features_endpoint(*features)
|
def stub_new_features_endpoint(*features)
|
||||||
stub_request(:get, "https://meta.discourse.org/new-features.json").to_return(
|
stub_request(:get, DiscourseUpdates.new_features_endpoint).to_return(
|
||||||
status: 200,
|
status: 200,
|
||||||
body: JSON.dump(features),
|
body: JSON.dump(features),
|
||||||
headers: {
|
headers: {
|
||||||
@ -43,7 +43,7 @@ RSpec.describe Jobs::CheckNewFeatures do
|
|||||||
before do
|
before do
|
||||||
DiscourseUpdates.stubs(:current_version).returns("2.8.1.beta13")
|
DiscourseUpdates.stubs(:current_version).returns("2.8.1.beta13")
|
||||||
freeze_time
|
freeze_time
|
||||||
stub_meta_new_features_endpoint(feature1, feature2, pending_feature)
|
stub_new_features_endpoint(feature1, feature2, pending_feature)
|
||||||
end
|
end
|
||||||
|
|
||||||
after { DiscourseUpdates.clean_state }
|
after { DiscourseUpdates.clean_state }
|
||||||
|
Reference in New Issue
Block a user