Move abuse report spinach test to rspec

part of https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
This commit is contained in:
Semyon Pupkov 2016-11-22 14:32:48 +05:00
parent 60c2d59072
commit 5636825fd0
4 changed files with 28 additions and 49 deletions

View File

@ -0,0 +1,4 @@
---
title: Move abuse report spinach test to rspec
merge_request: 7659
author: Semyon Pupkov

View File

@ -1,17 +0,0 @@
Feature: Abuse reports
Background:
Given I sign in as a user
And user "Mike" exists
Scenario: Report abuse
Given I visit "Mike" user page
And I click "Report abuse" button
When I fill and submit abuse form
Then I should see success message
Scenario: Report abuse available only once
Given I visit "Mike" user page
And I click "Report abuse" button
When I fill and submit abuse form
And I visit "Mike" user page
Then I should see a red "Report abuse" button

View File

@ -1,32 +0,0 @@
class Spinach::Features::AbuseReports < Spinach::FeatureSteps
include SharedAuthentication
step 'I visit "Mike" user page' do
visit user_path(user_mike)
end
step 'I click "Report abuse" button' do
click_link 'Report abuse'
end
step 'I fill and submit abuse form' do
fill_in 'abuse_report_message', with: 'This user send spam'
click_button 'Send report'
end
step 'I should see success message' do
page.should have_content 'Thank you for your report'
end
step 'user "Mike" exists' do
user_mike
end
step 'I should see a red "Report abuse" button' do
expect(page).to have_button("Already reported for abuse")
end
def user_mike
@user_mike ||= create(:user, name: 'Mike')
end
end

View File

@ -0,0 +1,24 @@
require 'spec_helper'
feature 'Abuse reports', feature: true do
let(:another_user) { create(:user) }
before do
login_as :user
end
scenario 'Report abuse' do
visit user_path(another_user)
click_link 'Report abuse'
fill_in 'abuse_report_message', with: 'This user send spam'
click_button 'Send report'
expect(page).to have_content 'Thank you for your report'
visit user_path(another_user)
expect(page).to have_button("Already reported for abuse")
end
end