From c18f96cfe950b11e2784479cbc7e518667273143 Mon Sep 17 00:00:00 2001 From: Semyon Pupkov Date: Wed, 23 Nov 2016 20:13:24 +0500 Subject: [PATCH] Move admin spam spinach test to Rspec https://gitlab.com/gitlab-org/gitlab-ce/issues/23036 --- .../move-admin-spam-spinach-test-to-rspec.yml | 4 +++ features/admin/spam_logs.feature | 8 ------ features/steps/admin/spam_logs.rb | 28 ------------------- .../admin/admin_browse_spam_logs_spec.rb | 22 +++++++++++++++ 4 files changed, 26 insertions(+), 36 deletions(-) create mode 100644 changelogs/unreleased/move-admin-spam-spinach-test-to-rspec.yml delete mode 100644 features/admin/spam_logs.feature delete mode 100644 features/steps/admin/spam_logs.rb create mode 100644 spec/features/admin/admin_browse_spam_logs_spec.rb diff --git a/changelogs/unreleased/move-admin-spam-spinach-test-to-rspec.yml b/changelogs/unreleased/move-admin-spam-spinach-test-to-rspec.yml new file mode 100644 index 00000000000..a7ec2c20554 --- /dev/null +++ b/changelogs/unreleased/move-admin-spam-spinach-test-to-rspec.yml @@ -0,0 +1,4 @@ +--- +title: Move admin spam spinach test to Rspec +merge_request: 7708 +author: Semyon Pupkov diff --git a/features/admin/spam_logs.feature b/features/admin/spam_logs.feature deleted file mode 100644 index 92a5389e3a4..00000000000 --- a/features/admin/spam_logs.feature +++ /dev/null @@ -1,8 +0,0 @@ -Feature: Admin spam logs - Background: - Given I sign in as an admin - And spam logs exist - - Scenario: Browse spam logs - When I visit spam logs page - Then I should see list of spam logs diff --git a/features/steps/admin/spam_logs.rb b/features/steps/admin/spam_logs.rb deleted file mode 100644 index ad825fd414c..00000000000 --- a/features/steps/admin/spam_logs.rb +++ /dev/null @@ -1,28 +0,0 @@ -class Spinach::Features::AdminSpamLogs < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - step 'I should see list of spam logs' do - expect(page).to have_content('Spam Logs') - expect(page).to have_content spam_log.source_ip - expect(page).to have_content spam_log.noteable_type - expect(page).to have_content 'N' - expect(page).to have_content spam_log.title - expect(page).to have_content truncate(spam_log.description) - expect(page).to have_link('Remove user') - expect(page).to have_link('Block user') - end - - step 'spam logs exist' do - create(:spam_log) - end - - def spam_log - @spam_log ||= SpamLog.first - end - - def truncate(description) - "#{spam_log.description[0...97]}..." - end -end diff --git a/spec/features/admin/admin_browse_spam_logs_spec.rb b/spec/features/admin/admin_browse_spam_logs_spec.rb new file mode 100644 index 00000000000..562ace92598 --- /dev/null +++ b/spec/features/admin/admin_browse_spam_logs_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe 'Admin browse spam logs' do + let!(:spam_log) { create(:spam_log) } + + before do + login_as :admin + end + + scenario 'Browse spam logs' do + visit admin_spam_logs_path + + expect(page).to have_content('Spam Logs') + expect(page).to have_content(spam_log.source_ip) + expect(page).to have_content(spam_log.noteable_type) + expect(page).to have_content('N') + expect(page).to have_content(spam_log.title) + expect(page).to have_content("#{spam_log.description[0...97]}...") + expect(page).to have_link('Remove user') + expect(page).to have_link('Block user') + end +end