mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Refactor Theme#settings to return a hash instead of array (#25516)
Why this change? Returning an array makes it hard to immediately retrieve a setting by name and makes the retrieval an O(N) operation. By returning an array, we make it easier for us to lookup a setting by name and retrieval is O(1) as well.
This commit is contained in:
committed by
GitHub
parent
fb469e7e2f
commit
44f8418093
@@ -198,7 +198,7 @@ RSpec.describe RemoteTheme do
|
||||
expect(mapped.length).to eq(12)
|
||||
|
||||
expect(theme.settings.length).to eq(1)
|
||||
expect(theme.settings.first.value).to eq(true)
|
||||
expect(theme.settings[:boolean_setting].value).to eq(true)
|
||||
|
||||
expect(remote.remote_updated_at).to eq_time(time)
|
||||
|
||||
@@ -247,7 +247,7 @@ RSpec.describe RemoteTheme do
|
||||
expect(mapped["1-scss"]).to eq(scss_data)
|
||||
|
||||
expect(theme.settings.length).to eq(1)
|
||||
expect(theme.settings.first.value).to eq(32)
|
||||
expect(theme.settings[:integer_setting].value).to eq(32)
|
||||
|
||||
expect(remote.remote_updated_at).to eq_time(time)
|
||||
expect(remote.about_url).to eq("https://newsite.com/about")
|
||||
|
||||
Reference in New Issue
Block a user