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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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.rb36
1 files changed, 22 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 4d142199c95..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
@@ -145,6 +147,12 @@ RSpec.shared_examples 'issuable quick actions' do
}
),
QuickAction.new(
+ action_text: "/labels ~feature",
+ expectation: ->(noteable, can_use_quick_action) {
+ expect(noteable.labels&.last&.id == feature_label.id).to eq(can_use_quick_action)
+ }
+ ),
+ QuickAction.new(
action_text: "/unlabel",
expectation: unlabel_expectation
),