Commit 5636825f authored by Semyon Pupkov's avatar Semyon Pupkov

Move abuse report spinach test to rspec

part of https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
parent 60c2d590
---
title: Move abuse report spinach test to rspec
merge_request: 7659
author: Semyon Pupkov
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
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
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment