From f2eb668348bc8ff70d62ee607a080f235f470dfd Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Tue, 5 Nov 2013 10:45:23 +0200
Subject: [PATCH] Feature test for New file feature

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 app/views/projects/tree/_tree.html.haml       |  2 +-
 features/project/source/browse_files.feature  |  4 +++
 .../steps/project/project_browse_files.rb     | 25 +++++++++++++------
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/app/views/projects/tree/_tree.html.haml b/app/views/projects/tree/_tree.html.haml
index 7a41089a3f2..fae7c18b19a 100644
--- a/app/views/projects/tree/_tree.html.haml
+++ b/app/views/projects/tree/_tree.html.haml
@@ -12,7 +12,7 @@
         = link_to title, '#'
   \/
   %li
-    = link_to project_new_tree_path(@project, @id) do
+    = link_to project_new_tree_path(@project, @id), title: 'New file', id: 'new-file-link' do
       %small
         %i.icon-plus.light
 
diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature
index ee26f5371a9..fd9a2f01a28 100644
--- a/features/project/source/browse_files.feature
+++ b/features/project/source/browse_files.feature
@@ -20,6 +20,10 @@ Feature: Project Browse files
     And I click link "raw"
     Then I should see raw file content
 
+  Scenario: I can create file
+    Given I click on "new file" link in repo
+    Then I can see new file page
+
   @javascript
   Scenario: I can edit file
     Given I click on "Gemfile.lock" file in repo
diff --git a/features/steps/project/project_browse_files.rb b/features/steps/project/project_browse_files.rb
index 71360fb6bd5..069086d5eac 100644
--- a/features/steps/project/project_browse_files.rb
+++ b/features/steps/project/project_browse_files.rb
@@ -3,42 +3,51 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
   include SharedProject
   include SharedPaths
 
-  Then 'I should see files from repository' do
+  step 'I should see files from repository' do
     page.should have_content "app"
     page.should have_content "history"
     page.should have_content "Gemfile"
   end
 
-  Then 'I should see files from repository for "8470d70"' do
+  step 'I should see files from repository for "8470d70"' do
     current_path.should == project_tree_path(@project, "8470d70")
     page.should have_content "app"
     page.should have_content "history"
     page.should have_content "Gemfile"
   end
 
-  Given 'I click on "Gemfile.lock" file in repo' do
+  step 'I click on "Gemfile.lock" file in repo' do
     click_link "Gemfile.lock"
   end
 
-  Then 'I should see it content' do
+  step 'I should see it content' do
     page.should have_content "DEPENDENCIES"
   end
 
-  And 'I click link "raw"' do
+  step 'I click link "raw"' do
     click_link "raw"
   end
 
-  Then 'I should see raw file content' do
+  step 'I should see raw file content' do
     page.source.should == ValidCommit::BLOB_FILE
   end
 
-  Given 'I click button "edit"' do
+  step 'I click button "edit"' do
     click_link 'edit'
   end
 
-  Then 'I can edit code' do
+  step 'I can edit code' do
     page.execute_script('editor.setValue("GitlabFileEditor")')
     page.evaluate_script('editor.getValue()').should == "GitlabFileEditor"
   end
 
+  step 'I click on "new file" link in repo' do
+    click_link 'new-file-link'
+  end
+
+  step 'I can see new file page' do
+    page.should have_content "New file"
+    page.should have_content "File name"
+    page.should have_content "Commit message"
+  end
 end
-- 
GitLab