Module: DoorMat::TestHelper
- Defined in:
- lib/door_mat/test_helper.rb
Class Method Summary collapse
- .create_signed_in_actor_with_confirmed_email_address(address = "[email protected]", password = "n7f3d;3#)") ⇒ Object
- .create_signed_up_actor_with_confirmed_email_address(address = "[email protected]", password = "n7f3d;3#)") ⇒ Object
- .sign_in_existing_actor(address = "[email protected]", password = "n7f3d;3#)") ⇒ Object
- .sign_out(session) ⇒ Object
Class Method Details
.create_signed_in_actor_with_confirmed_email_address(address = "[email protected]", password = "n7f3d;3#)") ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/door_mat/test_helper.rb', line 10 def self.create_signed_in_actor_with_confirmed_email_address(address="[email protected]", password="n7f3d;3#)") DoorMat::Session.clear_current_session actor = DoorMat::Actor.create_with(password) email = DoorMat::Email.for(address) email.status = :primary session = DoorMat::Session.new session.ip = "request.remote_ip" session.agent = "request.user_agent" actor.current_email = email RequestStore.store[:current_session] = session.initialize_with(actor, password) actor.sessions << DoorMat::Session.current_session actor.emails << email # setup public key pairs actor.setup_public_key_pairs(DoorMat::Session.current_session) actor.save! DoorMat::ActivityDownloadRecoveryKey.for(actor) [actor, RequestStore.store[:current_session]] end |
.create_signed_up_actor_with_confirmed_email_address(address = "[email protected]", password = "n7f3d;3#)") ⇒ Object
4 5 6 7 8 |
# File 'lib/door_mat/test_helper.rb', line 4 def self.create_signed_up_actor_with_confirmed_email_address(address="[email protected]", password="n7f3d;3#)") actor, _ = create_signed_in_actor_with_confirmed_email_address(address, password) DoorMat::Session.clear_current_session actor end |
.sign_in_existing_actor(address = "[email protected]", password = "n7f3d;3#)") ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/door_mat/test_helper.rb', line 36 def self.sign_in_existing_actor(address="[email protected]", password="n7f3d;3#)") DoorMat::Session.clear_current_session actor = DoorMat::Actor.authenticate_with(address, password) session = DoorMat::Session.new session.ip = "request.remote_ip" session.agent = "request.user_agent" RequestStore.store[:current_session] = session.initialize_with(actor, password) actor.sessions << DoorMat::Session.current_session actor.save! [actor, RequestStore.store[:current_session]] end |
.sign_out(session) ⇒ Object
52 53 54 55 |
# File 'lib/door_mat/test_helper.rb', line 52 def self.sign_out(session) session.destroy! if session.persisted? RequestStore.store[:current_session] = nil end |