BigW Consortium Gitlab

todo_spec.rb 1.05 KB
Newer Older
Phil Hughes committed
1 2
require 'rails_helper'

3
feature 'Manually create a todo item from issue', js: true do
4
  let!(:project) { create(:project) }
5 6
  let!(:issue)   { create(:issue, project: project) }
  let!(:user)    { create(:user)}
Phil Hughes committed
7 8 9

  before do
    project.team << [user, :master]
10
    sign_in(user)
11
    visit project_issue_path(project, issue)
Phil Hughes committed
12 13
  end

14
  it 'creates todo when clicking button' do
Phil Hughes committed
15
    page.within '.issuable-sidebar' do
16 17
      click_button 'Add todo'
      expect(page).to have_content 'Mark done'
Phil Hughes committed
18 19
    end

20
    page.within '.header-content .todos-count' do
Phil Hughes committed
21 22
      expect(page).to have_content '1'
    end
Phil Hughes committed
23

24
    visit project_issue_path(project, issue)
Phil Hughes committed
25

26
    page.within '.header-content .todos-count' do
Phil Hughes committed
27 28
      expect(page).to have_content '1'
    end
Phil Hughes committed
29 30
  end

31
  it 'marks a todo as done' do
Phil Hughes committed
32
    page.within '.issuable-sidebar' do
33 34
      click_button 'Add todo'
      click_button 'Mark done'
Phil Hughes committed
35 36
    end

37
    expect(page).to have_selector('.todos-count', visible: false)
Phil Hughes committed
38

39
    visit project_issue_path(project, issue)
Phil Hughes committed
40

41
    expect(page).to have_selector('.todos-count', visible: false)
Phil Hughes committed
42 43
  end
end