summaryrefslogtreecommitdiff
path: root/features/steps/abuse_reports.rb
blob: 623807dac8205fa8a00533c35213fe960fb4dac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 not see the "Remove abuse" dropdown / button' do
    expect(find(:css, '#report_abuse')).not_to have_selector(:css, 'ul.dropdown-menu')
    expect(find(:css, '#report_abuse')).to have_selector(:css, '.btn-close')
  end

  def user_mike
    @user_mike ||= create(:user, name: 'Mike')
  end
end