diff --git a/Gemfile b/Gemfile index 6205594a6aa9265f6a2d19ef7b799bb019df9c8f..0a5f730dfb3e70940d0030e8a1aaf92c4e8f64cb 100644 --- a/Gemfile +++ b/Gemfile @@ -106,6 +106,7 @@ group :development do end group :development, :test do + gem 'spinach-rails' gem "rspec-rails" gem "capybara" gem "capybara-webkit" @@ -118,7 +119,7 @@ group :development, :test do # Guard gem 'guard-rspec' - gem 'guard-cucumber' + gem 'guard-spinach' # Notification gem 'rb-fsevent', :require => darwin_only('rb-fsevent') @@ -127,7 +128,6 @@ group :development, :test do end group :test do - gem 'cucumber-rails', :require => false gem "simplecov", :require => false gem "shoulda-matchers" gem 'email_spec' diff --git a/Gemfile.lock b/Gemfile.lock index 94b162810b87b4735621bb8a08e272f7a0e70693..8046b92b8fa34f62acee399b4f7594fc052b6682 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,16 +132,8 @@ GEM execjs coffee-script-source (1.3.3) colored (1.2) + colorize (0.5.8) 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 (2.1.2) @@ -170,8 +162,7 @@ GEM ffi (1.0.11) foreman (0.47.0) thor (>= 0.13.6) - gherkin (2.11.0) - json (>= 1.4.6) + gherkin-ruby (0.2.1) git (1.2.5) github-markup (0.7.4) gitlab_meta (2.9) @@ -185,11 +176,11 @@ GEM guard (1.3.2) listen (>= 0.4.2) thor (>= 0.14.6) - guard-cucumber (1.2.0) - cucumber (>= 1.2.0) - guard (>= 1.1.0) guard-rspec (1.2.1) guard (>= 1.1) + guard-spinach (0.0.2) + guard (>= 1.1) + spinach haml (3.1.6) haml-rails (0.3.4) actionpack (~> 3.0) @@ -344,6 +335,13 @@ GEM tilt (~> 1.3, >= 1.3.3) six (0.2.0) slop (2.4.4) + spinach (0.5.2) + colorize + gherkin-ruby (~> 0.2.0) + spinach-rails (0.1.8) + capybara (~> 1) + railties (>= 3) + spinach (>= 0.4) sprockets (2.1.3) hike (~> 1.2) rack (~> 1.0) @@ -394,7 +392,6 @@ DEPENDENCIES chosen-rails coffee-rails (= 3.2.2) colored - cucumber-rails database_cleaner devise (~> 2.1.0) draper @@ -410,8 +407,8 @@ DEPENDENCIES grape (~> 0.2.1) grit! growl - guard-cucumber guard-rspec + guard-spinach haml-rails headless httparty @@ -442,6 +439,7 @@ DEPENDENCIES shoulda-matchers simplecov six + spinach-rails sqlite3 stamp therubyracer diff --git a/Guardfile b/Guardfile index ed38f548d6e5482dc8b864807be4bfe13ebdeda7..6ed414bc4c553cca09762372e9e8d222990bd509 100644 --- a/Guardfile +++ b/Guardfile @@ -13,18 +13,14 @@ guard 'rspec', :version => 2 do watch(%r{^spec/support/(.+)\.rb$}) { "spec" } watch('config/routes.rb') { "spec/routing" } watch('app/controllers/application_controller.rb') { "spec/controllers" } - + # Capybara request specs watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } - - # Turnip features and steps - watch(%r{^spec/acceptance/(.+)\.feature$}) - watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } end - -guard 'cucumber' do - watch(%r{^features/.+\.feature$}) - watch(%r{^features/support/.+$}) { 'features' } - watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } +guard 'spinach' do + watch(%r|^features/(.*)\.feature|) + watch(%r|^features/steps/(.*)([^/]+)\.rb|) do |m| + "features/#{m[1]}#{m[2]}.feature" + end end diff --git a/config/cucumber.yml b/config/cucumber.yml deleted file mode 100644 index 19b288df9d5e4e28c7dc9df108a3b112ca44e3b5..0000000000000000000000000000000000000000 --- a/config/cucumber.yml +++ /dev/null @@ -1,8 +0,0 @@ -<% -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 diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature index 98bb49803f3d1f9b0b6608ecc3bca5f08ce82c62..9756bc7f64d26b1488b2c5ae9a0d4b85c7faa8de 100644 --- a/features/dashboard/dashboard.feature +++ b/features/dashboard/dashboard.feature @@ -1,9 +1,9 @@ Feature: Dashboard - Background: - Given I signin as a user + Background: + Given I sign in as a user And I own project "Shop" And project "Shop" has push event - And I visit dashboard page + And I visit dashboard page Scenario: I should see projects list Then I should see "New Project" link @@ -25,4 +25,3 @@ Feature: Dashboard And user with name "John Doe" left project "Shop" When I visit dashboard page Then I should see "John Doe left project Shop" event - diff --git a/features/dashboard/issues.feature b/features/dashboard/issues.feature index c3361bb313f8b55cdd99b821850ac1dea970aa01..895b89aa38a5c4cdd8a73cdb8689ce34225a23cb 100644 --- a/features/dashboard/issues.feature +++ b/features/dashboard/issues.feature @@ -1,8 +1,8 @@ Feature: Dashboard Issues - Background: - Given I signin as a user + Background: + Given I sign in as a user And I have assigned issues - And I visit dashboard issues page + And I visit dashboard issues page Scenario: I should see issues list Then I should see issues assigned to me diff --git a/features/dashboard/merge_requests.feature b/features/dashboard/merge_requests.feature index 90b8749c5a762c63831cfc064ad335e66f85c58d..cad65b0d79a08620145dba3d0716339ffc3b1f06 100644 --- a/features/dashboard/merge_requests.feature +++ b/features/dashboard/merge_requests.feature @@ -1,8 +1,8 @@ -Feature: Dashboard MR - Background: - Given I signin as a user +Feature: Dashboard Merge Requests + Background: + Given I sign in as a user And I have authored merge requests - And I visit dashboard merge requests page + And I visit dashboard merge requests page Scenario: I should see projects list Then I should see my merge requests diff --git a/features/dashboard/search.feature b/features/dashboard/search.feature index f053fe86fc8398df20efbca1e4d7e46f6a6a98b7..91d870f46f3bf57c6c6baeb70a151f7723572e99 100644 --- a/features/dashboard/search.feature +++ b/features/dashboard/search.feature @@ -1,11 +1,9 @@ Feature: Dashboard Search - Background: - Given I signin as a user + Background: + Given I sign in as a user And I own project "Shop" - And I visit dashboard search page + And I visit dashboard search page - Scenario: I should see project i'm looking for + Scenario: I should see project I am looking for Given I search for "Sho" Then I should see "Shop" project link - - diff --git a/features/profile/profile.feature b/features/profile/profile.feature index afda4b55081c3d9e1602eeb1a651049417d017ae..f4b2f198f0addb9bd28a35c43aa0772d2066bbd6 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -1,6 +1,6 @@ Feature: Profile - Background: - Given I signin as a user + Background: + Given I sign in as a user Scenario: I look at my profile Given I visit profile page diff --git a/features/profile/ssh_keys.feature b/features/profile/ssh_keys.feature index c81503ed2ba5dbf50b8fe2315efef972008f9e74..018d124e41230c9a97ff59ffbff04572f5aae750 100644 --- a/features/profile/ssh_keys.feature +++ b/features/profile/ssh_keys.feature @@ -1,13 +1,10 @@ -Feature: SSH Keys - Background: - Given I signin as a user - And I have ssh keys: - | title | - | ssh-rsa Work | - | ssh-rsa Home | +Feature: Profile SSH Keys + Background: + Given I sign in as a user + And I have ssh key "ssh-rsa Work" And I visit profile keys page - Scenario: I should see SSH keys + Scenario: I should see ssh keys Then I should see my ssh keys Scenario: Add new ssh key diff --git a/features/projects/commits/branches.feature b/features/project/commits/branches.feature similarity index 66% rename from features/projects/commits/branches.feature rename to features/project/commits/branches.feature index 74575c51c5a4a169733b97272f1e94f86d4a1a7c..4fa4dc26a1bf235b8c56d936599d585c2cc070b5 100644 --- a/features/projects/commits/branches.feature +++ b/features/project/commits/branches.feature @@ -1,6 +1,6 @@ -Feature: Browse branches - Background: - Given I signin as a user +Feature: Project Browse branches + Background: + Given I sign in as a user And I own project "Shop" And project "Shop" has protected branches Given I visit project branches page @@ -16,8 +16,11 @@ Feature: Browse branches Given I click link "Protected" Then I should see "Shop" protected branches list - Scenario: I can download project by branch + # @wip + # Scenario: I can download project by branch - Scenario: I can view protected branches + # @wip + # Scenario: I can view protected branches - Scenario: I can manage protected branches + # @wip + # Scenario: I can manage protected branches diff --git a/features/projects/commits/commit_comments.feature b/features/project/commits/commit_comments.feature similarity index 72% rename from features/projects/commits/commit_comments.feature rename to features/project/commits/commit_comments.feature index 9bd56d29f1e449a7b2c404190cfbad17f31b10bf..5acf541ab96e9f9e541f08bf6e795a06e601f193 100644 --- a/features/projects/commits/commit_comments.feature +++ b/features/project/commits/commit_comments.feature @@ -1,6 +1,6 @@ -Feature: Comment commit - Background: - Given I signin as a user +Feature: Project Comment commit + Background: + Given I sign in as a user And I own project "Shop" Given I visit project commit page diff --git a/features/projects/commits/commits.feature b/features/project/commits/commits.feature similarity index 82% rename from features/projects/commits/commits.feature rename to features/project/commits/commits.feature index 69d39d78f895bd4d9adc928a7da974e7684c56c8..53de6e6a264a939ac5883bde1f3efbe69d9ebd35 100644 --- a/features/projects/commits/commits.feature +++ b/features/project/commits/commits.feature @@ -1,6 +1,6 @@ -Feature: Browse commits - Background: - Given I signin as a user +Feature: Project Browse commits + Background: + Given I sign in as a user And I own project "Shop" Given I visit project commits page @@ -18,5 +18,4 @@ Feature: Browse commits Scenario: I compare refs Given I visit compare refs page And I fill compare fields with refs - And I see compared refs - + And I see compared refs diff --git a/features/projects/commits/tags.feature b/features/project/commits/tags.feature similarity index 53% rename from features/projects/commits/tags.feature rename to features/project/commits/tags.feature index f7899fc3ce01beec792475dc0ca8ab486d7782b4..1ac0f8bfa45ad6f496203763d19078c4fe1c6f53 100644 --- a/features/projects/commits/tags.feature +++ b/features/project/commits/tags.feature @@ -1,10 +1,11 @@ -Feature: Browse tags - Background: - Given I signin as a user +Feature: Project Browse tags + Background: + Given I sign in as a user And I own project "Shop" Given I visit project tags page Scenario: I can see all git tags Then I should see "Shop" all tags list - Scenario: I can download project by tag + # @wip + # Scenario: I can download project by tag diff --git a/features/projects/create_project.feature b/features/project/create_project.feature similarity index 91% rename from features/projects/create_project.feature rename to features/project/create_project.feature index 42d25b3f33110063ceffed0bb268b85682436ec8..b7cdfdb818e4986462c718fc8b9cb80152110040 100644 --- a/features/projects/create_project.feature +++ b/features/project/create_project.feature @@ -4,7 +4,7 @@ Feature: Create Project Should be able to create a new one Scenario: User create a project - Given I signin as a user + Given I sign in as a user When I visit new project page And fill project form with valid data Then I should see project page diff --git a/features/projects/issues/issues.feature b/features/project/issues/issues.feature similarity index 97% rename from features/projects/issues/issues.feature rename to features/project/issues/issues.feature index b2301b3f1ff4b808a7596cd0ab793d4226de26c0..596e8bd7d4188c7301394a94608ff10487dba0ce 100644 --- a/features/projects/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -1,6 +1,6 @@ -Feature: Issues +Feature: Project Issues Background: - Given I signin as a user + Given I sign in as a user And I own project "Shop" And project "Shop" have "Release 0.4" open issue And project "Shop" have "Release 0.3" closed issue @@ -79,4 +79,3 @@ Feature: Issues When I select first assignee from "Shop" project And I click link "New Issue" Then I should see first assignee from "Shop" as selected assignee - diff --git a/features/project/issues/labels.feature b/features/project/issues/labels.feature new file mode 100644 index 0000000000000000000000000000000000000000..e601a41bfc4ac96c396279dc834c5394d960a64b --- /dev/null +++ b/features/project/issues/labels.feature @@ -0,0 +1,10 @@ +Feature: Project Labels + Background: + Given I sign in as a user + And I own project "Shop" + And project "Shop" have issues tags: "bug", "feature" + Given I visit project "Shop" labels page + + Scenario: I should see active milestones + Then I should see label "bug" + And I should see label "feature" diff --git a/features/projects/issues/milestones.feature b/features/project/issues/milestones.feature similarity index 79% rename from features/projects/issues/milestones.feature rename to features/project/issues/milestones.feature index d78096a4f169627572099a34ef5b13022a84c551..a57f67d6815ec928d168182fd28abb4eca814dbf 100644 --- a/features/projects/issues/milestones.feature +++ b/features/project/issues/milestones.feature @@ -1,9 +1,9 @@ -Feature: Milestones +Feature: Project Milestones Background: - Given I signin as a user + Given I sign in as a user And I own project "Shop" And project "Shop" has milestone "v2.2" - Given I visit project "Shop" milestones page + Given I visit project "Shop" milestones page Scenario: I should see active milestones Then I should see milestone "v2.2" diff --git a/features/projects/merge_requests.feature b/features/project/merge_requests.feature similarity index 92% rename from features/projects/merge_requests.feature rename to features/project/merge_requests.feature index 54b6ccde7f956fd3934dd4579f5394787eef21e9..80f009864662be4375ba8cf24577d8ec43bde52a 100644 --- a/features/projects/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -1,10 +1,10 @@ -Feature: Merge Requests +Feature: Project Merge Requests Background: - Given I signin as a user + Given I sign in as a user And I own project "Shop" And project "Shop" have "Bug NS-04" open merge request And project "Shop" have "Feature NS-03" closed merge request - And I visit project "Shop" merge requests page + And I visit project "Shop" merge requests page Scenario: I should see open merge requests Then I should see "Bug NS-04" in merge requests diff --git a/features/projects/network.feature b/features/project/network.feature similarity index 81% rename from features/projects/network.feature rename to features/project/network.feature index 61c05eb367e27038d8712f486b5af573c4e04b74..31ce5ad327959822e2e635567c24e414ee9383ae 100644 --- a/features/projects/network.feature +++ b/features/project/network.feature @@ -1,10 +1,9 @@ -@javascript Feature: Project Network Graph - Background: - Given I signin as a user + Given I sign in as a user And I own project "Shop" And I visit project "Shop" network page + @javascript Scenario: I should see project network Then page should have network graph diff --git a/features/project/project.feature b/features/project/project.feature new file mode 100644 index 0000000000000000000000000000000000000000..1c9f201df507688f42d48984505e16564e70fa9f --- /dev/null +++ b/features/project/project.feature @@ -0,0 +1,14 @@ +Feature: Projects + Background: + Given I signin as a user + And I own project "Shop" + And I visit project "Shop" page + + # @wip + # Scenario: I should see project activity + + # @wip + # Scenario: I edit project + + # @wip + # Scenario: I visit attachments diff --git a/features/projects/source/browse_files.feature b/features/project/source/browse_files.feature similarity index 71% rename from features/projects/source/browse_files.feature rename to features/project/source/browse_files.feature index 04aebc19732c7c15483e0f8f724cf6ea397e93c0..b12b0ee3e3612f513030423ee2d00b3392c494eb 100644 --- a/features/projects/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -1,6 +1,6 @@ -Feature: Browse git repo - Background: - Given I signin as a user +Feature: Project Browse files + Background: + Given I sign in as a user And I own project "Shop" Given I visit project source page @@ -12,12 +12,10 @@ Feature: Browse git repo Then I should see files from repository for "8470d70" Scenario: I browse file content - Given I click on file from repo + Given I click on "Gemfile" file in 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 + Given I visit blob file from repo + And I click link "raw" Then I should see raw file content - - diff --git a/features/project/source/git_blame.feature b/features/project/source/git_blame.feature new file mode 100644 index 0000000000000000000000000000000000000000..93ed20a8c42d68048d6880313b5aa07e761769bc --- /dev/null +++ b/features/project/source/git_blame.feature @@ -0,0 +1,10 @@ +Feature: Project Browse git repo + Background: + Given I sign in as a user + And I own project "Shop" + Given I visit project source page + + Scenario: I blame file + Given I click on "Gemfile" file in repo + And I click blame button + Then I should see git file blame diff --git a/features/projects/team_management.feature b/features/project/team_management.feature similarity index 78% rename from features/projects/team_management.feature rename to features/project/team_management.feature index b5b485e2dc02f937d31dfbe41c1dcb90cffeed05..ae0c459f3339a6466f702a838277d396c9d2a6cf 100644 --- a/features/projects/team_management.feature +++ b/features/project/team_management.feature @@ -1,11 +1,11 @@ Feature: Project Team management - Background: - Given I signin as a user + Background: + Given I sign in as a user And I own project "Shop" - And gitlab user "Mike" - And gitlab user "Sam" + And gitlab user "Mike" + And gitlab user "Sam" And "Sam" is "Shop" developer - And I visit project "Shop" team page + And I visit project "Shop" team page Scenario: See all team members Then I should be able to see myself in team @@ -20,7 +20,7 @@ Feature: Project Team management Scenario: Update user access Given I should see "Sam" in team list as "Developer" And I change "Sam" role to "Reporter" - Then I visit project "Shop" team page + Then I visit project "Shop" team page And I should see "Sam" in team list as "Reporter" Scenario: View team member profile @@ -30,6 +30,5 @@ Feature: Project Team management Scenario: Cancel team member Given I click link "Sam" And I click link "Remove from team" - Then I visit project "Shop" team page + Then I visit project "Shop" team page And I should not see "Sam" in team list - diff --git a/features/projects/wall.feature b/features/project/wall.feature similarity index 63% rename from features/projects/wall.feature rename to features/project/wall.feature index ed675e2c4776563a338aeffba6daea7af5b1fc97..c38d046a8502bafdd8a7d75ced899461bf098e7e 100644 --- a/features/projects/wall.feature +++ b/features/project/wall.feature @@ -1,17 +1,16 @@ -@javascript Feature: Project Wall In order to use Project Wall - A user - Should be able to read & write messages + A user should be able to read and write messages Background: - Given I signin as a user + Given I sign in as a user And I own project "Shop" - And I visit project "Shop" wall page + And I visit project "Shop" wall page + @javascript 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 + Then I visit project "Shop" wall page And I should see project wall note "my special test message" diff --git a/features/projects/wiki.feature b/features/project/wiki.feature similarity index 83% rename from features/projects/wiki.feature rename to features/project/wiki.feature index 4441ada28477444fbc38822c03448a833dffd25c..51370565a3b982c8a61d32bc3f134e7f5c224539 100644 --- a/features/projects/wiki.feature +++ b/features/project/wiki.feature @@ -1,6 +1,6 @@ -Feature: Wiki - Background: - Given I signin as a user +Feature: Project Wiki + Background: + Given I sign in as a user And I own project "Shop" Given I visit project wiki page diff --git a/features/projects/deploy_keys.feature b/features/projects/deploy_keys.feature deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/features/projects/issues/labels.feature b/features/projects/issues/labels.feature deleted file mode 100644 index 5a20bfd6d14f8e7a3fb97d0d0e7c6424d6f2ea6b..0000000000000000000000000000000000000000 --- a/features/projects/issues/labels.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Labels - Background: - Given I signin as a user - And I own project "Shop" - And project "Shop" have issues tags: - | name | - | bug | - | feature | - Given I visit project "Shop" labels page - - Scenario: I should see active milestones - Then I should see label "bug" - And I should see label "feature" diff --git a/features/projects/project.feature b/features/projects/project.feature deleted file mode 100644 index 895a928ff81fd950ec444f3d6fdc1935f1440715..0000000000000000000000000000000000000000 --- a/features/projects/project.feature +++ /dev/null @@ -1,11 +0,0 @@ -Feature: Project - Background: - Given I signin as a user - And I own project "Shop" - And I visit project "Shop" page - - Scenario: I should see project activity - - Scenario: I edit project - - Scenario: I visit attachments diff --git a/features/projects/snippets.feature b/features/projects/snippets.feature deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/features/projects/source/git_blame.feature b/features/projects/source/git_blame.feature deleted file mode 100644 index 6aa6be47debefe8f5d5c11a16fd5d850d0449bef..0000000000000000000000000000000000000000 --- a/features/projects/source/git_blame.feature +++ /dev/null @@ -1,10 +0,0 @@ -Feature: Browse git repo - Background: - Given I signin as a user - And I own project "Shop" - Given I visit project source page - - Scenario: I blame file - Given I click on file from repo - And I click blame button - Then I should see git file blame diff --git a/features/projects/web_hooks.feature b/features/projects/web_hooks.feature deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb deleted file mode 100644 index e9023f9278fb543b9773562242c9f23b7723b9dd..0000000000000000000000000000000000000000 --- a/features/step_definitions/common_steps.rb +++ /dev/null @@ -1,21 +0,0 @@ -include LoginHelpers - -Given /^I signin as a user$/ do - login_as :user -end - -When /^I click link "(.*?)"$/ do |link| - click_link link -end - -When /^I click button "(.*?)"$/ do |button| - click_button button -end - -When /^I fill in "(.*?)" with "(.*?)"$/ do |field, value| - fill_in field, :with => value -end - -Given /^show me page$/ do - save_and_open_page -end diff --git a/features/step_definitions/dashboard_steps.rb b/features/step_definitions/dashboard_steps.rb deleted file mode 100644 index 3ddc68e931c07ada963f8da29e1c544e5cace437..0000000000000000000000000000000000000000 --- a/features/step_definitions/dashboard_steps.rb +++ /dev/null @@ -1,136 +0,0 @@ -Then /^I should see "(.*?)" link$/ do |arg1| - page.should have_link(arg1) -end - -Then /^I should see "(.*?)" project link$/ do |arg1| - page.should have_link(arg1) -end - -Then /^I should see project "(.*?)" activity feed$/ do |arg1| - project = Project.find_by_name(arg1) - page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}" -end - -Given /^project "(.*?)" has push event$/ do |arg1| - @project = Project.find_by_name(arg1) - - data = { - :before => "0000000000000000000000000000000000000000", - :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", - :ref => "refs/heads/new_design", - :user_id => @user.id, - :user_name => @user.name, - :repository => { - :name => @project.name, - :url => "localhost/rubinius", - :description => "", - :homepage => "localhost/rubinius", - :private => true - } - } - - @event = Event.create( - :project => @project, - :action => Event::Pushed, - :data => data, - :author_id => @user.id - ) -end - -Then /^I should see last push widget$/ do - page.should have_content "Your pushed to branch new_design" - page.should have_link "Create Merge Request" -end - -Then /^I click "(.*?)" link$/ do |arg1| - click_link arg1 #Create Merge Request" -end - -Then /^I see prefilled new Merge Request page$/ do - current_path.should == new_project_merge_request_path(@project) - find("#merge_request_source_branch").value.should == "new_design" - find("#merge_request_target_branch").value.should == "master" - find("#merge_request_title").value.should == "New Design" -end - -Given /^I visit dashboard search page$/ do - visit search_path -end - -Given /^I search for "(.*?)"$/ do |arg1| - fill_in "dashboard_search", :with => arg1 - click_button "Search" -end - -Then /^I should see issues assigned to me$/ do - issues = @user.issues - issues.each do |issue| - page.should have_content(issue.title[0..10]) - page.should have_content(issue.project.name) - end -end - -Then /^I should see my merge requests$/ do - merge_requests = @user.merge_requests - merge_requests.each do |mr| - page.should have_content(mr.title[0..10]) - page.should have_content(mr.project.name) - end -end - -Given /^I have assigned issues$/ do - project = Factory :project - project.add_access(@user, :read, :write) - - issue1 = Factory :issue, - :author => @user, - :assignee => @user, - :project => project - - issue2 = Factory :issue, - :author => @user, - :assignee => @user, - :project => project -end - -Given /^I have authored merge requests$/ do - project1 = Factory :project - - project2 = Factory :project - - project1.add_access(@user, :read, :write) - project2.add_access(@user, :read, :write) - - merge_request1 = Factory :merge_request, - :author => @user, - :project => project1 - - merge_request2 = Factory :merge_request, - :author => @user, - :project => project2 -end - -Given /^user with name "(.*?)" joined project "(.*?)"$/ do |user_name, project_name| - user = Factory.create(:user, {name: user_name}) - project = Project.find_by_name project_name - Event.create( - project: project, - author_id: user.id, - action: Event::Joined - ) -end - -Given /^user with name "(.*?)" left project "(.*?)"$/ do |user_name, project_name| - user = User.find_by_name user_name - project = Project.find_by_name project_name - Event.create( - project: project, - author_id: user.id, - action: Event::Left - ) -end - -Then /^I should see "(.*?)" event$/ do |event_text| - page.should have_content(event_text) -end - diff --git a/features/step_definitions/profile/profile_keys_steps.rb b/features/step_definitions/profile/profile_keys_steps.rb deleted file mode 100644 index 25926c53f97e2b231422322f51618890ca63f3b5..0000000000000000000000000000000000000000 --- a/features/step_definitions/profile/profile_keys_steps.rb +++ /dev/null @@ -1,34 +0,0 @@ -Given /^I visit profile keys page$/ do - visit keys_path -end - -Then /^I should see my ssh keys$/ do - @user.keys.each do |key| - page.should have_content(key.title) - end -end - -Given /^I have ssh keys:$/ do |table| - table.hashes.each do |row| - Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}" - end -end - -Given /^I submit new ssh key "(.*?)"$/ do |arg1| - fill_in "key_title", :with => arg1 - fill_in "key_key", :with => "ssh-rsa publickey234=" - click_button "Save" -end - -Then /^I should see new ssh key "(.*?)"$/ do |arg1| - key = Key.find_by_title(arg1) - page.should have_content(key.title) - page.should have_content(key.key) - current_path.should == key_path(key) -end - -Then /^I should not see "(.*?)" ssh key$/ do |arg1| - within "#keys-table" do - page.should_not have_content(arg1) - end -end diff --git a/features/step_definitions/profile/profile_steps.rb b/features/step_definitions/profile/profile_steps.rb deleted file mode 100644 index 525d43f5fdabc357253012f6c7f5faf108864bf9..0000000000000000000000000000000000000000 --- a/features/step_definitions/profile/profile_steps.rb +++ /dev/null @@ -1,39 +0,0 @@ -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 - -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 - -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 - -Then /^I change my contact info$/ do - fill_in "user_skype", :with => "testskype" - fill_in "user_linkedin", :with => "testlinkedin" - fill_in "user_twitter", :with => "testtwitter" - click_button "Save" - @user.reload -end - -Then /^I should see new contact info$/ do - @user.skype.should == 'testskype' - @user.linkedin.should == 'testlinkedin' - @user.twitter.should == 'testtwitter' -end diff --git a/features/step_definitions/project/browse_code_steps.rb b/features/step_definitions/project/browse_code_steps.rb deleted file mode 100644 index d2ed9a0af28b56dce236ca409800cd63c12c8dea..0000000000000000000000000000000000000000 --- a/features/step_definitions/project/browse_code_steps.rb +++ /dev/null @@ -1,38 +0,0 @@ -Then /^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 "(.*?)"$/ 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 - -Then /^I should see raw file content$/ do - page.source.should == ValidCommit::BLOB_FILE -end - -Given /^I click blame button$/ do - click_link "blame" -end - -Then /^I should see git file blame$/ do - page.should have_content("rubygems.org") - page.should have_content("Dmitriy Zaporozhets") - page.should have_content("bc3735004cb Moving to rails 3.2") -end diff --git a/features/step_definitions/project/project_commits_steps.rb b/features/step_definitions/project/project_commits_steps.rb deleted file mode 100644 index 7f20ade41d1f9ccf508ca71e72b4c650cf0e2608..0000000000000000000000000000000000000000 --- a/features/step_definitions/project/project_commits_steps.rb +++ /dev/null @@ -1,64 +0,0 @@ -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 = CommitDecorator.decorate(@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.description) -end - -Then /^I see commit info$/ do - page.should have_content ValidCommit::MESSAGE - page.should have_content "Showing 1 changed file" -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 - -Then /^I should see "(.*?)" recent branches list$/ do |arg1| - page.should have_content("Branches") - page.should have_content("master") -end - -Then /^I should see "(.*?)" all branches list$/ do |arg1| - page.should have_content("Branches") - page.should have_content("master") -end - -Then /^I should see "(.*?)" all tags list$/ do |arg1| - page.should have_content("Tags") - page.should have_content("v1.2.1") -end - -Then /^I should see "(.*?)" protected branches list$/ do |arg1| - within "table" do - page.should have_content "stable" - page.should_not have_content "master" - end -end - -Given /^project "(.*?)" has protected branches$/ do |arg1| - project = Project.find_by_name(arg1) - project.protected_branches.create(:name => "stable") -end diff --git a/features/step_definitions/project/project_issues_steps.rb b/features/step_definitions/project/project_issues_steps.rb deleted file mode 100644 index d78da53c4fcd7d835b85f373298437421f103b38..0000000000000000000000000000000000000000 --- a/features/step_definitions/project/project_issues_steps.rb +++ /dev/null @@ -1,81 +0,0 @@ -Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first) -end - -Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) -end - -Given /^I should see "(.*?)" in issues$/ do |arg1| - page.should have_content arg1 -end - -Given /^I should not see "(.*?)" in issues$/ do |arg1| - page.should_not have_content arg1 -end - -Then /^I should see issue "(.*?)"$/ do |arg1| - issue = Issue.find_by_title(arg1) - page.should have_content issue.title - page.should have_content issue.author_name - page.should have_content issue.project.name -end - -Given /^I submit new issue "(.*?)"$/ do |arg1| - fill_in "issue_title", with: arg1 - click_button "Submit new issue" -end - -Given /^project "(.*?)" have issues tags:$/ do |arg1, table| - project = Project.find_by_name(arg1) - table.hashes.each do |hash| - Factory :issue, - project: project, - label_list: [hash[:name]] - end -end - -Given /^I visit project "(.*?)" labels page$/ do |arg1| - visit project_labels_path(Project.find_by_name(arg1)) -end - -Then /^I should see label "(.*?)"$/ do |arg1| - within ".labels-table" do - page.should have_content arg1 - end -end - -Given /^I fill in issue search with "(.*?)"$/ do |arg1| - # Because fill_in, with: "" triggers nothing - # we need to trigger a keyup event - if arg1 == '' - page.execute_script("$('.issue_search').val('').keyup();"); - end - fill_in 'issue_search', with: arg1 -end - -When /^I select milestone "(.*?)"$/ do |milestone_title| - select milestone_title, from: "milestone_id" -end - -Then /^I should see selected milestone with title "(.*?)"$/ do |milestone_title| - issues_milestone_selector = "#issue_milestone_id_chzn/a" - wait_until{ page.has_content?("Details") } - page.find(issues_milestone_selector).should have_content(milestone_title) -end - -When /^I select first assignee from "(.*?)" project$/ do |project_name| - project = Project.find_by_name project_name - first_assignee = project.users.first - select first_assignee.name, from: "assignee_id" -end - -Then /^I should see first assignee from "(.*?)" as selected assignee$/ do |project_name| - issues_assignee_selector = "#issue_assignee_id_chzn/a" - wait_until{ page.has_content?("Details") } - project = Project.find_by_name project_name - assignee_name = project.users.first.name - page.find(issues_assignee_selector).should have_content(assignee_name) -end diff --git a/features/step_definitions/project/project_merge_requests_steps.rb b/features/step_definitions/project/project_merge_requests_steps.rb deleted file mode 100644 index fddb18add087374e80b2e09e23dadee8d41f999f..0000000000000000000000000000000000000000 --- a/features/step_definitions/project/project_merge_requests_steps.rb +++ /dev/null @@ -1,38 +0,0 @@ -Given /^project "(.*?)" have "(.*?)" open merge request$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - Factory.create(:merge_request, :title => arg2, :project => project, :author => project.users.first) -end - -Given /^project "(.*?)" have "(.*?)" closed merge request$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - Factory.create(:merge_request, :title => arg2, :project => project, :author => project.users.first, :closed => true) -end - -Then /^I should see "(.*?)" in merge requests$/ do |arg1| - page.should have_content arg1 -end - -Then /^I should not see "(.*?)" in merge requests$/ do |arg1| - page.should_not have_content arg1 -end - -Then /^I should see merge request "(.*?)"$/ do |arg1| - merge_request = MergeRequest.find_by_title(arg1) - page.should have_content(merge_request.title[0..10]) - page.should have_content(merge_request.target_branch) - page.should have_content(merge_request.source_branch) -end - -Given /^I submit new merge request "(.*?)"$/ do |arg1| - fill_in "merge_request_title", :with => arg1 - select "master", :from => "merge_request_source_branch" - select "stable", :from => "merge_request_target_branch" - click_button "Save" -end - -Then /^I should see closed merge request "(.*?)"$/ do |arg1| - mr = MergeRequest.find_by_title(arg1) - mr.closed.should be_true - page.should have_content "Closed by" -end - diff --git a/features/step_definitions/project/project_milestones_steps.rb b/features/step_definitions/project/project_milestones_steps.rb deleted file mode 100644 index 936c52df8d78e2a39238c0583d7afd2907e5a6dd..0000000000000000000000000000000000000000 --- a/features/step_definitions/project/project_milestones_steps.rb +++ /dev/null @@ -1,33 +0,0 @@ -Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - - milestone = Factory :milestone, - :title => arg2, - :project => project - - 3.times do |i| - issue = Factory :issue, - :project => project, - :milestone => milestone - end -end - -Then /^I should see active milestones$/ do - milestone = @project.milestones.first - page.should have_content(milestone.title[0..10]) - page.should have_content(milestone.expires_at) - page.should have_content("Browse Issues") -end - -Then /^I should see milestone "(.*?)"$/ do |arg1| - milestone = @project.milestones.find_by_title(arg1) - page.should have_content(milestone.title[0..10]) - page.should have_content(milestone.expires_at) - page.should have_content("Browse Issues") -end - -Given /^I submit new milestone "(.*?)"$/ do |arg1| - fill_in "milestone_title", :with => arg1 - click_button "Create milestone" -end - diff --git a/features/step_definitions/project/project_team_steps.rb b/features/step_definitions/project/project_team_steps.rb deleted file mode 100644 index 91885e46ac661e85cb22e652cc526513c9d3e532..0000000000000000000000000000000000000000 --- a/features/step_definitions/project/project_team_steps.rb +++ /dev/null @@ -1,55 +0,0 @@ -Given /^gitlab user "(.*?)"$/ do |arg1| - Factory :user, :name => arg1 -end - -Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2| - user = User.find_by_name(arg1) - project = Project.find_by_name(arg2) - project.add_access(user, :write) -end - -Then /^I should be able to see myself in team$/ do - page.should have_content(@user.name) - page.should have_content(@user.email) -end - -Then /^I should see "(.*?)" in team list$/ do |arg1| - user = User.find_by_name(arg1) - page.should have_content(user.name) - page.should have_content(user.email) -end - -Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2| - user = User.find_by_name(arg1) - within "#new_team_member" do - select user.name, :from => "user_ids" - select arg2, :from => "project_access" - end - click_button "Save" -end - -Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2| - user = User.find_by_name(arg1) - role_id = find(".user_#{user.id} #team_member_project_access").value - role_id.should == UsersProject.access_roles[arg2].to_s -end - -Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2| - user = User.find_by_name(arg1) - within ".user_#{user.id}" do - select arg2, :from => "team_member_project_access" - end -end - -Then /^I should see "(.*?)" team profile$/ do |arg1| - user = User.find_by_name(arg1) - page.should have_content(user.name) - page.should have_content(user.email) - page.should have_content("To team list") -end - -Then /^I should not see "(.*?)" in team list$/ do |arg1| - user = User.find_by_name(arg1) - page.should_not have_content(user.name) - page.should_not have_content(user.email) -end diff --git a/features/step_definitions/project/project_wiki_steps.rb b/features/step_definitions/project/project_wiki_steps.rb deleted file mode 100644 index 31fc050aa4c3c744ce5fafe6a5b13cdc138ebdb5..0000000000000000000000000000000000000000 --- a/features/step_definitions/project/project_wiki_steps.rb +++ /dev/null @@ -1,14 +0,0 @@ -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/step_definitions/project/projects_steps.rb b/features/step_definitions/project/projects_steps.rb deleted file mode 100644 index d22b805f1dfc35d4e89b1bdeff94ac1b555faf21..0000000000000000000000000000000000000000 --- a/features/step_definitions/project/projects_steps.rb +++ /dev/null @@ -1,77 +0,0 @@ -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, :admin) -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 - -Given /^I visit project "(.*?)" page$/ do |arg1| - project = Project.find_by_name(arg1) - visit project_path(project) -end - -Given /^I visit project "(.*?)" network page$/ do |arg1| - project = Project.find_by_name(arg1) - - # Stub out find_all to speed this up (10 commits vs. 650) - commits = Grit::Commit.find_all(project.repo, nil, {max_count: 10}) - Grit::Commit.stub(:find_all).and_return(commits) - - visit graph_project_path(project) -end - -Given /^page should have network graph$/ do - page.should have_content "Project Network Graph" - within ".graph" do - page.should have_content "master" - page.should have_content "scss_refactor..." - end -end - -Given /^I leave a comment like "(.*?)"$/ do |arg1| - fill_in "note_note", :with => arg1 - click_button "Add Comment" -end - -Then /^I should see comment "(.*?)"$/ do |arg1| - page.should have_content(arg1) -end diff --git a/features/step_definitions/visit_steps.rb b/features/step_definitions/visit_steps.rb deleted file mode 100644 index 35fc6d44a159a28afc6a1a4f4ea9206b2b43b108..0000000000000000000000000000000000000000 --- a/features/step_definitions/visit_steps.rb +++ /dev/null @@ -1,91 +0,0 @@ -Given /^I visit project "(.*?)" issues page$/ do |arg1| - visit project_issues_path(Project.find_by_name(arg1)) -end - -Given /^I visit issue page "(.*?)"$/ do |arg1| - issue = Issue.find_by_title(arg1) - visit project_issue_path(issue.project, issue) -end - -Given /^I visit project "(.*?)" merge requests page$/ do |arg1| - visit project_merge_requests_path(Project.find_by_name(arg1)) -end - -Given /^I visit merge request page "(.*?)"$/ do |arg1| - mr = MergeRequest.find_by_title(arg1) - visit project_merge_request_path(mr.project, mr) -end - -Given /^I visit project "(.*?)" milestones page$/ do |arg1| - @project = Project.find_by_name(arg1) - visit project_milestones_path(@project) -end - -Given /^I visit project commits page$/ do - visit project_commits_path(@project) -end - -Given /^I visit compare refs page$/ do - visit compare_project_commits_path(@project) -end - -Given /^I visit project branches page$/ do - visit branches_project_repository_path(@project) -end - -Given /^I visit project commit page$/ do - visit project_commit_path(@project, ValidCommit::ID) -end - -Given /^I visit project tags page$/ do - visit tags_project_repository_path(@project) -end - -Given /^I click on commit link$/ do - visit project_commit_path(@project, ValidCommit::ID) -end - -Given /^I visit project source page$/ do - visit tree_project_ref_path(@project, @project.root_ref) -end - -Given /^I visit project source page for "(.*?)"$/ do |arg1| - visit tree_project_ref_path(@project, arg1) -end - -Given /^I visit blob file from repo$/ do - visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) -end - -Given /^I visit project "(.*?)" team page$/ do |arg1| - visit team_project_path(Project.find_by_name(arg1)) -end - -Given /^I visit project wiki page$/ do - visit project_wiki_path(@project, :index) -end - -Given /^I visit profile page$/ do - visit profile_path -end - -Given /^I visit profile token page$/ do - visit profile_token_path -end - -Given /^I visit profile password page$/ do - visit profile_password_path -end - -Given /^I visit dashboard page$/ do - visit dashboard_path -end - -Given /^I visit dashboard issues page$/ do - visit dashboard_issues_path -end - -Given /^I visit dashboard merge requests page$/ do - visit dashboard_merge_requests_path -end - diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb new file mode 100644 index 0000000000000000000000000000000000000000..6c603bbea5587e90ba06b2a3f4a465ea8aefed52 --- /dev/null +++ b/features/steps/dashboard/dashboard.rb @@ -0,0 +1,92 @@ +class Dashboard < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + Then 'I should see "New Project" link' do + page.should have_link "New Project" + end + + Then 'I should see "Shop" project link' do + page.should have_link "Shop" + end + + Then 'I should see project "Shop" activity feed' do + project = Project.find_by_name("Shop") + page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}" + end + + Then 'I should see last push widget' do + page.should have_content "Your pushed to branch new_design" + page.should have_link "Create Merge Request" + end + + And 'I click "Create Merge Request" link' do + click_link "Create Merge Request" + end + + Then 'I see prefilled new Merge Request page' do + current_path.should == new_project_merge_request_path(@project) + find("#merge_request_source_branch").value.should == "new_design" + find("#merge_request_target_branch").value.should == "master" + find("#merge_request_title").value.should == "New Design" + end + + Given 'user with name "John Doe" joined project "Shop"' do + user = Factory.create(:user, {name: "John Doe"}) + project = Project.find_by_name "Shop" + Event.create( + project: project, + author_id: user.id, + action: Event::Joined + ) + end + + Then 'I should see "John Doe joined project Shop" event' do + page.should have_content "John Doe joined project Shop" + end + + And 'user with name "John Doe" left project "Shop"' do + user = User.find_by_name "John Doe" + project = Project.find_by_name "Shop" + Event.create( + project: project, + author_id: user.id, + action: Event::Left + ) + end + + Then 'I should see "John Doe left project Shop" event' do + page.should have_content "John Doe left project Shop" + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => 'Shop' + @project.add_access(@user, :admin) + end + + And 'project "Shop" has push event' do + @project = Project.find_by_name("Shop") + + data = { + :before => "0000000000000000000000000000000000000000", + :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", + :ref => "refs/heads/new_design", + :user_id => @user.id, + :user_name => @user.name, + :repository => { + :name => @project.name, + :url => "localhost/rubinius", + :description => "", + :homepage => "localhost/rubinius", + :private => true + } + } + + @event = Event.create( + :project => @project, + :action => Event::Pushed, + :data => data, + :author_id => @user.id + ) + end +end diff --git a/features/steps/dashboard/dashboard_issues.rb b/features/steps/dashboard/dashboard_issues.rb new file mode 100644 index 0000000000000000000000000000000000000000..9368782bf99e2127d0b3c41441821c53e9e22d78 --- /dev/null +++ b/features/steps/dashboard/dashboard_issues.rb @@ -0,0 +1,19 @@ +class DashboardIssues < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + Then 'I should see issues assigned to me' do + issues = @user.issues + issues.each do |issue| + page.should have_content(issue.title[0..10]) + page.should have_content(issue.project.name) + end + end + + And 'I have assigned issues' do + project = Factory :project + project.add_access(@user, :read, :write) + + 2.times { Factory :issue, :author => @user, :assignee => @user, :project => project } + end +end diff --git a/features/steps/dashboard/dashboard_merge_requests.rb b/features/steps/dashboard/dashboard_merge_requests.rb new file mode 100644 index 0000000000000000000000000000000000000000..fc339e756d8219f85b2cd5bfef642f9c2e20adb0 --- /dev/null +++ b/features/steps/dashboard/dashboard_merge_requests.rb @@ -0,0 +1,23 @@ +class DashboardMergeRequests < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + Then 'I should see my merge requests' do + merge_requests = @user.merge_requests + merge_requests.each do |mr| + page.should have_content(mr.title[0..10]) + page.should have_content(mr.project.name) + end + end + + And 'I have authored merge requests' do + project1 = Factory :project + project2 = Factory :project + + project1.add_access(@user, :read, :write) + project2.add_access(@user, :read, :write) + + merge_request1 = Factory :merge_request, :author => @user, :project => project1 + merge_request2 = Factory :merge_request, :author => @user, :project => project2 + end +end diff --git a/features/steps/dashboard/dashboard_search.rb b/features/steps/dashboard/dashboard_search.rb new file mode 100644 index 0000000000000000000000000000000000000000..e35858985d688a89b7c965468dacb7e7417764bc --- /dev/null +++ b/features/steps/dashboard/dashboard_search.rb @@ -0,0 +1,18 @@ +class DashboardSearch < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + Given 'I search for "Sho"' do + fill_in "dashboard_search", :with => "Sho" + click_button "Search" + end + + Then 'I should see "Shop" project link' do + page.should have_link "Shop" + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end +end diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb new file mode 100644 index 0000000000000000000000000000000000000000..d3261a1669018a53e8c8fdc51b449e329b89838c --- /dev/null +++ b/features/steps/profile/profile.rb @@ -0,0 +1,44 @@ +class Profile < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + 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 + + Then 'I change my contact info' do + fill_in "user_skype", :with => "testskype" + fill_in "user_linkedin", :with => "testlinkedin" + fill_in "user_twitter", :with => "testtwitter" + click_button "Save" + @user.reload + end + + And 'I should see new contact info' do + @user.skype.should == 'testskype' + @user.linkedin.should == 'testlinkedin' + @user.twitter.should == 'testtwitter' + end + + Then 'I change my password' do + fill_in "user_password", :with => "222333" + fill_in "user_password_confirmation", :with => "222333" + click_button "Save" + end + + And 'I should be redirected to sign in page' do + current_path.should == new_user_session_path + end + + Then 'I reset my token' do + @old_token = @user.private_token + click_button "Reset" + end + + And 'I should see new token' do + find("#token").value.should_not == @old_token + find("#token").value.should == @user.reload.private_token + end +end diff --git a/features/steps/profile/profile_ssh_keys.rb b/features/steps/profile/profile_ssh_keys.rb new file mode 100644 index 0000000000000000000000000000000000000000..96df2d7342fd8e609c2d41cce65123945f035044 --- /dev/null +++ b/features/steps/profile/profile_ssh_keys.rb @@ -0,0 +1,48 @@ +class ProfileSshKeys < Spinach::FeatureSteps + include SharedAuthentication + + Then 'I should see my ssh keys' do + @user.keys.each do |key| + page.should have_content(key.title) + end + end + + Given 'I click link "Add new"' do + click_link "Add new" + end + + And 'I submit new ssh key "Laptop"' do + fill_in "key_title", :with => "Laptop" + fill_in "key_key", :with => "ssh-rsa publickey234=" + click_button "Save" + end + + Then 'I should see new ssh key "Laptop"' do + key = Key.find_by_title("Laptop") + page.should have_content(key.title) + page.should have_content(key.key) + current_path.should == key_path(key) + end + + Given 'I click link "Work"' do + click_link "Work" + end + + And 'I click link "Remove"' do + click_link "Remove" + end + + Then 'I visit profile keys page' do + visit keys_path + end + + And 'I should not see "Work" ssh key' do + within "#keys-table" do + page.should_not have_content "Work" + end + end + + And 'I have ssh key "ssh-rsa Work"' do + Factory :key, :user => @user, :title => "ssh-rsa Work", :key => "jfKLJDFKSFJSHFJssh-rsa Work" + end +end diff --git a/features/steps/project/create_project.rb b/features/steps/project/create_project.rb new file mode 100644 index 0000000000000000000000000000000000000000..6d2ca3f9b568bc126b738f93728ed6a0b73a4aec --- /dev/null +++ b/features/steps/project/create_project.rb @@ -0,0 +1,22 @@ +class CreateProject < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + And '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 + + And '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 +end diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb new file mode 100644 index 0000000000000000000000000000000000000000..f33f12eb0a8b79eb28905038a1662820c717245f --- /dev/null +++ b/features/steps/project/project.rb @@ -0,0 +1,5 @@ +class Projects < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths +end diff --git a/features/steps/project/project_browse_branches.rb b/features/steps/project/project_browse_branches.rb new file mode 100644 index 0000000000000000000000000000000000000000..2f6e185deea0140e04222b1e26f0b93f9526e7d0 --- /dev/null +++ b/features/steps/project/project_browse_branches.rb @@ -0,0 +1,35 @@ +class ProjectBrowseBranches < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see "Shop" recent branches list' do + page.should have_content "Branches" + page.should have_content "master" + end + + Given 'I click link "All"' do + click_link "All" + end + + Then 'I should see "Shop" all branches list' do + page.should have_content "Branches" + page.should have_content "master" + end + + Given 'I click link "Protected"' do + click_link "Protected" + end + + Then 'I should see "Shop" protected branches list' do + within "table" do + page.should have_content "stable" + page.should_not have_content "master" + end + end + + And 'project "Shop" has protected branches' do + project = Project.find_by_name("Shop") + project.protected_branches.create(:name => "stable") + end +end diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb new file mode 100644 index 0000000000000000000000000000000000000000..014799879e80849c54cacbbabd680c9c0e1ddc7f --- /dev/null +++ b/features/steps/project/project_browse_commits.rb @@ -0,0 +1,47 @@ +class ProjectBrowseCommits < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + 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 = CommitDecorator.decorate(@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.description) + 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 + + And 'I fill compare fields with refs' do + fill_in "from", :with => "master" + fill_in "to", :with => "stable" + click_button "Compare" + end + + And '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 +end diff --git a/features/steps/project/project_browse_files.rb b/features/steps/project/project_browse_files.rb new file mode 100644 index 0000000000000000000000000000000000000000..67c553ced4091e3850842f9029deab1a7aadeeb2 --- /dev/null +++ b/features/steps/project/project_browse_files.rb @@ -0,0 +1,34 @@ +class ProjectBrowseFiles < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then '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 + current_path.should == tree_project_ref_path(@project, "8470d70") + page.should have_content "app" + page.should have_content "History" + page.should have_content "Gemfile" + end + + Given 'I click on "Gemfile" file in repo' do + click_link "Gemfile" + end + + Then 'I should see it content' do + page.should have_content "rubygems.org" + end + + And 'I click link "raw"' do + click_link "raw" + end + + Then 'I should see raw file content' do + page.source.should == ValidCommit::BLOB_FILE + end +end diff --git a/features/steps/project/project_browse_git_repo.rb b/features/steps/project/project_browse_git_repo.rb new file mode 100644 index 0000000000000000000000000000000000000000..e966f40773843c7be6b362937fdd3b07426cf115 --- /dev/null +++ b/features/steps/project/project_browse_git_repo.rb @@ -0,0 +1,19 @@ +class ProjectBrowseGitRepo < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Given 'I click on "Gemfile" file in repo' do + click_link "Gemfile" + end + + And 'I click blame button' do + click_link "blame" + end + + Then 'I should see git file blame' do + page.should have_content "rubygems.org" + page.should have_content "Dmitriy Zaporozhets" + page.should have_content "bc3735004cb Moving to rails 3.2" + end +end diff --git a/features/steps/project/project_browse_tags.rb b/features/steps/project/project_browse_tags.rb new file mode 100644 index 0000000000000000000000000000000000000000..0cbfa0d80aaf33d0637fa2b2e5e53be1630ebb39 --- /dev/null +++ b/features/steps/project/project_browse_tags.rb @@ -0,0 +1,10 @@ +class ProjectBrowseTags < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see "Shop" all tags list' do + page.should have_content "Tags" + page.should have_content "v1.2.1" + end +end diff --git a/features/steps/project/project_comment_commit.rb b/features/steps/project/project_comment_commit.rb new file mode 100644 index 0000000000000000000000000000000000000000..cb8385e1ce56b9b478d1a90c4b5645ce15422578 --- /dev/null +++ b/features/steps/project/project_comment_commit.rb @@ -0,0 +1,6 @@ +class ProjectCommentCommit < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths +end diff --git a/features/steps/project/project_issues.rb b/features/steps/project/project_issues.rb new file mode 100644 index 0000000000000000000000000000000000000000..64af24490aa3ce4753f2783aaddcc17cc3347312 --- /dev/null +++ b/features/steps/project/project_issues.rb @@ -0,0 +1,134 @@ +class ProjectIssues < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + + Given 'I should see "Release 0.4" in issues' do + page.should have_content "Release 0.4" + end + + And 'I should not see "Release 0.3" in issues' do + page.should_not have_content "Release 0.3" + end + + Given 'I click link "Closed"' do + click_link "Closed" + end + + Then 'I should see "Release 0.3" in issues' do + page.should have_content "Release 0.3" + end + + And 'I should not see "Release 0.4" in issues' do + page.should_not have_content "Release 0.4" + end + + Given 'I click link "All"' do + click_link "All" + end + + Given 'I click link "Release 0.4"' do + click_link "Release 0.4" + end + + Then 'I should see issue "Release 0.4"' do + page.should have_content "Release 0.4" + end + + Given 'I click link "New Issue"' do + click_link "New Issue" + end + + And 'I submit new issue "500 error on profile"' do + fill_in "issue_title", :with => "500 error on profile" + click_button "Submit new issue" + end + + Given 'I click link "500 error on profile"' do + click_link "500 error on profile" + end + + Then 'I should see issue "500 error on profile"' do + issue = Issue.find_by_title("500 error on profile") + page.should have_content issue.title + page.should have_content issue.author_name + page.should have_content issue.project.name + end + + Given 'I fill in issue search with "Release"' do + fill_in 'issue_search', with: "Release" + end + + Given 'I fill in issue search with "Bug"' do + fill_in 'issue_search', with: "Bug" + end + + And 'I fill in issue search with "0.3"' do + fill_in 'issue_search', with: "0.3" + end + + And 'I fill in issue search with "Something"' do + fill_in 'issue_search', with: "Something" + end + + And 'I fill in issue search with ""' do + page.execute_script("$('.issue_search').val('').keyup();"); + fill_in 'issue_search', with: "" + end + + Given 'project "Shop" has milestone "v2.2"' do + project = Project.find_by_name("Shop") + milestone = Factory :milestone, :title => "v2.2", :project => project + + 3.times { Factory :issue, :project => project, :milestone => milestone } + end + + And 'project "Shop" has milestone "v3.0"' do + project = Project.find_by_name("Shop") + milestone = Factory :milestone, :title => "v3.0", :project => project + + 3.times { Factory :issue, :project => project, :milestone => milestone } + end + + When 'I select milestone "v3.0"' do + select "v3.0", from: "milestone_id" + end + + Then 'I should see selected milestone with title "v3.0"' do + issues_milestone_selector = "#issue_milestone_id_chzn/a" + wait_until { page.has_content?("Details") } + page.find(issues_milestone_selector).should have_content("v3.0") + end + + When 'I select first assignee from "Shop" project' do + project = Project.find_by_name "Shop" + first_assignee = project.users.first + select first_assignee.name, from: "assignee_id" + end + + Then 'I should see first assignee from "Shop" as selected assignee' do + issues_assignee_selector = "#issue_assignee_id_chzn/a" + wait_until { page.has_content?("Details") } + project = Project.find_by_name "Shop" + assignee_name = project.users.first.name + page.find(issues_assignee_selector).should have_content(assignee_name) + end + + And 'project "Shop" have "Release 0.4" open issue' do + project = Project.find_by_name("Shop") + Factory.create(:issue, + :title => "Release 0.4", + :project => project, + :author => project.users.first) + end + + And 'project "Shop" have "Release 0.3" closed issue' do + project = Project.find_by_name("Shop") + Factory.create(:issue, + :title => "Release 0.3", + :project => project, + :author => project.users.first, + :closed => true) + end +end diff --git a/features/steps/project/project_labels.rb b/features/steps/project/project_labels.rb new file mode 100644 index 0000000000000000000000000000000000000000..1a347bf358f6c1ce8edb116f27a4737a03c166d3 --- /dev/null +++ b/features/steps/project/project_labels.rb @@ -0,0 +1,24 @@ +class ProjectLabels < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see label "bug"' do + within ".labels-table" do + page.should have_content "bug" + end + end + + And 'I should see label "feature"' do + within ".labels-table" do + page.should have_content "feature" + end + end + + And 'project "Shop" have issues tags: "bug", "feature"' do + project = Project.find_by_name("Shop") + ['bug', 'feature'].each do |label| + Factory :issue, project: project, label_list: label + end + end +end diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb new file mode 100644 index 0000000000000000000000000000000000000000..80e83906c723e93ff069857f7b29fd3e4982e500 --- /dev/null +++ b/features/steps/project/project_merge_requests.rb @@ -0,0 +1,80 @@ +class ProjectMergeRequests < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + + Then 'I should see "Bug NS-04" in merge requests' do + page.should have_content "Bug NS-04" + end + + And 'I should not see "Feature NS-03" in merge requests' do + page.should_not have_content "Feature NS-03" + end + + Given 'I click link "Closed"' do + click_link "Closed" + end + + Then 'I should see "Feature NS-03" in merge requests' do + page.should have_content "Feature NS-03" + end + + And 'I should not see "Bug NS-04" in merge requests' do + page.should_not have_content "Bug NS-04" + end + + Given 'I click link "All"' do + click_link "All" + end + + Given 'I click link "Bug NS-04"' do + click_link "Bug NS-04" + end + + Then 'I should see merge request "Bug NS-04"' do + page.should have_content "Bug NS-04" + end + + And 'I click link "Close"' do + click_link "Close" + end + + Then 'I should see closed merge request "Bug NS-04"' do + mr = MergeRequest.find_by_title("Bug NS-04") + mr.closed.should be_true + page.should have_content "Closed by" + end + + Given 'I click link "New Merge Request"' do + click_link "New Merge Request" + end + + And 'I submit new merge request "Wiki Feature"' do + fill_in "merge_request_title", :with => "Wiki Feature" + select "master", :from => "merge_request_source_branch" + select "stable", :from => "merge_request_target_branch" + click_button "Save" + end + + Then 'I should see merge request "Wiki Feature"' do + page.should have_content "Wiki Feature" + end + + And 'project "Shop" have "Bug NS-04" open merge request' do + project = Project.find_by_name("Shop") + Factory.create(:merge_request, + :title => "Bug NS-04", + :project => project, + :author => project.users.first) + end + + And 'project "Shop" have "Feature NS-03" closed merge request' do + project = Project.find_by_name("Shop") + Factory.create(:merge_request, + :title => "Feature NS-03", + :project => project, + :author => project.users.first, + :closed => true) + end +end diff --git a/features/steps/project/project_milestones.rb b/features/steps/project/project_milestones.rb new file mode 100644 index 0000000000000000000000000000000000000000..83ed6859f1b1a2f8247255747338fcd7c0456eff --- /dev/null +++ b/features/steps/project/project_milestones.rb @@ -0,0 +1,39 @@ +class ProjectMilestones < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see milestone "v2.2"' do + milestone = @project.milestones.find_by_title("v2.2") + page.should have_content(milestone.title[0..10]) + page.should have_content(milestone.expires_at) + page.should have_content("Browse Issues") + end + + Given 'I click link "v2.2"' do + click_link "v2.2" + end + + Given 'I click link "New Milestone"' do + click_link "New Milestone" + end + + And 'I submit new milestone "v2.3"' do + fill_in "milestone_title", :with => "v2.3" + click_button "Create milestone" + end + + Then 'I should see milestone "v2.3"' do + milestone = @project.milestones.find_by_title("v2.3") + page.should have_content(milestone.title[0..10]) + page.should have_content(milestone.expires_at) + page.should have_content("Browse Issues") + end + + And 'project "Shop" has milestone "v2.2"' do + project = Project.find_by_name("Shop") + milestone = Factory :milestone, :title => "v2.2", :project => project + + 3.times { Factory :issue, :project => project, :milestone => milestone } + end +end diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb new file mode 100644 index 0000000000000000000000000000000000000000..f34a81a408d0866d97958543a22e0eabe9f9ff94 --- /dev/null +++ b/features/steps/project/project_network_graph.rb @@ -0,0 +1,22 @@ +class ProjectNetworkGraph < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + + Then 'page should have network graph' do + page.should have_content "Project Network Graph" + within ".graph" do + page.should have_content "master" + page.should have_content "scss_refactor..." + end + end + + And 'I visit project "Shop" network page' do + project = Project.find_by_name("Shop") + + # Stub out find_all to speed this up (10 commits vs. 650) + commits = Grit::Commit.find_all(project.repo, nil, {max_count: 10}) + Grit::Commit.stub(:find_all).and_return(commits) + + visit graph_project_path(project) + end +end diff --git a/features/steps/project/project_team_management.rb b/features/steps/project/project_team_management.rb new file mode 100644 index 0000000000000000000000000000000000000000..7beca257e36a4a505533f63ef133bd67803795a2 --- /dev/null +++ b/features/steps/project/project_team_management.rb @@ -0,0 +1,89 @@ +class ProjectTeamManagement < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should be able to see myself in team' do + page.should have_content(@user.name) + page.should have_content(@user.email) + end + + And 'I should see "Sam" in team list' do + user = User.find_by_name("Sam") + page.should have_content(user.name) + page.should have_content(user.email) + end + + Given 'I click link "New Team Member"' do + click_link "New Team Member" + end + + And 'I select "Mike" as "Reporter"' do + user = User.find_by_name("Mike") + within "#new_team_member" do + select user.name, :from => "user_ids" + select "Reporter", :from => "project_access" + end + click_button "Save" + end + + Then 'I should see "Mike" in team list as "Reporter"' do + user = User.find_by_name("Mike") + role_id = find(".user_#{user.id} #team_member_project_access").value + role_id.should == UsersProject.access_roles["Reporter"].to_s + end + + Given 'I should see "Sam" in team list as "Developer"' do + user = User.find_by_name("Sam") + role_id = find(".user_#{user.id} #team_member_project_access").value + role_id.should == UsersProject.access_roles["Developer"].to_s + end + + And 'I change "Sam" role to "Reporter"' do + user = User.find_by_name("Sam") + within ".user_#{user.id}" do + select "Reporter", :from => "team_member_project_access" + end + end + + And 'I should see "Sam" in team list as "Reporter"' do + user = User.find_by_name("Sam") + role_id = find(".user_#{user.id} #team_member_project_access").value + role_id.should == UsersProject.access_roles["Reporter"].to_s + end + + Given 'I click link "Sam"' do + click_link "Sam" + end + + Then 'I should see "Sam" team profile' do + user = User.find_by_name("Sam") + page.should have_content(user.name) + page.should have_content(user.email) + page.should have_content("To team list") + end + + And 'I click link "Remove from team"' do + click_link "Remove from team" + end + + And 'I should not see "Sam" in team list' do + user = User.find_by_name("Sam") + page.should_not have_content(user.name) + page.should_not have_content(user.email) + end + + And 'gitlab user "Mike"' do + Factory :user, :name => "Mike" + end + + And 'gitlab user "Sam"' do + Factory :user, :name => "Sam" + end + + And '"Sam" is "Shop" developer' do + user = User.find_by_name("Sam") + project = Project.find_by_name("Shop") + project.add_access(user, :write) + end +end diff --git a/features/steps/project/project_wall.rb b/features/steps/project/project_wall.rb new file mode 100644 index 0000000000000000000000000000000000000000..ba9d3533b2cd68a3048bf48940eb2a4e068e815b --- /dev/null +++ b/features/steps/project/project_wall.rb @@ -0,0 +1,6 @@ +class ProjectWall < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths +end diff --git a/features/steps/project/project_wiki.rb b/features/steps/project/project_wiki.rb new file mode 100644 index 0000000000000000000000000000000000000000..902e9ce158ca19137372ae721ab703ad2a15161e --- /dev/null +++ b/features/steps/project/project_wiki.rb @@ -0,0 +1,20 @@ +class ProjectWiki < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + + 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 +end diff --git a/features/steps/shared/authentication.rb b/features/steps/shared/authentication.rb new file mode 100644 index 0000000000000000000000000000000000000000..77d9839f5b7f31d8309fb0ad92d7d45b4bcf2d64 --- /dev/null +++ b/features/steps/shared/authentication.rb @@ -0,0 +1,10 @@ +require Rails.root.join('spec', 'support', 'login_helpers') + +module SharedAuthentication + include Spinach::DSL + include LoginHelpers + + Given 'I sign in as a user' do + login_as :user + end +end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb new file mode 100644 index 0000000000000000000000000000000000000000..923e69b6b073da9cf8a461319a2c0e5ae86dfa7b --- /dev/null +++ b/features/steps/shared/note.rb @@ -0,0 +1,21 @@ +module SharedNote + include Spinach::DSL + + Given 'I leave a comment like "XML attached"' do + fill_in "note_note", :with => "XML attached" + click_button "Add Comment" + end + + Then 'I should see comment "XML attached"' do + page.should have_content "XML attached" + end + + Given 'I write new comment "my special test message"' do + fill_in "note_note", :with => "my special test message" + click_button "Add Comment" + end + + Then 'I should see project wall note "my special test message"' do + page.should have_content "my special test message" + end +end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb new file mode 100644 index 0000000000000000000000000000000000000000..05ae88e63e94554d2913e945f7165d40594bb422 --- /dev/null +++ b/features/steps/shared/paths.rb @@ -0,0 +1,112 @@ +module SharedPaths + include Spinach::DSL + + And 'I visit dashboard search page' do + visit search_path + end + + And 'I visit dashboard merge requests page' do + visit dashboard_merge_requests_path + end + + And 'I visit dashboard issues page' do + visit dashboard_issues_path + end + + When 'I visit dashboard page' do + visit dashboard_path + end + + Given 'I visit profile page' do + visit profile_path + end + + Given 'I visit profile password page' do + visit profile_password_path + end + + Given 'I visit profile token page' do + visit profile_token_path + end + + When 'I visit new project page' do + visit new_project_path + end + + And 'I visit project "Shop" page' do + project = Project.find_by_name("Shop") + visit project_path(project) + end + + Given 'I visit project branches page' do + visit branches_project_repository_path(@project) + end + + Given 'I visit compare refs page' do + visit compare_project_commits_path(@project) + end + + Given 'I visit project commits page' do + visit project_commits_path(@project) + end + + Given 'I visit project source page' do + visit tree_project_ref_path(@project, @project.root_ref) + end + + Given 'I visit blob file from repo' do + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) + end + + Given 'I visit project source page for "8470d70"' do + visit tree_project_ref_path(@project, "8470d70") + end + + Given 'I visit project tags page' do + visit tags_project_repository_path(@project) + end + + Given 'I visit project commit page' do + visit project_commit_path(@project, ValidCommit::ID) + end + + And 'I visit project "Shop" issues page' do + visit project_issues_path(Project.find_by_name("Shop")) + end + + Given 'I visit issue page "Release 0.4"' do + issue = Issue.find_by_title("Release 0.4") + visit project_issue_path(issue.project, issue) + end + + Given 'I visit project "Shop" labels page' do + visit project_labels_path(Project.find_by_name("Shop")) + end + + Given 'I visit merge request page "Bug NS-04"' do + mr = MergeRequest.find_by_title("Bug NS-04") + visit project_merge_request_path(mr.project, mr) + end + + And 'I visit project "Shop" merge requests page' do + visit project_merge_requests_path(Project.find_by_name("Shop")) + end + + Given 'I visit project "Shop" milestones page' do + @project = Project.find_by_name("Shop") + visit project_milestones_path(@project) + end + + Then 'I visit project "Shop" team page' do + visit team_project_path(Project.find_by_name("Shop")) + end + + Then 'I visit project "Shop" wall page' do + project = Project.find_by_name("Shop") + visit wall_project_path(project) + end + + Given 'I visit project wiki page' do + visit project_wiki_path(@project, :index) + end +end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb new file mode 100644 index 0000000000000000000000000000000000000000..9b64ca59a3b87d59e537f66a688008205c93fdd1 --- /dev/null +++ b/features/steps/shared/project.rb @@ -0,0 +1,8 @@ +module SharedProject + include Spinach::DSL + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end +end diff --git a/features/support/env.rb b/features/support/env.rb index 5357815201af1bd48b99cf42127b496e788df715..9c6cef07298cf51c0813685bcf82c4654b53016c 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,59 +1,27 @@ -unless ENV['CI'] - require 'simplecov' - SimpleCov.start 'rails' -end - -require 'cucumber/rails' -require 'webmock/cucumber' - -WebMock.allow_net_connect! - -require Rails.root.join 'spec/support/gitolite_stub' -require Rails.root.join 'spec/support/stubbed_repository' -require Rails.root.join 'spec/support/login_helpers' -require Rails.root.join 'spec/support/valid_commit' +ENV['RAILS_ENV'] = 'test' +require './config/environment' -Capybara.default_selector = :css -Capybara.javascript_driver = :webkit +require 'rspec' +require 'database_cleaner' +require 'spinach/capybara' -# 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." +%w(gitolite_stub stubbed_repository valid_commit).each do |f| + require Rails.root.join('spec', 'support', f) end -Cucumber::Rails::Database.javascript_strategy = :truncation +Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file} -require 'headless' +include GitoliteStub -headless = Headless.new -headless.start +WebMock.allow_net_connect! +Capybara.javascript_driver = :webkit -require 'cucumber/rspec/doubles' +DatabaseCleaner.strategy = :truncation +Spinach.hooks.before_scenario { DatabaseCleaner.start } +Spinach.hooks.after_scenario { DatabaseCleaner.clean } -include GitoliteStub +Spinach.hooks.before_run do + RSpec::Mocks::setup self -Before do stub_gitolite! end - -World(FactoryGirl::Syntax::Methods) diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake deleted file mode 100644 index 83f79471e59f606e24ea78921be60d709e1b8f50..0000000000000000000000000000000000000000 --- a/lib/tasks/cucumber.rake +++ /dev/null @@ -1,65 +0,0 @@ -# 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 index 77e148cf18c153b3e31f2e65ec981dc0f2660ba7..ad1bfb2e4b3fc783b1d945207aeaa71632c6819b 100644 --- a/lib/tasks/gitlab/test.rake +++ b/lib/tasks/gitlab/test.rake @@ -1,5 +1,4 @@ namespace :gitlab do - desc "GITLAB | Run both cucumber & rspec" - task :test => ['cucumber', 'spec'] + desc "GITLAB | Run both spinach and rspec" + task :test => ['spinach', 'spec'] end - diff --git a/lib/tasks/travis.rake b/lib/tasks/travis.rake index 58767e10611427874083ab6bb114502dcf65989b..13e32135c66d10a709da613c0bc48b16635f37c7 100644 --- a/lib/tasks/travis.rake +++ b/lib/tasks/travis.rake @@ -1,5 +1,5 @@ task :travis do - ["cucumber", "rspec spec"].each do |cmd| + ["spinach", "rspec spec"].each do |cmd| puts "Starting to run #{cmd}..." system("export DISPLAY=:99.0 && bundle exec #{cmd}") raise "#{cmd} failed!" unless $?.exitstatus == 0 diff --git a/script/cucumber b/script/cucumber deleted file mode 100755 index 7fa5c9208675ca06c02b2d3a3279f17623d1cbc9..0000000000000000000000000000000000000000 --- a/script/cucumber +++ /dev/null @@ -1,10 +0,0 @@ -#!/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