FIX: Regression introduced in #14715 (#14842)

FIX: Regression introduced in #14715 (#14842)

  • FIX: Regression introduced in #14715

Wrong method names were used to get Redis keys.

  • DEV: Remove more stubs
diff --git a/lib/discourse_updates.rb b/lib/discourse_updates.rb
index 297cda6..c7450fe 100644
--- a/lib/discourse_updates.rb
+++ b/lib/discourse_updates.rb
@@ -62,7 +62,7 @@ module DiscourseUpdates
     end
 
     def last_installed_version=(arg)
-      Discourse.redis.set(last_installed_version, arg)
+      Discourse.redis.set(last_installed_version_key, arg)
     end
 
     def latest_version
@@ -70,7 +70,7 @@ module DiscourseUpdates
     end
 
     def latest_version=(arg)
-      Discourse.redis.set(latest_version, arg)
+      Discourse.redis.set(latest_version_key, arg)
     end
 
     def missing_versions_count
diff --git a/spec/components/discourse_updates_spec.rb b/spec/components/discourse_updates_spec.rb
index 8cb95dd..dbe653f 100644
--- a/spec/components/discourse_updates_spec.rb
+++ b/spec/components/discourse_updates_spec.rb
@@ -3,27 +3,18 @@
 require 'rails_helper'
 
 describe DiscourseUpdates do
-  let(:latest_version_key) { DiscourseUpdates.send(:latest_version_key) }
-  let(:missing_versions_count_key) { DiscourseUpdates.send(:missing_versions_count_key) }
-  let(:critical_updates_available_key) { DiscourseUpdates.send(:critical_updates_available_key) }
-  let(:updated_at_key) { DiscourseUpdates.send(:updated_at_key) }
-
   def stub_data(latest, missing, critical, updated_at)
-    Discourse.redis.set(latest_version_key, latest)
-    Discourse.redis.set(missing_versions_count_key, missing)
-    Discourse.redis.set(critical_updates_available_key, critical)
-    Discourse.redis.set(updated_at_key, updated_at)
-  end
-
-  before do
-    Jobs::VersionCheck.any_instance.stubs(:execute).returns(true)
+    DiscourseUpdates.latest_version = latest
+    DiscourseUpdates.missing_versions_count = missing
+    DiscourseUpdates.critical_updates_available = critical
+    DiscourseUpdates.updated_at = updated_at
   end
 
   subject { DiscourseUpdates.check_version }
 
   context 'version check was done at the current installed version' do
     before do
-      DiscourseUpdates.stubs(:last_installed_version).returns(Discourse::VERSION::STRING)
+      DiscourseUpdates.last_installed_version = Discourse::VERSION::STRING
     end
 
     context 'a good version check request happened recently' do
@@ -119,7 +110,7 @@ describe DiscourseUpdates do
 
   context 'version check was done at a different installed version' do
     before do
-      DiscourseUpdates.stubs(:last_installed_version).returns('0.9.1')
+      DiscourseUpdates.last_installed_version = '0.9.1'
     end
 
     shared_examples "when last_installed_version is old" do
@@ -215,7 +206,7 @@ describe DiscourseUpdates do
       ]
 
       Discourse.redis.set('new_features', MultiJson.dump(features_with_versions))
-      DiscourseUpdates.stubs(:last_installed_version).returns("2.7.0.beta2")
+      DiscourseUpdates.last_installed_version = "2.7.0.beta2"
       result = DiscourseUpdates.new_features
 
       expect(result.length).to eq(3)

GitHub sha: 46fed1303f953604eaddcb3cac58d74142f31ba3

This commit appears in #14842 which was approved by CvX. It was merged by SamSaffron.