mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:49:06 +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:
parent
e5e7dd78c2
commit
e772bb9fce
|
@ -218,6 +218,11 @@ module DiscourseUpdates
|
|||
)
|
||||
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
|
||||
|
||||
def last_installed_version_key
|
||||
|
@ -248,10 +253,6 @@ module DiscourseUpdates
|
|||
"missing_version"
|
||||
end
|
||||
|
||||
def new_features_endpoint
|
||||
"https://meta.discourse.org/new-features.json"
|
||||
end
|
||||
|
||||
def new_features_key
|
||||
"new_features"
|
||||
end
|
||||
|
|
|
@ -15,8 +15,8 @@ RSpec.describe Jobs::CheckNewFeatures do
|
|||
}
|
||||
end
|
||||
|
||||
def stub_meta_new_features_endpoint(*features)
|
||||
stub_request(:get, "https://meta.discourse.org/new-features.json").to_return(
|
||||
def stub_new_features_endpoint(*features)
|
||||
stub_request(:get, DiscourseUpdates.new_features_endpoint).to_return(
|
||||
status: 200,
|
||||
body: JSON.dump(features),
|
||||
headers: {
|
||||
|
@ -43,7 +43,7 @@ RSpec.describe Jobs::CheckNewFeatures do
|
|||
before do
|
||||
DiscourseUpdates.stubs(:current_version).returns("2.8.1.beta13")
|
||||
freeze_time
|
||||
stub_meta_new_features_endpoint(feature1, feature2, pending_feature)
|
||||
stub_new_features_endpoint(feature1, feature2, pending_feature)
|
||||
end
|
||||
|
||||
after { DiscourseUpdates.clean_state }
|
||||
|
|
Loading…
Reference in New Issue
Block a user