summaryrefslogtreecommitdiff
path: root/spec/requests/api/api_spec.rb
blob: baebbbce631396211c0d64a8eba138ea9c992907 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require 'spec_helper'

describe API::API do
  let(:user) { create(:user, last_activity_on: Date.yesterday) }

  describe 'Record user last activity in after hook' do
    # It does not matter which endpoint is used because last_activity_on should
    # be updated on every request. `/groups` is used as an example
    # to represent any API endpoint

    it 'updates the users last_activity_on date' do
      expect { get api('/groups', user) }.to change { user.reload.last_activity_on }.to(Date.today)
    end
  end
end