From 70f5291808469a808eb2bee70e9e97acc7716bb6 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 6 Aug 2015 00:20:41 -0700 Subject: Always add current user to autocomplete controller to support filter by "Me" Partial fix #2202 --- features/steps/project/forked_merge_requests.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'features') diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index 58c16d59d05..3e97e84d116 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -138,10 +138,11 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps end step 'I should see the users from the target project ID' do - expect(page).to have_selector('.user-result', visible: true, count: 2) + expect(page).to have_selector('.user-result', visible: true, count: 3) users = page.all('.user-name') expect(users[0].text).to eq 'Unassigned' - expect(users[1].text).to eq @project.users.first.name + expect(users[1].text).to eq current_user.name + expect(users[2].text).to eq @project.users.first.name end # Verify a link is generated against the correct project -- cgit v1.2.1 From 02c4a0cc734320af315410b07a93843ca2f80bde Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 16:57:04 +0200 Subject: Add tests for abuse report feature Signed-off-by: Dmitriy Zaporozhets --- features/abuse_report.feature | 10 ++++++++++ features/admin/abuse_report.feature | 8 ++++++++ features/steps/abuse_reports.rb | 28 ++++++++++++++++++++++++++++ features/steps/admin/abuse_reports.rb | 17 +++++++++++++++++ features/steps/shared/paths.rb | 4 ++++ 5 files changed, 67 insertions(+) create mode 100644 features/abuse_report.feature create mode 100644 features/admin/abuse_report.feature create mode 100644 features/steps/abuse_reports.rb create mode 100644 features/steps/admin/abuse_reports.rb (limited to 'features') diff --git a/features/abuse_report.feature b/features/abuse_report.feature new file mode 100644 index 00000000000..3e1cb455b77 --- /dev/null +++ b/features/abuse_report.feature @@ -0,0 +1,10 @@ +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 diff --git a/features/admin/abuse_report.feature b/features/admin/abuse_report.feature new file mode 100644 index 00000000000..7d4ec2556e5 --- /dev/null +++ b/features/admin/abuse_report.feature @@ -0,0 +1,8 @@ +Feature: Admin Abuse reports + Background: + Given I sign in as an admin + And abuse reports exist + + Scenario: Browse abuse reports + When I visit abuse reports page + Then I should see list of abuse reports diff --git a/features/steps/abuse_reports.rb b/features/steps/abuse_reports.rb new file mode 100644 index 00000000000..8f9ddb2899f --- /dev/null +++ b/features/steps/abuse_reports.rb @@ -0,0 +1,28 @@ +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 + + def user_mike + @user_mike ||= create(:user, name: 'Mike') + end +end diff --git a/features/steps/admin/abuse_reports.rb b/features/steps/admin/abuse_reports.rb new file mode 100644 index 00000000000..87572e93dba --- /dev/null +++ b/features/steps/admin/abuse_reports.rb @@ -0,0 +1,17 @@ +class Spinach::Features::AdminAbuseReports < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedAdmin + + step 'I should see list of abuse reports' do + page.should have_content("Abuse Reports") + page.should have_content AbuseReport.first.message + page.should have_link("Remove user") + end + + step 'abuse reports exist' do + create(:abuse_report) + end +end + + diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 88a98a37807..bb0cd9ac105 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -139,6 +139,10 @@ module SharedPaths visit admin_root_path end + step 'I visit abuse reports page' do + visit admin_abuse_reports_path + end + step 'I visit admin projects page' do visit admin_namespaces_projects_path end -- cgit v1.2.1 From 485b9efe9ff458a7b13589d75108be0b6fb99d68 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 17:27:48 +0200 Subject: Remove trailing lines Signed-off-by: Dmitriy Zaporozhets --- features/steps/admin/abuse_reports.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'features') diff --git a/features/steps/admin/abuse_reports.rb b/features/steps/admin/abuse_reports.rb index 87572e93dba..0149416c919 100644 --- a/features/steps/admin/abuse_reports.rb +++ b/features/steps/admin/abuse_reports.rb @@ -13,5 +13,3 @@ class Spinach::Features::AdminAbuseReports < Spinach::FeatureSteps create(:abuse_report) end end - - -- cgit v1.2.1