Move admin spam spinach test to Rspec

https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
This commit is contained in:
Semyon Pupkov 2016-11-23 20:13:24 +05:00
parent 3e0c6142d1
commit c18f96cfe9
4 changed files with 26 additions and 36 deletions

View file

@ -0,0 +1,4 @@
---
title: Move admin spam spinach test to Rspec
merge_request: 7708
author: Semyon Pupkov

View file

@ -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

View file

@ -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

View file

@ -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