about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/fabricators/session_activation_fabricator.rb4
-rw-r--r--spec/models/session_activation_spec.rb5
-rw-r--r--spec/rails_helper.rb11
3 files changed, 20 insertions, 0 deletions
diff --git a/spec/fabricators/session_activation_fabricator.rb b/spec/fabricators/session_activation_fabricator.rb
new file mode 100644
index 000000000..46050bdab
--- /dev/null
+++ b/spec/fabricators/session_activation_fabricator.rb
@@ -0,0 +1,4 @@
+Fabricator(:session_activation) do
+  user_id    1
+  session_id "MyString"
+end
diff --git a/spec/models/session_activation_spec.rb b/spec/models/session_activation_spec.rb
new file mode 100644
index 000000000..49c72fbd4
--- /dev/null
+++ b/spec/models/session_activation_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe SessionActivation, type: :model do
+  pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index c9bdc8add..31c94b1e4 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -16,6 +16,17 @@ WebMock.disable_net_connect!
 Sidekiq::Testing.inline!
 Sidekiq::Logging.logger = nil
 
+Devise::Test::ControllerHelpers.module_eval do
+  alias_method :original_sign_in, :sign_in
+
+  def sign_in(resource, deprecated = nil, scope: nil)
+    original_sign_in(resource, scope: scope)
+
+    SessionActivation.deactivate warden.raw_session["auth_id"]
+    warden.raw_session["auth_id"] = resource.activate_session
+  end
+end
+
 RSpec.configure do |config|
   config.fixture_path = "#{::Rails.root}/spec/fixtures"
   config.use_transactional_fixtures = true