OSDN Git Service

Cucumber:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>
Fri, 15 Jun 2012 04:15:28 +0000 (07:15 +0300)
committerrandx <dmitriy.zaporozhets@gmail.com>
Fri, 15 Jun 2012 04:15:28 +0000 (07:15 +0300)
* Profile
* Browse code
* Sceleton for main features
* Wiki
* Commits

37 files changed:
Gemfile
Gemfile.lock
config/cucumber.yml [new file with mode: 0644]
config/database.yml.example
config/database.yml.mysql
config/database.yml.sqlite
features/dashboard/dashboard.feature [new file with mode: 0644]
features/dashboard/search.feature [new file with mode: 0644]
features/profile/profile.feature [new file with mode: 0644]
features/profile/ssh_keys.feature [new file with mode: 0644]
features/projects/commits/branches.feature [new file with mode: 0644]
features/projects/commits/commit_comments.feature [new file with mode: 0644]
features/projects/commits/commits.feature [new file with mode: 0644]
features/projects/commits/tags.feature [new file with mode: 0644]
features/projects/create_project.feature [new file with mode: 0644]
features/projects/deploy_keys.feature [new file with mode: 0644]
features/projects/issues/issues.feature [new file with mode: 0644]
features/projects/issues/milestones.feature [new file with mode: 0644]
features/projects/merge_requests.feature [new file with mode: 0644]
features/projects/network.feature [new file with mode: 0644]
features/projects/snippets.feature [new file with mode: 0644]
features/projects/source/browse_files.feature [new file with mode: 0644]
features/projects/source/git_blame.feature [new file with mode: 0644]
features/projects/team_management.feature [new file with mode: 0644]
features/projects/wall.feature [new file with mode: 0644]
features/projects/web_hooks.feature [new file with mode: 0644]
features/projects/wiki.feature [new file with mode: 0644]
features/step_definitions/browse_code_steps.rb [new file with mode: 0644]
features/step_definitions/commits_steps.rb [new file with mode: 0644]
features/step_definitions/profile_steps.rb [new file with mode: 0644]
features/step_definitions/projects_steps.rb [new file with mode: 0644]
features/step_definitions/wiki_steps.rb [new file with mode: 0644]
features/support/env.rb [new file with mode: 0644]
lib/tasks/cucumber.rake [new file with mode: 0644]
lib/tasks/gitlab/test.rake [new file with mode: 0644]
script/cucumber [new file with mode: 0755]
spec/requests/projects_tree_perfomance_spec.rb [deleted file]

diff --git a/Gemfile b/Gemfile
index 43b0893..1ad765e 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -65,6 +65,8 @@ group :development, :test do
 end
 
 group :test do
+  gem 'cucumber-rails', :require => false
+  gem 'minitest', ">= 2.10"
   gem "turn", :require => false
   gem "simplecov", :require => false
   gem "shoulda-matchers"
index aca7ab5..26bc2e2 100644 (file)
@@ -118,6 +118,15 @@ GEM
     coffee-script-source (1.3.3)
     colored (1.2)
     crack (0.3.1)
+    cucumber (1.2.1)
+      builder (>= 2.1.2)
+      diff-lcs (>= 1.1.3)
+      gherkin (~> 2.11.0)
+      json (>= 1.4.6)
+    cucumber-rails (1.3.0)
+      capybara (>= 1.1.2)
+      cucumber (>= 1.1.8)
+      nokogiri (>= 1.5.0)
     daemons (1.1.8)
     database_cleaner (0.8.0)
     devise (1.5.3)
@@ -138,6 +147,8 @@ GEM
     ffi (1.0.11)
     foreman (0.47.0)
       thor (>= 0.13.6)
+    gherkin (2.11.0)
+      json (>= 1.4.6)
     git (1.2.5)
     graphael-rails (0.1.4)
       jeweler
@@ -185,6 +196,7 @@ GEM
       treetop (~> 1.4.8)
     method_source (0.7.1)
     mime-types (1.18)
+    minitest (3.1.0)
     modernizr (2.5.3)
       sprockets (~> 2.0)
     multi_json (1.3.6)
@@ -348,6 +360,7 @@ DEPENDENCIES
   chosen-rails
   coffee-rails (= 3.2.2)
   colored
+  cucumber-rails
   database_cleaner
   devise (~> 1.5)
   drapper
@@ -366,6 +379,7 @@ DEPENDENCIES
   launchy
   letter_opener
   linguist (~> 1.0.0)!
+  minitest (>= 2.10)
   modernizr (= 2.5.3)
   mysql2
   omniauth-ldap
diff --git a/config/cucumber.yml b/config/cucumber.yml
new file mode 100644 (file)
index 0000000..19b288d
--- /dev/null
@@ -0,0 +1,8 @@
+<%
+rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
+rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
+std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
+%>
+default: <%= std_opts %> features
+wip: --tags @wip:3 --wip features
+rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
index 379469f..5b5c3f0 100644 (file)
@@ -1,32 +1,43 @@
-development:
+#
+# PRODUCTION
+#
+production:
   adapter: mysql2
   encoding: utf8
   reconnect: false
-  database: gitlabhq_development
+  database: gitlabhq_production
   pool: 5
   username: root
   password: "secure password"
   # socket: /tmp/mysql.sock
 
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-test:
+
+# 
+# Development specific
+#
+#
+development:
   adapter: mysql2
   encoding: utf8
   reconnect: false
-  database: gitlabhq_test
+  database: gitlabhq_development
   pool: 5
   username: root
   password: "secure password"
   # socket: /tmp/mysql.sock
 
-production:
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test: &test
   adapter: mysql2
   encoding: utf8
   reconnect: false
-  database: gitlabhq_production
+  database: gitlabhq_test
   pool: 5
   username: root
   password: "secure password"
   # socket: /tmp/mysql.sock
+
+cucumber:
+  <<: *test
index 0547d4a..99cd7ea 100644 (file)
@@ -1,3 +1,21 @@
+#
+# PRODUCTION
+#
+production:
+  adapter: mysql2
+  encoding: utf8
+  reconnect: false
+  database: gitlabhq_production
+  pool: 5
+  username: root
+  password: "secure password"
+  # socket: /tmp/mysql.sock
+
+
+# 
+# Development specific
+#
+#
 development:
   adapter: mysql2
   encoding: utf8
@@ -11,7 +29,7 @@ development:
 # Warning: The database defined as "test" will be erased and
 # re-generated from your development database when you run "rake".
 # Do not set this db to the same as development or production.
-test:
+test: &test
   adapter: mysql2
   encoding: utf8
   reconnect: false
@@ -21,12 +39,5 @@ test:
   password:
   # socket: /tmp/mysql.sock
 
-production:
-  adapter: mysql2
-  encoding: utf8
-  reconnect: false
-  database: gitlabhq_production
-  pool: 5
-  username: root
-  password: "secure password"
-  # socket: /tmp/mysql.sock
+cucumber:
+  <<: *test
index 51a4dd4..077a17b 100644 (file)
@@ -1,8 +1,23 @@
+#
+# PRODUCTION
+#
 # SQLite version 3.x
 #   gem install sqlite3
 #
 #   Ensure the SQLite 3 gem is defined in your Gemfile
 #   gem 'sqlite3'
+production:
+  adapter: sqlite3
+  database: db/production.sqlite3
+  pool: 5
+  timeout: 5000
+
+
+# 
+# Development specific
+#
+#
+#
 development:
   adapter: sqlite3
   database: db/development.sqlite3
@@ -12,14 +27,11 @@ development:
 # Warning: The database defined as "test" will be erased and
 # re-generated from your development database when you run "rake".
 # Do not set this db to the same as development or production.
-test:
+test: &test
   adapter: sqlite3
   database: db/test.sqlite3
   pool: 5
   timeout: 5000
 
