Sha256: 564a5792d75617c4dbd4c2d49048698ce160702781934edd9030fea721aac754

Contents?: true

Size: 1017 Bytes

Versions: 5

Compression:

Stored size: 1017 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'g5_authenticatable:purge_users' do
  include_context 'rake'

  context 'when there are no local users' do
    it 'should not raise any errors' do
      expect { task.invoke }.to_not raise_error
    end

    it 'should not leave any user data in the db' do
      task.invoke
      expect(G5Authenticatable::User.count).to eq(0)
    end
  end

  context 'when there is one local user' do
    let!(:user) { FactoryGirl.create(:g5_authenticatable_user) }

    it 'should delete the user data from the db' do
      expect { task.invoke }.to change { G5Authenticatable::User.count }.from(1).to(0)
    end
  end

  context 'when there are multiple local users' do
    let!(:user1) { FactoryGirl.create(:g5_authenticatable_user) }
    let!(:user2) { FactoryGirl.create(:g5_authenticatable_user) }

    it 'should delete the user data from the db' do
      expect { task.invoke }.to change { G5Authenticatable::User.count }.from(2).to(0)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
g5_authenticatable-1.0.0 spec/tasks/purge_users_spec.rb
g5_authenticatable-1.0.0.pre.4 spec/tasks/purge_users_spec.rb
g5_authenticatable-1.0.0.pre.3 spec/tasks/purge_users_spec.rb
g5_authenticatable-1.0.0.pre.2 spec/tasks/purge_users_spec.rb
g5_authenticatable-1.0.0.pre.1 spec/tasks/purge_users_spec.rb