create_file_spec.rb 803 Bytes
Newer Older
Phil Hughes's avatar
Phil Hughes committed
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 34 35 36 37 38 39
require 'spec_helper'

feature 'Multi-file editor new file', :js do
  include WaitForRequests

  let(:user) { create(:user) }
  let(:project) { create(:project, :repository) }

  before do
    project.add_master(user)
    sign_in(user)

    page.driver.set_cookie('new_repo', 'true')

    visit project_tree_path(project, :master)

    wait_for_requests
  end

  it 'creates file in current directory' do
    find('.add-to-tree').click

    click_link('New file')

    page.within('.popup-dialog') do
      find('.form-control').set('filename')

      click_button('Create file')
    end

    find('.inputarea').send_keys('file content')

    fill_in('commit-message', with: 'commit message')

    click_button('Commit 1 file')

    expect(page).to have_selector('td', text: 'commit message')
  end
end