Commit dbc7ef21d1ff264011d5bd4df2faf4ce6870645c
Exists in
master
and in
4 other branches
Merge pull request #932 from gitlabhq/cucumber
Cucumber
Showing
40 changed files
with
686 additions
and
63 deletions
Show diff stats
Gemfile
| @@ -65,6 +65,8 @@ group :development, :test do | @@ -65,6 +65,8 @@ group :development, :test do | ||
| 65 | end | 65 | end |
| 66 | 66 | ||
| 67 | group :test do | 67 | group :test do |
| 68 | + gem 'cucumber-rails', :require => false | ||
| 69 | + gem 'minitest', ">= 2.10" | ||
| 68 | gem "turn", :require => false | 70 | gem "turn", :require => false |
| 69 | gem "simplecov", :require => false | 71 | gem "simplecov", :require => false |
| 70 | gem "shoulda-matchers" | 72 | gem "shoulda-matchers" |
Gemfile.lock
| @@ -118,6 +118,15 @@ GEM | @@ -118,6 +118,15 @@ GEM | ||
| 118 | coffee-script-source (1.3.3) | 118 | coffee-script-source (1.3.3) |
| 119 | colored (1.2) | 119 | colored (1.2) |
| 120 | crack (0.3.1) | 120 | crack (0.3.1) |
| 121 | + cucumber (1.2.1) | ||
| 122 | + builder (>= 2.1.2) | ||
| 123 | + diff-lcs (>= 1.1.3) | ||
| 124 | + gherkin (~> 2.11.0) | ||
| 125 | + json (>= 1.4.6) | ||
| 126 | + cucumber-rails (1.3.0) | ||
| 127 | + capybara (>= 1.1.2) | ||
| 128 | + cucumber (>= 1.1.8) | ||
| 129 | + nokogiri (>= 1.5.0) | ||
| 121 | daemons (1.1.8) | 130 | daemons (1.1.8) |
| 122 | database_cleaner (0.8.0) | 131 | database_cleaner (0.8.0) |
| 123 | devise (1.5.3) | 132 | devise (1.5.3) |
| @@ -138,6 +147,8 @@ GEM | @@ -138,6 +147,8 @@ GEM | ||
| 138 | ffi (1.0.11) | 147 | ffi (1.0.11) |
| 139 | foreman (0.47.0) | 148 | foreman (0.47.0) |
| 140 | thor (>= 0.13.6) | 149 | thor (>= 0.13.6) |
| 150 | + gherkin (2.11.0) | ||
| 151 | + json (>= 1.4.6) | ||
| 141 | git (1.2.5) | 152 | git (1.2.5) |
| 142 | graphael-rails (0.1.4) | 153 | graphael-rails (0.1.4) |
| 143 | jeweler | 154 | jeweler |
| @@ -185,6 +196,7 @@ GEM | @@ -185,6 +196,7 @@ GEM | ||
| 185 | treetop (~> 1.4.8) | 196 | treetop (~> 1.4.8) |
| 186 | method_source (0.7.1) | 197 | method_source (0.7.1) |
| 187 | mime-types (1.18) | 198 | mime-types (1.18) |
| 199 | + minitest (3.1.0) | ||
| 188 | modernizr (2.5.3) | 200 | modernizr (2.5.3) |
| 189 | sprockets (~> 2.0) | 201 | sprockets (~> 2.0) |
| 190 | multi_json (1.3.6) | 202 | multi_json (1.3.6) |
| @@ -348,6 +360,7 @@ DEPENDENCIES | @@ -348,6 +360,7 @@ DEPENDENCIES | ||
| 348 | chosen-rails | 360 | chosen-rails |
| 349 | coffee-rails (= 3.2.2) | 361 | coffee-rails (= 3.2.2) |
| 350 | colored | 362 | colored |
| 363 | + cucumber-rails | ||
| 351 | database_cleaner | 364 | database_cleaner |
| 352 | devise (~> 1.5) | 365 | devise (~> 1.5) |
| 353 | drapper | 366 | drapper |
| @@ -366,6 +379,7 @@ DEPENDENCIES | @@ -366,6 +379,7 @@ DEPENDENCIES | ||
| 366 | launchy | 379 | launchy |
| 367 | letter_opener | 380 | letter_opener |
| 368 | linguist (~> 1.0.0)! | 381 | linguist (~> 1.0.0)! |
| 382 | + minitest (>= 2.10) | ||
| 369 | modernizr (= 2.5.3) | 383 | modernizr (= 2.5.3) |
| 370 | mysql2 | 384 | mysql2 |
| 371 | omniauth-ldap | 385 | omniauth-ldap |
app/views/search/show.html.haml
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | = label_tag :search do | 3 | = label_tag :search do |
| 4 | %strong Looking for | 4 | %strong Looking for |
| 5 | .input | 5 | .input |
| 6 | - = text_field_tag :search, params[:search],:placeholder => "issue 143", :class => "input-xxlarge" | 6 | + = text_field_tag :search, params[:search], :placeholder => "issue 143", :class => "input-xxlarge", :id => "dashboard_search" |
| 7 | = submit_tag 'Search', :class => "btn btn-primary" | 7 | = submit_tag 'Search', :class => "btn btn-primary" |
| 8 | - if params[:search].present? | 8 | - if params[:search].present? |
| 9 | %br | 9 | %br |
| @@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
| 1 | +<% | ||
| 2 | +rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" | ||
| 3 | +rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" | ||
| 4 | +std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" | ||
| 5 | +%> | ||
| 6 | +default: <%= std_opts %> features | ||
| 7 | +wip: --tags @wip:3 --wip features | ||
| 8 | +rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip |
config/database.yml.example
| 1 | -development: | 1 | +# |
| 2 | +# PRODUCTION | ||
| 3 | +# | ||
| 4 | +production: | ||
| 2 | adapter: mysql2 | 5 | adapter: mysql2 |
| 3 | encoding: utf8 | 6 | encoding: utf8 |
| 4 | reconnect: false | 7 | reconnect: false |
| 5 | - database: gitlabhq_development | 8 | + database: gitlabhq_production |
| 6 | pool: 5 | 9 | pool: 5 |
| 7 | username: root | 10 | username: root |
| 8 | password: "secure password" | 11 | password: "secure password" |
| 9 | # socket: /tmp/mysql.sock | 12 | # socket: /tmp/mysql.sock |
| 10 | 13 | ||
| 11 | -# Warning: The database defined as "test" will be erased and | ||
| 12 | -# re-generated from your development database when you run "rake". | ||
| 13 | -# Do not set this db to the same as development or production. | ||
| 14 | -test: | 14 | + |
| 15 | +# | ||
| 16 | +# Development specific | ||
| 17 | +# | ||
| 18 | +# | ||
| 19 | +development: | ||
| 15 | adapter: mysql2 | 20 | adapter: mysql2 |
| 16 | encoding: utf8 | 21 | encoding: utf8 |
| 17 | reconnect: false | 22 | reconnect: false |
| 18 | - database: gitlabhq_test | 23 | + database: gitlabhq_development |
| 19 | pool: 5 | 24 | pool: 5 |
| 20 | username: root | 25 | username: root |
| 21 | password: "secure password" | 26 | password: "secure password" |
| 22 | # socket: /tmp/mysql.sock | 27 | # socket: /tmp/mysql.sock |
| 23 | 28 | ||
| 24 | -production: | 29 | +# Warning: The database defined as "test" will be erased and |
| 30 | +# re-generated from your development database when you run "rake". | ||
| 31 | +# Do not set this db to the same as development or production. | ||
| 32 | +test: &test | ||
| 25 | adapter: mysql2 | 33 | adapter: mysql2 |
| 26 | encoding: utf8 | 34 | encoding: utf8 |
| 27 | reconnect: false | 35 | reconnect: false |
| 28 | - database: gitlabhq_production | 36 | + database: gitlabhq_test |
| 29 | pool: 5 | 37 | pool: 5 |
| 30 | username: root | 38 | username: root |
| 31 | password: "secure password" | 39 | password: "secure password" |
| 32 | # socket: /tmp/mysql.sock | 40 | # socket: /tmp/mysql.sock |
| 41 | + | ||
| 42 | +cucumber: | ||
| 43 | + <<: *test |
config/database.yml.mysql
| 1 | +# | ||
| 2 | +# PRODUCTION | ||
| 3 | +# | ||
| 4 | +production: | ||
| 5 | + adapter: mysql2 | ||
| 6 | + encoding: utf8 | ||
| 7 | + reconnect: false | ||
| 8 | + database: gitlabhq_production | ||
| 9 | + pool: 5 | ||
| 10 | + username: root | ||
| 11 | + password: "secure password" | ||
| 12 | + # socket: /tmp/mysql.sock | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +# | ||
| 16 | +# Development specific | ||
| 17 | +# | ||
| 18 | +# | ||
| 1 | development: | 19 | development: |
| 2 | adapter: mysql2 | 20 | adapter: mysql2 |
| 3 | encoding: utf8 | 21 | encoding: utf8 |
| @@ -11,7 +29,7 @@ development: | @@ -11,7 +29,7 @@ development: | ||
| 11 | # Warning: The database defined as "test" will be erased and | 29 | # Warning: The database defined as "test" will be erased and |
| 12 | # re-generated from your development database when you run "rake". | 30 | # re-generated from your development database when you run "rake". |
| 13 | # Do not set this db to the same as development or production. | 31 | # Do not set this db to the same as development or production. |
| 14 | -test: | 32 | +test: &test |
| 15 | adapter: mysql2 | 33 | adapter: mysql2 |
| 16 | encoding: utf8 | 34 | encoding: utf8 |
| 17 | reconnect: false | 35 | reconnect: false |
| @@ -21,12 +39,5 @@ test: | @@ -21,12 +39,5 @@ test: | ||
| 21 | password: | 39 | password: |
| 22 | # socket: /tmp/mysql.sock | 40 | # socket: /tmp/mysql.sock |
| 23 | 41 | ||
| 24 | -production: | ||
| 25 | - adapter: mysql2 | ||
| 26 | - encoding: utf8 | ||
| 27 | - reconnect: false | ||
| 28 | - database: gitlabhq_production | ||
| 29 | - pool: 5 | ||
| 30 | - username: root | ||
| 31 | - password: "secure password" | ||
| 32 | - # socket: /tmp/mysql.sock | 42 | +cucumber: |
| 43 | + <<: *test |
config/database.yml.sqlite
| 1 | +# | ||
| 2 | +# PRODUCTION | ||
| 3 | +# | ||
| 1 | # SQLite version 3.x | 4 | # SQLite version 3.x |
| 2 | # gem install sqlite3 | 5 | # gem install sqlite3 |
| 3 | # | 6 | # |
| 4 | # Ensure the SQLite 3 gem is defined in your Gemfile | 7 | # Ensure the SQLite 3 gem is defined in your Gemfile |
| 5 | # gem 'sqlite3' | 8 | # gem 'sqlite3' |
| 9 | +production: | ||
| 10 | + adapter: sqlite3 | ||
| 11 | + database: db/production.sqlite3 | ||
| 12 | + pool: 5 | ||
| 13 | + timeout: 5000 | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +# | ||
| 17 | +# Development specific | ||
| 18 | +# | ||
| 19 | +# | ||
| 20 | +# | ||
| 6 | development: | 21 | development: |
| 7 | adapter: sqlite3 | 22 | adapter: sqlite3 |
| 8 | database: db/development.sqlite3 | 23 | database: db/development.sqlite3 |
| @@ -12,14 +27,11 @@ development: | @@ -12,14 +27,11 @@ development: | ||
| 12 | # Warning: The database defined as "test" will be erased and | 27 | # Warning: The database defined as "test" will be erased and |
| 13 | # re-generated from your development database when you run "rake". | 28 | # re-generated from your development database when you run "rake". |
| 14 | # Do not set this db to the same as development or production. | 29 | # Do not set this db to the same as development or production. |
| 15 | -test: | 30 | +test: &test |
| 16 | adapter: sqlite3 | 31 | adapter: sqlite3 |
| 17 | database: db/test.sqlite3 | 32 | database: db/test.sqlite3 |
| 18 | pool: 5 | 33 | pool: 5 |
| 19 | timeout: 5000 | 34 | timeout: 5000 |
| 20 | 35 | ||
| 21 | -production: | ||
| 22 | - adapter: sqlite3 | ||
| 23 | - database: db/production.sqlite3 | ||
| 24 | - pool: 5 | ||
| 25 | - timeout: 5000 | 36 | +cucumber: |
| 37 | + <<: *test |
| @@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
| 1 | +Feature: Dashboard | ||
| 2 | + Background: | ||
| 3 | + Given I signin as a user | ||
| 4 | + And I own project "Shop" | ||
| 5 | + And project "Shop" has push event | ||
| 6 | + And I visit dashboard page | ||
| 7 | + | ||
| 8 | + Scenario: I should see projects list | ||
| 9 | + Then I should see "New Project" link | ||
| 10 | + Then I should see "Shop" project link | ||
| 11 | + Then I should see project "Shop" activity feed | ||
| 12 | + | ||
| 13 | + Scenario: I should see last pish widget | ||
| 14 | + Then I should see last push widget | ||
| 15 | + And I click "Create Merge Request" link | ||
| 16 | + Then I see prefilled new Merge Request page | ||
| 17 | + | ||
| 18 | + |
| @@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
| 1 | +Feature: Dashboard Search | ||
| 2 | + Background: | ||
| 3 | + Given I signin as a user | ||
| 4 | + And I own project "Shop" | ||
| 5 | + And I visit dashboard search page | ||
| 6 | + | ||
| 7 | + Scenario: I should see project i'm looking for | ||
| 8 | + Given I search for "Sho" | ||
| 9 | + Then I should see "Shop" project link | ||
| 10 | + | ||
| 11 | + |
| @@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
| 1 | +Feature: Profile | ||
| 2 | + Background: | ||
| 3 | + Given I signin as a user | ||
| 4 | + | ||
| 5 | + Scenario: I look at my profile | ||
| 6 | + Given I visit profile page | ||
| 7 | + Then I should see my profile info | ||
| 8 | + | ||
| 9 | + Scenario: I change my password | ||
| 10 | + Given I visit profile password page | ||
| 11 | + Then I change my password | ||
| 12 | + And I should be redirected to sign in page | ||
| 13 | + | ||
| 14 | + Scenario: I reset my token | ||
| 15 | + Given I visit profile token page | ||
| 16 | + Then I reset my token | ||
| 17 | + And I should see new token | ||
| 18 | + |
| @@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
| 1 | +Feature: Browse branches | ||
| 2 | + Background: | ||
| 3 | + Given I signin as a user | ||
| 4 | + And I own project "Shop" | ||
| 5 | + Given I visit project branches page | ||
| 6 | + | ||
| 7 | + Scenario: I can see all git branches | ||
| 8 | + | ||
| 9 | + Scenario: I can download project by branch | ||
| 10 | + | ||
| 11 | + Scenario: I can view protected branches | ||
| 12 | + | ||
| 13 | + Scenario: I can manage protected branches |
| @@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
| 1 | +Feature: Browse commits | ||
| 2 | + Background: | ||
| 3 | + Given I signin as a user | ||
| 4 | + And I own project "Shop" | ||
| 5 | + Given I visit project commits page | ||
| 6 | + | ||
| 7 | + Scenario: I browse commits list for master branch | ||
| 8 | + Then I see project commits | ||
| 9 | + | ||
| 10 | + Scenario: I browse atom feed of commits list for master branch | ||
| 11 | + Given I click atom feed link | ||
| 12 | + Then I see commits atom feed | ||
| 13 | + | ||
| 14 | + Scenario: I browse commit from list | ||
| 15 | + Given I click on commit link | ||
| 16 | + Then I see commit info | ||
| 17 | + | ||
| 18 | + Scenario: I compare refs | ||
| 19 | + Given I visit compare refs page | ||
| 20 | + And I fill compare fields with refs | ||
| 21 | + And I see compared refs | ||
| 22 | + |
| @@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
| 1 | +Feature: Create Project | ||
| 2 | + In order to get access to project sections | ||
| 3 | + A user with ability to create a project | ||
| 4 | + Should be able to create a new one | ||
| 5 | + | ||
| 6 | + Scenario: User create a project | ||
| 7 | + Given I signin as a user | ||
| 8 | + When I visit new project page | ||
| 9 | + And fill project form with valid data | ||
| 10 | + Then I should see project page | ||
| 11 | + And I should see empty project instuctions |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +@javascript | ||
| 2 | +Feature: Project Network Graph | ||
| 3 | + | ||
| 4 | + Background: | ||
| 5 | + Given I signin as a user | ||
| 6 | + And I own project "Shop" | ||
| 7 | + And I visit project "Shop" network page | ||
| 8 | + | ||
| 9 | + Scenario: I should see project network | ||
| 10 | + Then page should have network graph | ||
| 11 | + | ||
| 12 | + |
| @@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
| 1 | +Feature: Browse git repo | ||
| 2 | + Background: | ||
| 3 | + Given I signin as a user | ||
| 4 | + And I own project "Shop" | ||
| 5 | + Given I visit project source page | ||
| 6 | + | ||
| 7 | + Scenario: I browse files from master branch | ||
| 8 | + Then I should see files from repository | ||
| 9 | + | ||
| 10 | + Scenario: I browse files for specific ref | ||
| 11 | + Given I visit project source page for "8470d70" | ||
| 12 | + Then I should see files from repository for "8470d70" | ||
| 13 | + | ||
| 14 | + Scenario: I browse file content | ||
| 15 | + Given I click on file from repo | ||
| 16 | + Then I should see it content | ||
| 17 | + | ||
| 18 | + Scenario: I browse raw file | ||
| 19 | + Given I visit blob file from repo | ||
| 20 | + And I click on raw button | ||
| 21 | + Then I should see raw file content | ||
| 22 | + | ||
| 23 | + |
| @@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
| 1 | +@javascript | ||
| 2 | +Feature: Project Wall | ||
| 3 | + In order to use Project Wall | ||
| 4 | + A user | ||
| 5 | + Should be able to read & write messages | ||
| 6 | + | ||
| 7 | + Background: | ||
| 8 | + Given I signin as a user | ||
| 9 | + And I own project "Shop" | ||
| 10 | + And I visit project "Shop" wall page | ||
| 11 | + | ||
| 12 | + Scenario: Write comment | ||
| 13 | + Given I write new comment "my special test message" | ||
| 14 | + Then I should see project wall note "my special test message" | ||
| 15 | + | ||
| 16 | + Then I visit project "Shop" wall page | ||
| 17 | + And I should see project wall note "my special test message" |
| @@ -0,0 +1,40 @@ | @@ -0,0 +1,40 @@ | ||
| 1 | +Given /^I visit project source page$/ do | ||
| 2 | + visit tree_project_ref_path(@project, @project.root_ref) | ||
| 3 | +end | ||
| 4 | + | ||
| 5 | +Then /^I should see files from repository$/ do | ||
| 6 | + page.should have_content("app") | ||
| 7 | + page.should have_content("History") | ||
| 8 | + page.should have_content("Gemfile") | ||
| 9 | +end | ||
| 10 | + | ||
| 11 | +Given /^I visit project source page for "(.*?)"$/ do |arg1| | ||
| 12 | + visit tree_project_ref_path(@project, arg1) | ||
| 13 | +end | ||
| 14 | + | ||
| 15 | +Then /^I should see files from repository for "(.*?)"$/ do |arg1| | ||
| 16 | + current_path.should == tree_project_ref_path(@project, arg1) | ||
| 17 | + page.should have_content("app") | ||
| 18 | + page.should have_content("History") | ||
| 19 | + page.should have_content("Gemfile") | ||
| 20 | +end | ||
| 21 | + | ||
| 22 | +Given /^I click on file from repo$/ do | ||
| 23 | + click_link "Gemfile" | ||
| 24 | +end | ||
| 25 | + | ||
| 26 | +Then /^I should see it content$/ do | ||
| 27 | + page.should have_content("rubygems.org") | ||
| 28 | +end | ||
| 29 | + | ||
| 30 | +Given /^I click on raw button$/ do | ||
| 31 | + click_link "raw" | ||
| 32 | +end | ||
| 33 | + | ||
| 34 | +Given /^I visit blob file from repo$/ do | ||
| 35 | + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) | ||
| 36 | +end | ||
| 37 | + | ||
| 38 | +Then /^I should see raw file content$/ do | ||
| 39 | + page.source.should == ValidCommit::BLOB_FILE | ||
| 40 | +end |
| @@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
| 1 | +Given /^I visit project commits page$/ do | ||
| 2 | + visit project_commits_path(@project) | ||
| 3 | +end | ||
| 4 | + | ||
| 5 | +Then /^I see project commits$/ do | ||
| 6 | + current_path.should == project_commits_path(@project) | ||
| 7 | + | ||
| 8 | + commit = @project.commit | ||
| 9 | + page.should have_content(@project.name) | ||
| 10 | + page.should have_content(commit.message) | ||
| 11 | + page.should have_content(commit.id.to_s[0..5]) | ||
| 12 | +end | ||
| 13 | + | ||
| 14 | +Given /^I click atom feed link$/ do | ||
| 15 | + click_link "Feed" | ||
| 16 | +end | ||
| 17 | + | ||
| 18 | +Then /^I see commits atom feed$/ do | ||
| 19 | + commit = @project.commit | ||
| 20 | + page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
| 21 | + page.body.should have_selector("title", :text => "Recent commits to #{@project.name}") | ||
| 22 | + page.body.should have_selector("author email", :text => commit.author_email) | ||
| 23 | + page.body.should have_selector("entry summary", :text => commit.message) | ||
| 24 | +end | ||
| 25 | + | ||
| 26 | +Given /^I click on commit link$/ do | ||
| 27 | + visit project_commit_path(@project, ValidCommit::ID) | ||
| 28 | +end | ||
| 29 | + | ||
| 30 | +Then /^I see commit info$/ do | ||
| 31 | + page.should have_content ValidCommit::MESSAGE | ||
| 32 | + page.should have_content "Showing 1 changed file" | ||
| 33 | +end | ||
| 34 | + | ||
| 35 | +Given /^I visit compare refs page$/ do | ||
| 36 | + visit compare_project_commits_path(@project) | ||
| 37 | +end | ||
| 38 | + | ||
| 39 | +Given /^I fill compare fields with refs$/ do | ||
| 40 | + fill_in "from", :with => "master" | ||
| 41 | + fill_in "to", :with => "stable" | ||
| 42 | + click_button "Compare" | ||
| 43 | +end | ||
| 44 | + | ||
| 45 | +Given /^I see compared refs$/ do | ||
| 46 | + page.should have_content "Commits (27)" | ||
| 47 | + page.should have_content "Compare View" | ||
| 48 | + page.should have_content "Showing 73 changed files" | ||
| 49 | +end | ||
| 50 | + |
| @@ -0,0 +1,67 @@ | @@ -0,0 +1,67 @@ | ||
| 1 | +Given /^I visit dashboard page$/ do | ||
| 2 | + visit dashboard_path | ||
| 3 | +end | ||
| 4 | + | ||
| 5 | +Then /^I should see "(.*?)" link$/ do |arg1| | ||
| 6 | + page.should have_link(arg1) | ||
| 7 | +end | ||
| 8 | + | ||
| 9 | +Then /^I should see "(.*?)" project link$/ do |arg1| | ||
| 10 | + page.should have_link(arg1) | ||
| 11 | +end | ||
| 12 | + | ||
| 13 | +Then /^I should see project "(.*?)" activity feed$/ do |arg1| | ||
| 14 | + project = Project.find_by_name(arg1) | ||
| 15 | + page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}" | ||
| 16 | +end | ||
| 17 | + | ||
| 18 | +Given /^project "(.*?)" has push event$/ do |arg1| | ||
| 19 | + @project = Project.find_by_name(arg1) | ||
| 20 | + | ||
| 21 | + data = { | ||
| 22 | + :before => "0000000000000000000000000000000000000000", | ||
| 23 | + :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", | ||
| 24 | + :ref => "refs/heads/new_design", | ||
| 25 | + :user_id => @user.id, | ||
| 26 | + :user_name => @user.name, | ||
| 27 | + :repository => { | ||
| 28 | + :name => @project.name, | ||
| 29 | + :url => "localhost/rubinius", | ||
| 30 | + :description => "", | ||
| 31 | + :homepage => "localhost/rubinius", | ||
| 32 | + :private => true | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @event = Event.create( | ||
| 37 | + :project => @project, | ||
| 38 | + :action => Event::Pushed, | ||
| 39 | + :data => data, | ||
| 40 | + :author_id => @user.id | ||
| 41 | + ) | ||
| 42 | +end | ||
| 43 | + | ||
| 44 | +Then /^I should see last push widget$/ do | ||
| 45 | + page.should have_content "Your last push was to branch new_design" | ||
| 46 | + page.should have_link "Create Merge Request" | ||
| 47 | +end | ||
| 48 | + | ||
| 49 | +Then /^I click "(.*?)" link$/ do |arg1| | ||
| 50 | + click_link "Create Merge Request" | ||
| 51 | +end | ||
| 52 | + | ||
| 53 | +Then /^I see prefilled new Merge Request page$/ do | ||
| 54 | + current_path.should == new_project_merge_request_path(@project) | ||
| 55 | + find("#merge_request_source_branch").value.should == "new_design" | ||
| 56 | + find("#merge_request_target_branch").value.should == "master" | ||
| 57 | + find("#merge_request_title").value.should == "New Design" | ||
| 58 | +end | ||
| 59 | + | ||
| 60 | +Given /^I visit dashboard search page$/ do | ||
| 61 | + visit search_path | ||
| 62 | +end | ||
| 63 | + | ||
| 64 | +Given /^I search for "(.*?)"$/ do |arg1| | ||
| 65 | + fill_in "dashboard_search", :with => arg1 | ||
| 66 | + click_button "Search" | ||
| 67 | +end |
| @@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
| 1 | +Given /^I visit profile page$/ do | ||
| 2 | + visit profile_path | ||
| 3 | +end | ||
| 4 | + | ||
| 5 | +Then /^I should see my profile info$/ do | ||
| 6 | + page.should have_content "Profile" | ||
| 7 | + page.should have_content @user.name | ||
| 8 | + page.should have_content @user.email | ||
| 9 | +end | ||
| 10 | + | ||
| 11 | +Given /^I visit profile password page$/ do | ||
| 12 | + visit profile_password_path | ||
| 13 | +end | ||
| 14 | + | ||
| 15 | +Then /^I change my password$/ do | ||
| 16 | + fill_in "user_password", :with => "222333" | ||
| 17 | + fill_in "user_password_confirmation", :with => "222333" | ||
| 18 | + click_button "Save" | ||
| 19 | +end | ||
| 20 | + | ||
| 21 | +Then /^I should be redirected to sign in page$/ do | ||
| 22 | + current_path.should == new_user_session_path | ||
| 23 | +end | ||
| 24 | + | ||
| 25 | +Given /^I visit profile token page$/ do | ||
| 26 | + visit profile_token_path | ||
| 27 | +end | ||
| 28 | + | ||
| 29 | +Then /^I reset my token$/ do | ||
| 30 | + @old_token = @user.private_token | ||
| 31 | + click_button "Reset" | ||
| 32 | +end | ||
| 33 | + | ||
| 34 | +Then /^I should see new token$/ do | ||
| 35 | + find("#token").value.should_not == @old_token | ||
| 36 | + find("#token").value.should == @user.reload.private_token | ||
| 37 | +end | ||
| 38 | + |
| @@ -0,0 +1,69 @@ | @@ -0,0 +1,69 @@ | ||
| 1 | +include LoginMacros | ||
| 2 | + | ||
| 3 | +Given /^I signin as a user$/ do | ||
| 4 | + login_as :user | ||
| 5 | +end | ||
| 6 | + | ||
| 7 | +When /^I visit new project page$/ do | ||
| 8 | + visit new_project_path | ||
| 9 | +end | ||
| 10 | + | ||
| 11 | +When /^fill project form with valid data$/ do | ||
| 12 | + fill_in 'project_name', :with => 'NewProject' | ||
| 13 | + fill_in 'project_code', :with => 'NPR' | ||
| 14 | + fill_in 'project_path', :with => 'newproject' | ||
| 15 | + click_button "Create project" | ||
| 16 | +end | ||
| 17 | + | ||
| 18 | +Then /^I should see project page$/ do | ||
| 19 | + current_path.should == project_path(Project.last) | ||
| 20 | + page.should have_content('NewProject') | ||
| 21 | +end | ||
| 22 | + | ||
| 23 | +Then /^I should see empty project instuctions$/ do | ||
| 24 | + page.should have_content("git init") | ||
| 25 | + page.should have_content("git remote") | ||
| 26 | + page.should have_content(Project.last.url_to_repo) | ||
| 27 | +end | ||
| 28 | + | ||
| 29 | +Given /^I own project "(.*?)"$/ do |arg1| | ||
| 30 | + @project = Factory :project, :name => arg1 | ||
| 31 | + @project.add_access(@user, :read, :write) | ||
| 32 | +end | ||
| 33 | + | ||
| 34 | +Given /^I visit project "(.*?)" wall page$/ do |arg1| | ||
| 35 | + project = Project.find_by_name(arg1) | ||
| 36 | + visit wall_project_path(project) | ||
| 37 | +end | ||
| 38 | + | ||
| 39 | +Then /^I should see project wall note "(.*?)"$/ do |arg1| | ||
| 40 | + page.should have_content arg1 | ||
| 41 | +end | ||
| 42 | + | ||
| 43 | +Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2| | ||
| 44 | + project = Project.find_by_name(arg1) | ||
| 45 | + project.notes.create(:note => arg1, :author => project.users.first) | ||
| 46 | +end | ||
| 47 | + | ||
| 48 | +Given /^I write new comment "(.*?)"$/ do |arg1| | ||
| 49 | + fill_in "note_note", :with => arg1 | ||
| 50 | + click_button "Add Comment" | ||
| 51 | +end | ||
| 52 | + | ||
| 53 | +Given /^I visit project "(.*?)" network page$/ do |arg1| | ||
| 54 | + project = Project.find_by_name(arg1) | ||
| 55 | + visit graph_project_path(project) | ||
| 56 | +end | ||
| 57 | + | ||
| 58 | +Given /^show me page$/ do | ||
| 59 | + save_and_open_page | ||
| 60 | +end | ||
| 61 | + | ||
| 62 | +Given /^page should have network graph$/ do | ||
| 63 | + pending | ||
| 64 | + #page.should have_content "Project Network Graph" | ||
| 65 | + #within ".graph" do | ||
| 66 | + #page.should have_content "stable" | ||
| 67 | + #page.should have_content "notes_refacto..." | ||
| 68 | + #end | ||
| 69 | +end |
| @@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
| 1 | +Given /^I visit project wiki page$/ do | ||
| 2 | + visit project_wiki_path(@project, :index) | ||
| 3 | +end | ||
| 4 | + | ||
| 5 | +Given /^I create Wiki page$/ do | ||
| 6 | + fill_in "Title", :with => 'Test title' | ||
| 7 | + fill_in "Content", :with => '[link test](test)' | ||
| 8 | + click_on "Save" | ||
| 9 | +end | ||
| 10 | + | ||
| 11 | +Then /^I should see newly created wiki page$/ do | ||
| 12 | + page.should have_content("Test title") | ||
| 13 | + page.should have_content("link test") | ||
| 14 | + | ||
| 15 | + click_link "link test" | ||
| 16 | + | ||
| 17 | + page.should have_content("Editing page") | ||
| 18 | +end |
| @@ -0,0 +1,67 @@ | @@ -0,0 +1,67 @@ | ||
| 1 | +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. | ||
| 2 | +# It is recommended to regenerate this file in the future when you upgrade to a | ||
| 3 | +# newer version of cucumber-rails. Consider adding your own code to a new file | ||
| 4 | +# instead of editing this one. Cucumber will automatically load all features/**/*.rb | ||
| 5 | +# files. | ||
| 6 | + | ||
| 7 | +require "selenium-webdriver" | ||
| 8 | +require 'cucumber/rails' | ||
| 9 | +require 'webmock/cucumber' | ||
| 10 | +WebMock.allow_net_connect! | ||
| 11 | + | ||
| 12 | +require Rails.root.join 'spec/monkeypatch' | ||
| 13 | +require Rails.root.join 'spec/factories' | ||
| 14 | +require Rails.root.join 'spec/support/login' | ||
| 15 | +require Rails.root.join 'spec/support/valid_commit' | ||
| 16 | + | ||
| 17 | +# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In | ||
| 18 | +# order to ease the transition to Capybara we set the default here. If you'd | ||
| 19 | +# prefer to use XPath just remove this line and adjust any selectors in your | ||
| 20 | +# steps to use the XPath syntax. | ||
| 21 | +Capybara.default_selector = :css | ||
| 22 | + | ||
| 23 | +# By default, any exception happening in your Rails application will bubble up | ||
| 24 | +# to Cucumber so that your scenario will fail. This is a different from how | ||
| 25 | +# your application behaves in the production environment, where an error page will | ||
| 26 | +# be rendered instead. | ||
| 27 | +# | ||
| 28 | +# Sometimes we want to override this default behaviour and allow Rails to rescue | ||
| 29 | +# exceptions and display an error page (just like when the app is running in production). | ||
| 30 | +# Typical scenarios where you want to do this is when you test your error pages. | ||
| 31 | +# There are two ways to allow Rails to rescue exceptions: | ||
| 32 | +# | ||
| 33 | +# 1) Tag your scenario (or feature) with @allow-rescue | ||
| 34 | +# | ||
| 35 | +# 2) Set the value below to true. Beware that doing this globally is not | ||
| 36 | +# recommended as it will mask a lot of errors for you! | ||
| 37 | +# | ||
| 38 | +ActionController::Base.allow_rescue = false | ||
| 39 | + | ||
| 40 | +# Remove/comment out the lines below if your app doesn't have a database. | ||
| 41 | +# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. | ||
| 42 | +begin | ||
| 43 | + DatabaseCleaner.strategy = :transaction | ||
| 44 | +rescue NameError | ||
| 45 | + raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." | ||
| 46 | +end | ||
| 47 | + | ||
| 48 | +# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. | ||
| 49 | +# See the DatabaseCleaner documentation for details. Example: | ||
| 50 | +# | ||
| 51 | +# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do | ||
| 52 | +# # { :except => [:widgets] } may not do what you expect here | ||
| 53 | +# # as tCucumber::Rails::Database.javascript_strategy overrides | ||
| 54 | +# # this setting. | ||
| 55 | +# DatabaseCleaner.strategy = :truncation | ||
| 56 | +# end | ||
| 57 | +# | ||
| 58 | +# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do | ||
| 59 | +# DatabaseCleaner.strategy = :transaction | ||
| 60 | +# end | ||
| 61 | +# | ||
| 62 | + | ||
| 63 | +# Possible values are :truncation and :transaction | ||
| 64 | +# The :transaction strategy is faster, but might give you threading problems. | ||
| 65 | +# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature | ||
| 66 | +Cucumber::Rails::Database.javascript_strategy = :truncation | ||
| 67 | + |
| @@ -0,0 +1,65 @@ | @@ -0,0 +1,65 @@ | ||
| 1 | +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. | ||
| 2 | +# It is recommended to regenerate this file in the future when you upgrade to a | ||
| 3 | +# newer version of cucumber-rails. Consider adding your own code to a new file | ||
| 4 | +# instead of editing this one. Cucumber will automatically load all features/**/*.rb | ||
| 5 | +# files. | ||
| 6 | + | ||
| 7 | + | ||
| 8 | +unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks | ||
| 9 | + | ||
| 10 | +vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first | ||
| 11 | +$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? | ||
| 12 | + | ||
| 13 | +begin | ||
| 14 | + require 'cucumber/rake/task' | ||
| 15 | + | ||
| 16 | + namespace :cucumber do | ||
| 17 | + Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| | ||
| 18 | + t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. | ||
| 19 | + t.fork = true # You may get faster startup if you set this to false | ||
| 20 | + t.profile = 'default' | ||
| 21 | + end | ||
| 22 | + | ||
| 23 | + Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t| | ||
| 24 | + t.binary = vendored_cucumber_bin | ||
| 25 | + t.fork = true # You may get faster startup if you set this to false | ||
| 26 | + t.profile = 'wip' | ||
| 27 | + end | ||
| 28 | + | ||
| 29 | + Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t| | ||
| 30 | + t.binary = vendored_cucumber_bin | ||
| 31 | + t.fork = true # You may get faster startup if you set this to false | ||
| 32 | + t.profile = 'rerun' | ||
| 33 | + end | ||
| 34 | + | ||
| 35 | + desc 'Run all features' | ||
| 36 | + task :all => [:ok, :wip] | ||
| 37 | + | ||
| 38 | + task :statsetup do | ||
| 39 | + require 'rails/code_statistics' | ||
| 40 | + ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features') | ||
| 41 | + ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features') | ||
| 42 | + end | ||
| 43 | + end | ||
| 44 | + desc 'Alias for cucumber:ok' | ||
| 45 | + task :cucumber => 'cucumber:ok' | ||
| 46 | + | ||
| 47 | + task :default => :cucumber | ||
| 48 | + | ||
| 49 | + task :features => :cucumber do | ||
| 50 | + STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" | ||
| 51 | + end | ||
| 52 | + | ||
| 53 | + # In case we don't have ActiveRecord, append a no-op task that we can depend upon. | ||
| 54 | + task 'db:test:prepare' do | ||
| 55 | + end | ||
| 56 | + | ||
| 57 | + task :stats => 'cucumber:statsetup' | ||
| 58 | +rescue LoadError | ||
| 59 | + desc 'cucumber rake task not available (cucumber not installed)' | ||
| 60 | + task :cucumber do | ||
| 61 | + abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' | ||
| 62 | + end | ||
| 63 | +end | ||
| 64 | + | ||
| 65 | +end |
lib/tasks/travis.rake
| 1 | task :travis do | 1 | task :travis do |
| 2 | - ["rspec spec"].each do |cmd| | 2 | + ["rspec spec", "rake cucumber"].each do |cmd| |
| 3 | puts "Starting to run #{cmd}..." | 3 | puts "Starting to run #{cmd}..." |
| 4 | system("export DISPLAY=:99.0 && bundle exec #{cmd}") | 4 | system("export DISPLAY=:99.0 && bundle exec #{cmd}") |
| 5 | raise "#{cmd} failed!" unless $?.exitstatus == 0 | 5 | raise "#{cmd} failed!" unless $?.exitstatus == 0 |
| @@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
| 1 | +#!/usr/bin/env ruby | ||
| 2 | + | ||
| 3 | +vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first | ||
| 4 | +if vendored_cucumber_bin | ||
| 5 | + load File.expand_path(vendored_cucumber_bin) | ||
| 6 | +else | ||
| 7 | + require 'rubygems' unless ENV['NO_RUBYGEMS'] | ||
| 8 | + require 'cucumber' | ||
| 9 | + load Cucumber::BINARY | ||
| 10 | +end |
spec/requests/projects_tree_perfomance_spec.rb
| @@ -1,36 +0,0 @@ | @@ -1,36 +0,0 @@ | ||
| 1 | -#require 'spec_helper' | ||
| 2 | -#require 'benchmark' | ||
| 3 | -# | ||
| 4 | -#describe "Projects" do | ||
| 5 | -# before { login_as :user } | ||
| 6 | -# | ||
| 7 | -# describe "GET /projects/tree" do | ||
| 8 | -# describe "head" do | ||
| 9 | -# before do | ||
| 10 | -# @project = Factory :project | ||
| 11 | -# @project.add_access(@user, :read) | ||
| 12 | -# end | ||
| 13 | -# | ||
| 14 | -# it "should be fast" do | ||
| 15 | -# time = Benchmark.realtime do | ||
| 16 | -# visit tree_project_ref_path(@project, @project.root_ref) | ||
| 17 | -# end | ||
| 18 | -# (time < 1.0).should be_true | ||
| 19 | -# end | ||
| 20 | -# end | ||
| 21 | -# | ||
| 22 | -# describe ValidCommit::ID do | ||
| 23 | -# before do | ||
| 24 | -# @project = Factory :project | ||
| 25 | -# @project.add_access(@user, :read) | ||
| 26 | -# end | ||
| 27 | -# | ||
| 28 | -# it "should be fast" do | ||
| 29 | -# time = Benchmark.realtime do | ||
| 30 | -# visit tree_project_ref_path(@project, ValidCommit::ID) | ||
| 31 | -# end | ||
| 32 | -# (time < 1.0).should be_true | ||
| 33 | -# end | ||
| 34 | -# end | ||
| 35 | -# end | ||
| 36 | -#end |