summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/features/comment_and_close_button_shared_examples.rb
blob: 4ee2840ed9f65e37dab9fafb8147514038fddf43 (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
# frozen_string_literal: true

RSpec.shared_examples 'page with comment and close button' do |button_text|
  context 'when remove_comment_close_reopen feature flag is enabled' do
    before do
      stub_feature_flags(remove_comment_close_reopen: true)
      setup
    end

    it "does not show #{button_text} button" do
      within '.note-form-actions' do
        expect(page).not_to have_button(button_text)
      end
    end
  end

  context 'when remove_comment_close_reopen feature flag is disabled' do
    before do
      stub_feature_flags(remove_comment_close_reopen: false)
      setup
    end

    it "shows #{button_text} button" do
      within '.note-form-actions' do
        expect(page).to have_button(button_text)
      end
    end
  end
end