WebEditor: save to new branch: spinach

This commit is contained in:
Valery Sizov 2015-02-23 21:00:30 +02:00
parent 71a844cdae
commit 3177693c6f
2 changed files with 36 additions and 1 deletions

View file

@ -34,6 +34,17 @@ Feature: Project Source Browse Files
Then I am redirected to the new file
And I should see its new content
@javascript
Scenario: I can create and commit file and specify new branch
Given I click on "new file" link in repo
And I edit code
And I fill the new file name
And I fill the commit message
And I fill the new branch name
And I click on "Commit Changes"
Then I am redirected to the new file on new branch
And I should see its new content
@javascript @tricky
Scenario: I can create file in empty repo
Given I own an empty project
@ -83,6 +94,17 @@ Feature: Project Source Browse Files
Then I am redirected to the ".gitignore"
And I should see its new content
@javascript
Scenario: I can edit and commit file to new branch
Given I click on ".gitignore" file in repo
And I click button "Edit"
And I edit code
And I fill the commit message
And I fill the new branch name
And I click on "Commit Changes"
Then I am redirected to the ".gitignore" on new branch
And I should see its new content
@javascript @wip
Scenario: If I don't change the content of the file I see an error message
Given I click on ".gitignore" file in repo

View file

@ -69,6 +69,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
fill_in :file_name, with: new_file_name
end
step 'I fill the new branch name' do
fill_in :new_branch, with: 'new_branch_name'
end
step 'I fill the new file name with an illegal name' do
fill_in :file_name, with: '.git'
end
@ -148,6 +152,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
expect(current_path).to eq(namespace_project_blob_path(@project.namespace, @project, 'master/.gitignore'))
end
step 'I am redirected to the ".gitignore" on new branch' do
expect(current_path).to eq(namespace_project_blob_path(@project.namespace, @project, 'new_branch_name/.gitignore'))
end
step 'I am redirected to the permalink URL' do
expect(current_path).to(
eq(namespace_project_blob_path(@project.namespace, @project,
@ -161,6 +169,11 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
@project.namespace, @project, 'master/' + new_file_name))
end
step 'I am redirected to the new file on new branch' do
expect(current_path).to eq(namespace_project_blob_path(
@project.namespace, @project, 'new_branch_name/' + new_file_name))
end
step "I don't see the permalink link" do
expect(page).not_to have_link('permalink')
end
@ -177,7 +190,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
click_link 'add a file'
# Remove pre-receive hook so we can push without auth
FileUtils.rm(File.join(@project.repository.path, 'hooks', 'pre-receive'))
FileUtils.rm_f(File.join(@project.repository.path, 'hooks', 'pre-receive'))
end
private