-production:
-  adapter: sqlite3
-  database: db/production.sqlite3
-  pool: 5
-  timeout: 5000
+cucumber:
+  <<: *test
diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/dashboard/search.feature b/features/dashboard/search.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/profile/profile.feature b/features/profile/profile.feature
new file mode 100644 (file)
index 0000000..e3d71ab
--- /dev/null
@@ -0,0 +1,18 @@
+Feature: Profile
+  Background: 
+    Given I signin as a user
+
+  Scenario: I look at my profile
+    Given I visit profile page
+    Then I should see my profile info
+
+  Scenario: I change my password
+    Given I visit profile password page
+    Then I change my password
+    And I should be redirected to sign in page
+
+  Scenario: I reset my token
+    Given I visit profile token page
+    Then I reset my token
+    And I should see new token
+
diff --git a/features/profile/ssh_keys.feature b/features/profile/ssh_keys.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/commits/branches.feature b/features/projects/commits/branches.feature
new file mode 100644 (file)
index 0000000..2b136e1
--- /dev/null
@@ -0,0 +1,13 @@
+Feature: Browse branches
+  Background: 
+    Given I signin as a user
+    And I own project "Shop"
+    Given I visit project branches page
+
+  Scenario: I can see all git branches
+
+  Scenario: I can download project by branch
+
+  Scenario: I can view protected branches
+
+  Scenario: I can manage protected branches
diff --git a/features/projects/commits/commit_comments.feature b/features/projects/commits/commit_comments.feature
new file mode 100644 (file)
index 0000000..bdf47b8
--- /dev/null
@@ -0,0 +1,7 @@
+Feature: Comment commit
+  Background: 
+    Given I signin as a user
+    And I own project "Shop"
+    Given I visit project commit page
+
+  Scenario: I leave a comment for commit
diff --git a/features/projects/commits/commits.feature b/features/projects/commits/commits.feature
new file mode 100644 (file)
index 0000000..69d39d7
--- /dev/null
@@ -0,0 +1,22 @@
+Feature: Browse commits
+  Background: 
+    Given I signin as a user
+    And I own project "Shop"
+    Given I visit project commits page
+
+  Scenario: I browse commits list for master branch
+    Then I see project commits
+
+  Scenario: I browse atom feed of commits list for master branch
+    Given I click atom feed link
+    Then I see commits atom feed
+
+  Scenario: I browse commit from list
+    Given I click on commit link
+    Then I see commit info
+
+  Scenario: I compare refs
+    Given I visit compare refs page
+    And I fill compare fields with refs
+    And I see compared refs 
+
diff --git a/features/projects/commits/tags.feature b/features/projects/commits/tags.feature
new file mode 100644 (file)
index 0000000..8122174
--- /dev/null
@@ -0,0 +1,11 @@
+Feature: Browse tags
+  Background: 
+    Given I signin as a user
+    And I own project "Shop"
+    Given I visit project tags page
+
+  Scenario: I can see all git tags
+
+  Scenario: I can download project by tag
+
+
diff --git a/features/projects/create_project.feature b/features/projects/create_project.feature
new file mode 100644 (file)
index 0000000..42d25b3
--- /dev/null
@@ -0,0 +1,11 @@
+Feature: Create Project
+  In order to get access to project sections
+  A user with ability to create a project
+  Should be able to create a new one
+
+  Scenario: User create a project
+    Given I signin as a user
+    When I visit new project page
+    And fill project form with valid data
+    Then I should see project page
+    And I should see empty project instuctions
diff --git a/features/projects/deploy_keys.feature b/features/projects/deploy_keys.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/issues/issues.feature b/features/projects/issues/issues.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/issues/milestones.feature b/features/projects/issues/milestones.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/merge_requests.feature b/features/projects/merge_requests.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/network.feature b/features/projects/network.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/snippets.feature b/features/projects/snippets.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/source/browse_files.feature b/features/projects/source/browse_files.feature
new file mode 100644 (file)
index 0000000..04aebc1
--- /dev/null
@@ -0,0 +1,23 @@
+Feature: Browse git repo
+  Background: 
+    Given I signin as a user
+    And I own project "Shop"
+    Given I visit project source page
+
+  Scenario: I browse files from master branch
+    Then I should see files from repository
+
+  Scenario: I browse files for specific ref
+    Given I visit project source page for "8470d70"
+    Then I should see files from repository for "8470d70"
+
+  Scenario: I browse file content
+    Given I click on file from repo
+    Then I should see it content
+
+  Scenario: I browse raw file
+    Given I visit blob file from repo 
+    And I click on raw button
+    Then I should see raw file content
+
+
diff --git a/features/projects/source/git_blame.feature b/features/projects/source/git_blame.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/team_management.feature b/features/projects/team_management.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/wall.feature b/features/projects/wall.feature
new file mode 100644 (file)
index 0000000..ed675e2
--- /dev/null
@@ -0,0 +1,17 @@
+@javascript
+Feature: Project Wall
+  In order to use Project Wall
+  A user
+  Should be able to read & write messages
+
+  Background:
+    Given I signin as a user
+    And I own project "Shop"
+    And I visit project "Shop" wall page 
+
+  Scenario: Write comment
+    Given I write new comment "my special test message"
+    Then I should see project wall note "my special test message"
+
+    Then I visit project "Shop" wall page 
+    And I should see project wall note "my special test message"
diff --git a/features/projects/web_hooks.feature b/features/projects/web_hooks.feature
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/features/projects/wiki.feature b/features/projects/wiki.feature
new file mode 100644 (file)
index 0000000..ed69e87
--- /dev/null
@@ -0,0 +1,9 @@
+Feature: Wiki
+  Background: 
+    Given I signin as a user
+    And I own project "Shop"
+    Given I visit project wiki page
+
+  Scenario: Add new page
+    Given I create Wiki page
+    Then I should see newly created wiki page
diff --git a/features/step_definitions/browse_code_steps.rb b/features/step_definitions/browse_code_steps.rb
new file mode 100644 (file)
index 0000000..fc3cf56
--- /dev/null
@@ -0,0 +1,40 @@
+Given /^I visit project source page$/ do
+  visit tree_project_ref_path(@project, @project.root_ref)
+end
+
+Then /^I should see files from repository$/ do
+  page.should have_content("app")
+  page.should have_content("History")
+  page.should have_content("Gemfile")
+end
+
+Given /^I visit project source page for "(.*?)"$/ do |arg1|
+  visit tree_project_ref_path(@project, arg1)
+end
+
+Then /^I should see files from repository for "(.*?)"$/ do |arg1|
+  current_path.should == tree_project_ref_path(@project, arg1)
+  page.should have_content("app")
+  page.should have_content("History")
+  page.should have_content("Gemfile")
+end
+
+Given /^I click on file from repo$/ do
+  click_link "Gemfile"
+end
+
+Then /^I should see it content$/ do
+  page.should have_content("rubygems.org")
+end
+
+Given /^I click on raw button$/ do
+  click_link "raw"
+end
+
+Given /^I visit blob file from repo$/ do
+  visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
+end
+
+Then /^I should see raw file content$/ do
+  page.source.should == ValidCommit::BLOB_FILE
+end
diff --git a/features/step_definitions/commits_steps.rb b/features/step_definitions/commits_steps.rb
new file mode 100644 (file)
index 0000000..9f7b2a1
--- /dev/null
@@ -0,0 +1,50 @@
+Given /^I visit project commits page$/ do
+  visit project_commits_path(@project)
+end
+
+Then /^I see project commits$/ do
+  current_path.should == project_commits_path(@project)
+
+  commit = @project.commit
+  page.should have_content(@project.name)
+  page.should have_content(commit.message)
+  page.should have_content(commit.id.to_s[0..5])
+end
+
+Given /^I click atom feed link$/ do
+  click_link "Feed"
+end
+
+Then /^I see commits atom feed$/ do
+  commit = @project.commit
+  page.response_headers['Content-Type'].should have_content("application/atom+xml")
+  page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")
+  page.body.should have_selector("author email", :text => commit.author_email)
+  page.body.should have_selector("entry summary", :text => commit.message)
+end
+
+Given /^I click on commit link$/ do
+  visit project_commit_path(@project, ValidCommit::ID)
+end
+
+Then /^I see commit info$/ do
+  page.should have_content ValidCommit::MESSAGE
+  page.should have_content "Showing 1 changed file"
+end
+
+Given /^I visit compare refs page$/ do
+  visit compare_project_commits_path(@project)
+end
+
+Given /^I fill compare fields with refs$/ do
+  fill_in "from", :with => "master"
+  fill_in "to", :with => "stable"
+  click_button "Compare"
+end
+
+Given /^I see compared refs$/ do
+  page.should have_content "Commits (27)"
+  page.should have_content "Compare View"
+  page.should have_content "Showing 73 changed files"
+end
+
diff --git a/features/step_definitions/profile_steps.rb b/features/step_definitions/profile_steps.rb
new file mode 100644 (file)
index 0000000..7510c53
--- /dev/null
@@ -0,0 +1,38 @@
+Given /^I visit profile page$/ do
+  visit profile_path
+end
+
+Then /^I should see my profile info$/ do
+  page.should have_content "Profile"
+  page.should have_content @user.name
+  page.should have_content @user.email
+end
+
+Given /^I visit profile password page$/ do
+  visit profile_password_path
+end
+
+Then /^I change my password$/ do
+  fill_in "user_password", :with => "222333"
+  fill_in "user_password_confirmation", :with => "222333"
+  click_button "Save"
+end
+
+Then /^I should be redirected to sign in page$/ do
+  current_path.should == new_user_session_path
+end
+
+Given /^I visit profile token page$/ do
+  visit profile_token_path
+end
+
+Then /^I reset my token$/ do
+  @old_token = @user.private_token
+  click_button "Reset"
+end
+
+Then /^I should see new token$/ do
+  find("#token").value.should_not == @old_token
+  find("#token").value.should == @user.reload.private_token
+end
+
diff --git a/features/step_definitions/projects_steps.rb b/features/step_definitions/projects_steps.rb
new file mode 100644 (file)
index 0000000..b3bb24b
--- /dev/null
@@ -0,0 +1,52 @@
+include LoginMacros
+
+Given /^I signin as a user$/ do
+  login_as :user
+end
+
+When /^I visit new project page$/ do
+  visit new_project_path
+end
+
+When /^fill project form with valid data$/ do
+  fill_in 'project_name', :with => 'NewProject'
+  fill_in 'project_code', :with => 'NPR'
+  fill_in 'project_path', :with => 'newproject'
+  click_button "Create project"
+end
+
+Then /^I should see project page$/ do
+  current_path.should == project_path(Project.last)
+  page.should have_content('NewProject')
+end
+
+Then /^I should see empty project instuctions$/ do
+  page.should have_content("git init")
+  page.should have_content("git remote")
+  page.should have_content(Project.last.url_to_repo)
+end
+
+Given /^I own project "(.*?)"$/ do |arg1|
+  @project = Factory :project, :name => arg1
+  @project.add_access(@user, :read, :write)
+end
+
+Given /^I visit project "(.*?)" wall page$/ do |arg1|
+  project = Project.find_by_name(arg1)
+  visit wall_project_path(project)
+end
+
+Then /^I should see project wall note "(.*?)"$/ do |arg1|
+  page.should have_content arg1
+end
+
+Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2|
+  project = Project.find_by_name(arg1)
+  project.notes.create(:note => arg1, :author => project.users.first)
+end
+
+Given /^I write new comment "(.*?)"$/ do |arg1|
+  fill_in "note_note", :with => arg1
+  click_button "Add Comment"
+end
+
diff --git a/features/step_definitions/wiki_steps.rb b/features/step_definitions/wiki_steps.rb
new file mode 100644 (file)
index 0000000..10de38d
--- /dev/null
@@ -0,0 +1,18 @@
+Given /^I visit project wiki page$/ do
+  visit project_wiki_path(@project, :index)
+end
+
+Given /^I create Wiki page$/ do
+  fill_in "Title", :with => 'Test title'
+  fill_in "Content", :with => '[link test](test)'
+  click_on "Save"
+end
+
+Then /^I should see newly created wiki page$/ do
+  page.should have_content("Test title")
+  page.should have_content("link test")
+
+  click_link "link test"
+
+  page.should have_content("Editing page")
+end
diff --git a/features/support/env.rb b/features/support/env.rb
new file mode 100644 (file)
index 0000000..ce68081
--- /dev/null
@@ -0,0 +1,67 @@
+# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
+# It is recommended to regenerate this file in the future when you upgrade to a 
+# newer version of cucumber-rails. Consider adding your own code to a new file 
+# instead of editing this one. Cucumber will automatically load all features/**/*.rb
+# files.
+
+require "selenium-webdriver"
+require 'cucumber/rails'
+require 'webmock/cucumber'
+WebMock.allow_net_connect!
+
+require Rails.root.join 'spec/monkeypatch'
+require Rails.root.join 'spec/factories'
+require Rails.root.join 'spec/support/login'
+require Rails.root.join 'spec/support/valid_commit'
+
+# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
+# order to ease the transition to Capybara we set the default here. If you'd
+# prefer to use XPath just remove this line and adjust any selectors in your
+# steps to use the XPath syntax.
+Capybara.default_selector = :css
+
+# By default, any exception happening in your Rails application will bubble up
+# to Cucumber so that your scenario will fail. This is a different from how 
+# your application behaves in the production environment, where an error page will 
+# be rendered instead.
+#
+# Sometimes we want to override this default behaviour and allow Rails to rescue
+# exceptions and display an error page (just like when the app is running in production).
+# Typical scenarios where you want to do this is when you test your error pages.
+# There are two ways to allow Rails to rescue exceptions:
+#
+# 1) Tag your scenario (or feature) with @allow-rescue
+#
+# 2) Set the value below to true. Beware that doing this globally is not
+# recommended as it will mask a lot of errors for you!
+#
+ActionController::Base.allow_rescue = false
+
+# Remove/comment out the lines below if your app doesn't have a database.
+# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
+begin
+  DatabaseCleaner.strategy = :transaction
+rescue NameError
+  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
+end
+
+# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
+# See the DatabaseCleaner documentation for details. Example:
+#
+#   Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
+#     # { :except => [:widgets] } may not do what you expect here
+#     # as tCucumber::Rails::Database.javascript_strategy overrides
+#     # this setting.
+#     DatabaseCleaner.strategy = :truncation
+#   end
+#
+#   Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
+#     DatabaseCleaner.strategy = :transaction
+#   end
+#
+
+# Possible values are :truncation and :transaction
+# The :transaction strategy is faster, but might give you threading problems.
+# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
+Cucumber::Rails::Database.javascript_strategy = :truncation
+
diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake
new file mode 100644 (file)
index 0000000..83f7947
--- /dev/null
@@ -0,0 +1,65 @@
+# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
+# It is recommended to regenerate this file in the future when you upgrade to a 
+# newer version of cucumber-rails. Consider adding your own code to a new file 
+# instead of editing this one. Cucumber will automatically load all features/**/*.rb
+# files.
+
+
+unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
+
+vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
+$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
+
+begin
+  require 'cucumber/rake/task'
+
+  namespace :cucumber do
+    Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
+      t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
+      t.fork = true # You may get faster startup if you set this to false
+      t.profile = 'default'
+    end
+
+    Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
+      t.binary = vendored_cucumber_bin
+      t.fork = true # You may get faster startup if you set this to false
+      t.profile = 'wip'
+    end
+
+    Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
+      t.binary = vendored_cucumber_bin
+      t.fork = true # You may get faster startup if you set this to false
+      t.profile = 'rerun'
+    end
+
+    desc 'Run all features'
+    task :all => [:ok, :wip]
+
+    task :statsetup do
+      require 'rails/code_statistics'
+      ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
+      ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
+    end
+  end
+  desc 'Alias for cucumber:ok'
+  task :cucumber => 'cucumber:ok'
+
+  task :default => :cucumber
+
+  task :features => :cucumber do
+    STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
+  end
+
+  # In case we don't have ActiveRecord, append a no-op task that we can depend upon.
+  task 'db:test:prepare' do
+  end
+
+  task :stats => 'cucumber:statsetup'
+rescue LoadError
+  desc 'cucumber rake task not available (cucumber not installed)'
+  task :cucumber do
+    abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
+  end
+end
+
+end
diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake
new file mode 100644 (file)
index 0000000..77e148c
--- /dev/null
@@ -0,0 +1,5 @@
+namespace :gitlab do
+  desc "GITLAB | Run both cucumber & rspec"
+  task :test => ['cucumber', 'spec']
+end
+
diff --git a/script/cucumber b/script/cucumber
new file mode 100755 (executable)
index 0000000..7fa5c92
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+
+vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
+if vendored_cucumber_bin
+  load File.expand_path(vendored_cucumber_bin)
+else
+  require 'rubygems' unless ENV['NO_RUBYGEMS']
+  require 'cucumber'
+  load Cucumber::BINARY
+end
diff --git a/spec/requests/projects_tree_perfomance_spec.rb b/spec/requests/projects_tree_perfomance_spec.rb
deleted file mode 100644 (file)
index a97b0b6..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#require 'spec_helper'
-#require 'benchmark'
-#
-#describe "Projects" do
-#  before { login_as :user }
-#
-#  describe "GET /projects/tree" do
-#    describe "head" do
-#      before do
-#        @project = Factory :project
-#        @project.add_access(@user, :read)
-#      end
-#
-#      it "should be fast" do
-#        time = Benchmark.realtime do
-#          visit tree_project_ref_path(@project, @project.root_ref)
-#        end
-#        (time < 1.0).should be_true
-#      end
-#    end
-#
-#    describe ValidCommit::ID do
-#      before do
-#        @project = Factory :project
-#        @project.add_access(@user, :read)
-#      end
-#
-#      it "should be fast" do
-#        time = Benchmark.realtime do
-#          visit tree_project_ref_path(@project, ValidCommit::ID)
-#        end
-#        (time < 1.0).should be_true
-#      end
-#    end
-#  end
-#end