]> git.openstreetmap.org Git - rails.git/commitdiff
Turn session-persistence plugin into a library
authorTom Hughes <tom@compton.nu>
Sat, 21 Jan 2012 15:11:35 +0000 (15:11 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 15 Feb 2012 17:48:15 +0000 (17:48 +0000)
config/initializers/session_persistence.rb [new file with mode: 0644]
lib/session_persistence/MIT_LICENSE [moved from vendor/plugins/session-persistence/MIT_LICENSE with 100% similarity]
lib/session_persistence/README.rdoc [moved from vendor/plugins/session-persistence/README.rdoc with 100% similarity]
lib/session_persistence/session_persistence.rb [moved from vendor/plugins/session-persistence/lib/session_persistence.rb with 100% similarity]
vendor/plugins/session-persistence/init.rb [deleted file]
vendor/plugins/session-persistence/test/session_timeout_test.rb [deleted file]

diff --git a/config/initializers/session_persistence.rb b/config/initializers/session_persistence.rb
new file mode 100644 (file)
index 0000000..bb6fb35
--- /dev/null
@@ -0,0 +1,3 @@
+require  "session_persistence/session_persistence"
+ActionController::Base.class_eval { include SessionPersistence }
+ActionController::Base.after_filter :_persist_session
diff --git a/vendor/plugins/session-persistence/init.rb b/vendor/plugins/session-persistence/init.rb
deleted file mode 100644 (file)
index a752ad3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-require  "session_persistence"
-ActionController::Base.class_eval { include SessionPersistence }
-ActionController::Base.after_filter :_persist_session
\ No newline at end of file
diff --git a/vendor/plugins/session-persistence/test/session_timeout_test.rb b/vendor/plugins/session-persistence/test/session_timeout_test.rb
deleted file mode 100644 (file)
index 89c6020..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-require "test/unit"
-
-module ActionController
-  class Base
-    def self.after_filter(*args)
-      
-    end
-  end
-end
-
-$LOAD_PATH.push(File.dirname(__FILE__) + "../lib")
-require "../init"
-
-class SessionPersistenceTest < Test::Unit::TestCase
-  def setup
-    @controller = ActionController::Base.new
-    @controller.instance_eval {
-      def session
-        @session ||= {}
-      end
-      
-      def session_persistence_key
-        :mine
-      end
-    }
-  end
-  
-  def test_session_expires_after
-    @controller.instance_eval { session_expires_after 10 }
-    assert_equal 10, @controller.session[:mine]
-  end
-  
-  def test_session_expires_automatically
-    @controller.instance_eval {
-      session_expires_after 10
-      session_expires_automatically
-    }
-    
-    assert !@controller.session.has_key?(:mine)
-  end
-end
\ No newline at end of file