diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 06:06:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 06:06:21 +0300 |
commit | 7bb7a8d529fd1155a35a2e9e9cdddd7953f3776d (patch) | |
tree | e0cedf3ea8732ab14cd918242279619c3c7d7072 /spec/features/issues | |
parent | 504ab1e32cbd3a529fe61f6c9a30823febce796c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/issues')
-rw-r--r-- | spec/features/issues/spam_issues_spec.rb | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/spec/features/issues/spam_issues_spec.rb b/spec/features/issues/spam_issues_spec.rb index 0d009f47fff..18245f249fd 100644 --- a/spec/features/issues/spam_issues_spec.rb +++ b/spec/features/issues/spam_issues_spec.rb @@ -30,21 +30,47 @@ describe 'New issue', :js do visit new_project_issue_path(project) end - it 'creates an issue after solving reCaptcha' do - fill_in 'issue_title', with: 'issue title' - fill_in 'issue_description', with: 'issue description' + context 'when allow_possible_spam feature flag is false' do + before do + stub_feature_flags(allow_possible_spam: false) + end - click_button 'Submit issue' + it 'creates an issue after solving reCaptcha' do + fill_in 'issue_title', with: 'issue title' + fill_in 'issue_description', with: 'issue description' - # it is impossible to test recaptcha automatically and there is no possibility to fill in recaptcha - # recaptcha verification is skipped in test environment and it always returns true - expect(page).not_to have_content('issue title') - expect(page).to have_css('.recaptcha') + click_button 'Submit issue' - click_button 'Submit issue' + # it is impossible to test recaptcha automatically and there is no possibility to fill in recaptcha + # recaptcha verification is skipped in test environment and it always returns true + expect(page).not_to have_content('issue title') + expect(page).to have_css('.recaptcha') - expect(page.find('.issue-details h2.title')).to have_content('issue title') - expect(page.find('.issue-details .description')).to have_content('issue description') + click_button 'Submit issue' + + expect(page.find('.issue-details h2.title')).to have_content('issue title') + expect(page.find('.issue-details .description')).to have_content('issue description') + end + end + + context 'when allow_possible_spam feature flag is true' do + before do + fill_in 'issue_title', with: 'issue title' + fill_in 'issue_description', with: 'issue description' + end + + it 'creates an issue without a need to solve reCaptcha' do + click_button 'Submit issue' + + expect(page).not_to have_css('.recaptcha') + expect(page.find('.issue-details h2.title')).to have_content('issue title') + expect(page.find('.issue-details .description')).to have_content('issue description') + end + + it 'creates a spam log record' do + expect { click_button 'Submit issue' } + .to log_spam(title: 'issue title', description: 'issue description', user_id: user.id, noteable_type: 'Issue') + end end end |