diff --git a/spec/models/remote_storage_authorization_spec.rb b/spec/models/remote_storage_authorization_spec.rb index 1791ab2..378ebb6 100644 --- a/spec/models/remote_storage_authorization_spec.rb +++ b/spec/models/remote_storage_authorization_spec.rb @@ -11,9 +11,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do end describe "#create" do - before(:each) { redis_rs_delete_keys("authorizations:*") } after(:each) { clear_enqueued_jobs } - after(:all) { redis_rs_delete_keys("authorizations:*") } let(:auth) do user.remote_storage_authorizations.create!( @@ -49,7 +47,6 @@ RSpec.describe RemoteStorageAuthorization, type: :model do describe "#destroy" do after(:each) { clear_enqueued_jobs } - after(:all) { redis_rs_delete_keys("authorizations:*") } it "removes the token from redis" do auth = user.remote_storage_authorizations.create!( @@ -59,7 +56,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do ) auth.destroy! - expect(redis_rs.keys("authorizations:#{user.address}:*")).to be_empty + expect(redis_rs.exists?("authorizations:#{user.cn}:#{auth.token}")).to be(false) end context "with expiry set" do @@ -79,8 +76,6 @@ RSpec.describe RemoteStorageAuthorization, type: :model do describe "#find_or_create_web_app" do context "with origin that looks hosted" do - after(:all) { redis_rs_delete_keys("authorizations:*") } - let(:auth) do user.remote_storage_authorizations.create!( permissions: %w(documents:rw), @@ -173,8 +168,6 @@ RSpec.describe RemoteStorageAuthorization, type: :model do end describe "#launch_url" do - after(:all) { redis_rs_delete_keys("authorizations:*") } - context "without start URL" do before do AppCatalog::WebApp.create!( @@ -250,7 +243,6 @@ RSpec.describe RemoteStorageAuthorization, type: :model do include ActiveJob::TestHelper after(:each) { clear_enqueued_jobs } - after(:all) { redis_rs_delete_keys("authorizations:*") } before { allow(user).to receive(:display_name).and_return("Jimmy") } diff --git a/spec/support/helpers/redis_helper.rb b/spec/support/helpers/redis_helper.rb index 2571fce..f81b2ae 100644 --- a/spec/support/helpers/redis_helper.rb +++ b/spec/support/helpers/redis_helper.rb @@ -1,8 +1,3 @@ def redis_rs @redis_rs ||= Redis.new(url: Setting.rs_redis_url) end - -def redis_rs_delete_keys(pattern) - keys = redis_rs.keys(pattern) - redis_rs.del(*keys) -end