Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Actually added the preferences.save method which synchronizes changes…

… to disk.
  • Loading branch information...
commit be373e2d480436e9f37ce292651de9f546ed5a8c 1 parent 28ca075
@alloy authored
Showing with 10 additions and 0 deletions.
  1. +5 −0 lib/abstract_preferences.rb
  2. +5 −0 test/abstract_preferences_test.rb
View
5 lib/abstract_preferences.rb
@@ -3,6 +3,11 @@
class Preferences
include Singleton
+ # Save any unsaved changes to disk.
+ def save
+ Preferences.user_defaults.synchronize
+ end
+
class << self
# A shortcut method for access to <tt>OSX::NSUserDefaults.standardUserDefaults</tt>.
def user_defaults
View
5 test/abstract_preferences_test.rb
@@ -24,6 +24,11 @@ class Preferences
Preferences::TestDefaults.superclass.should == Preferences::AbstractPreferencesNamespace
preferences.should.respond_to :test_defaults
end
+
+ it "should synchronize changes to disk" do
+ OSX::NSUserDefaults.standardUserDefaults.expects(:synchronize)
+ preferences.save
+ end
end
describe "Preferences::AbstractPreferencesNamespace" do
Please sign in to comment.
Something went wrong with that request. Please try again.