diff options
author | Azul <azul@riseup.net> | 2016-03-24 14:14:18 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-05-02 08:28:44 -0300 |
commit | 4bfbeedd9cf5f0f2a4b364764afd9c6acdc7399f (patch) | |
tree | 73179bde2951099510f6f99138192378cd4d543a /vendor/gems/couchrest_session_store/test | |
parent | 5d18e8c396181ee8fab3f8579bc19abaee106d52 (diff) |
upgrade: separate CouchRest::Session from Document
CouchRest::Session now offers the high leven API while
CouchRest::Session::Document only extends the CouchRest::Document
to have the properties (rotation, naming, etc...) that we want.
A Session has a Session::Document instead of inheriting from it.
Diffstat (limited to 'vendor/gems/couchrest_session_store/test')
-rw-r--r-- | vendor/gems/couchrest_session_store/test/session_document_test.rb | 22 | ||||
-rw-r--r-- | vendor/gems/couchrest_session_store/test/session_store_test.rb | 6 |
2 files changed, 14 insertions, 14 deletions
diff --git a/vendor/gems/couchrest_session_store/test/session_document_test.rb b/vendor/gems/couchrest_session_store/test/session_document_test.rb index 2125d10..43fbbca 100644 --- a/vendor/gems/couchrest_session_store/test/session_document_test.rb +++ b/vendor/gems/couchrest_session_store/test/session_document_test.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.dirname(__FILE__) + '/test_helper') +require_relative 'test_helper' class SessionDocumentTest < MiniTest::Test @@ -6,22 +6,22 @@ class SessionDocumentTest < MiniTest::Test sid = '1234' session = {'a' => 'b'} options = {} - doc = CouchRest::Session::Document.build_or_update(sid, session, options) - doc.save - doc.fetch(sid) - assert_equal session, doc.to_session + couchrest_session = CouchRest::Session.build_or_update(sid, session, options) + couchrest_session.save + couchrest_session.fetch(sid) + assert_equal session, couchrest_session.to_session end def test_storing_session_with_conflict sid = '1234' session = {'a' => 'b'} options = {} - doc = CouchRest::Session::Document.build_or_update(sid, session, options) - doc2 = CouchRest::Session::Document.build_or_update(sid, session, options) - doc.save - doc2.save - doc2.fetch(sid) - assert_equal session, doc2.to_session + cr_session = CouchRest::Session.build_or_update(sid, session, options) + cr_session2 = CouchRest::Session.build_or_update(sid, session, options) + cr_session.save + cr_session2.save + cr_session2.fetch(sid) + assert_equal session, cr_session2.to_session end end diff --git a/vendor/gems/couchrest_session_store/test/session_store_test.rb b/vendor/gems/couchrest_session_store/test/session_store_test.rb index 4fbf30b..5949ae6 100644 --- a/vendor/gems/couchrest_session_store/test/session_store_test.rb +++ b/vendor/gems/couchrest_session_store/test/session_store_test.rb @@ -64,10 +64,10 @@ class SessionStoreTest < MiniTest::Test def test_stored_and_not_expired_yet sid, session = expiring_session - doc = CouchRest::Session::Document.fetch(sid) - expires = doc.send :expires + couchrest_session = CouchRest::Session.fetch(sid) + expires = couchrest_session.send :expires assert expires - assert !doc.expired? + assert !couchrest_session.expired? assert (expires - Time.now) > 0, "Exiry should be in the future" assert (expires - Time.now) <= 300, "Should expire after 300 seconds - not more" assert_equal [sid, session], store.send(:get_session, env, sid) |