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

sidebar_due_date_shared_examples.rb « sidebar « features « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 345dfbce423e19ad6b53730d77270a1dd4357f17 (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
28
29
30
# frozen_string_literal: true

RSpec.shared_examples 'date sidebar widget' do
  context 'editing due date' do
    let(:due_date_value) { find('[data-testid="sidebar-due-date"] [data-testid="sidebar-date-value"]') }

    around do |example|
      freeze_time { example.run }
    end

    it 'displays "None" when there is no due date' do
      expect(due_date_value.text).to have_content 'None'
    end

    it 'updates due date' do
      page.within('[data-testid="sidebar-due-date"]') do
        today = Date.today.day

        click_button 'Edit'

        click_button today.to_s

        wait_for_requests

        expect(page).to have_content(today.to_s(:medium))
        expect(due_date_value.text).to have_content Time.current.strftime('%b %-d, %Y')
      end
    end
  end
end