Commit e956066d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add tests for initializing bare repo and creating new file in it

parent 2fa36ddd
...@@ -34,6 +34,19 @@ Feature: Project Source Browse Files ...@@ -34,6 +34,19 @@ Feature: Project Source Browse Files
Then I am redirected to the new file Then I am redirected to the new file
And I should see its new content And I should see its new content
@javascript
Scenario: I can create file in empty repo
Given I own an empty project
And I visit my empty project page
And I create bare repo
When I click on "add a file" link
And I edit code
And I fill the new file name
And I fill the commit message
And I click on "Commit Changes"
Then I am redirected to the new file
And I should see its new content
@javascript @javascript
Scenario: If I enter an illegal file name I see an error message Scenario: If I enter an illegal file name I see an error message
Given I click on "new file" link in repo Given I click on "new file" link in repo
......
...@@ -166,6 +166,17 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -166,6 +166,17 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
expect(page).to have_content('Your changes could not be committed') expect(page).to have_content('Your changes could not be committed')
end end
step 'I create bare repo' do
click_link 'Create empty bare repository'
end
step 'I click on "add a file" link' do
click_link 'add a file'
# Remove pre-receive hook so we can push without auth
FileUtils.rm(File.join(Project.last.repository.path, 'hooks', 'pre-receive'))
end
private private
def set_new_content def set_new_content
......
...@@ -28,6 +28,10 @@ module SharedProject ...@@ -28,6 +28,10 @@ module SharedProject
@project.team << [@user, :master] @project.team << [@user, :master]
end end
step 'I visit my empty project page' do
visit project_path(Project.find_by(name: 'Empty Project'))
end
step 'project "Shop" has push event' do step 'project "Shop" has push event' do
@project = Project.find_by(name: "Shop") @project = Project.find_by(name: "Shop")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment