Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dismiss_user_callout_service_spec.rb « users « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 22f84a939f702cadd3a74e974ba98bae6f041376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Users::DismissUserCalloutService do
  let(:user) { create(:user) }

  let(:service) do
    described_class.new(
      container: nil, current_user: user, params: { feature_name: UserCallout.feature_names.each_key.first }
    )
  end

  describe '#execute' do
    subject(:execute) { service.execute }

    it 'returns a user callout' do
      expect(execute).to be_an_instance_of(UserCallout)
    end

    it 'sets the dismisse_at attribute to current time' do
      freeze_time do
        expect(execute).to have_attributes(dismissed_at: Time.current)
      end
    end
  end
end