issue_detail_spec.rb 1.02 KB
Newer Older
1
2
require 'rails_helper'

3
feature 'Issue Detail', :js do
4
  let(:user)      { create(:user) }
5
  let(:project)   { create(:project, :public) }
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
34
35
36
37
38
39
40
41
42
43
  let(:issue)     { create(:issue, project: project, author: user) }

  context 'when user displays the issue' do
    before do
      visit project_issue_path(project, issue)
      wait_for_requests
    end

    it 'shows the issue' do
      page.within('.issuable-details') do
        expect(find('h2')).to have_content(issue.title)
      end
    end
  end

  context 'when edited by a user who is later deleted' do
    before do
      sign_in(user)
      visit project_issue_path(project, issue)
      wait_for_requests

      click_link 'Edit'
      fill_in 'issue-title', with: 'issue title'
      click_button 'Save'

      visit profile_account_path
      click_link 'Delete account'

      visit project_issue_path(project, issue)
    end

    it 'shows the issue' do
      page.within('.issuable-details') do
        expect(find('h2')).to have_content(issue.reload.title)
      end
    end
  end
end