projects_spec.rb 848 字节
Newer Older
G
gitlabhq 已提交
1 2
require 'spec_helper'

D
Dmitriy Zaporozhets 已提交
3
describe "Projects", feature: true, js: true do
G
gitlabhq 已提交
4 5
  before { login_as :user }

R
randx 已提交
6 7
  describe "DELETE /projects/:id" do
    before do
8
      @project = create(:project, namespace: @user.namespace)
9
      @project.team << [@user, :master]
V
Vinnie Okada 已提交
10
      visit edit_namespace_project_path(@project.namespace, @project)
R
randx 已提交
11 12
    end

D
Dmitriy Zaporozhets 已提交
13 14
    it "should remove project" do
      expect { remove_project }.to change {Project.count}.by(-1)
R
randx 已提交
15
    end
16

D
Dmitriy Zaporozhets 已提交
17
    it 'should delete the project from disk' do
18 19 20 21 22
      expect(GitlabShellWorker).to(
        receive(:perform_async).with(:remove_repository,
                                     /#{@project.path_with_namespace}/)
      ).twice

D
Dmitriy Zaporozhets 已提交
23
      remove_project
R
randx 已提交
24 25
    end
  end
D
Dmitriy Zaporozhets 已提交
26 27 28 29 30 31

  def remove_project
    click_link "Remove project"
    fill_in 'confirm_name_input', with: @project.path
    click_button 'Confirm'
  end
G
gitlabhq 已提交
32
end