diff options
Diffstat (limited to 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb index 963a80569fc..1cd529aa50b 100644 --- a/spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb @@ -1,21 +1,23 @@ # frozen_string_literal: true RSpec.shared_examples 'issuable quick actions' do - QuickAction = Struct.new(:action_text, :expectation, :before_action, keyword_init: true) do - # Pass a block as :before_action if - # issuable state needs to be changed before - # the quick action is executed. - def call_before_action - before_action.call if before_action - end + before do + stub_const('QuickAction', Struct.new(:action_text, :expectation, :before_action, keyword_init: true) do + # Pass a block as :before_action if + # issuable state needs to be changed before + # the quick action is executed. + def call_before_action + before_action.call if before_action + end - def skip_access_check - action_text["/todo"] || - action_text["/done"] || - action_text["/subscribe"] || - action_text["/shrug"] || - action_text["/tableflip"] - end + def skip_access_check + action_text["/todo"] || + action_text["/done"] || + action_text["/subscribe"] || + action_text["/shrug"] || + action_text["/tableflip"] + end + end) end let(:unlabel_expectation) do |