summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-31 17:23:40 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-31 17:23:40 +0300
commitc2c7d14ec51ec8654cc4e0ca57ba0bc146fd8725 (patch)
treea934912a8d8711d5fca2b7a1b3da1ee8b4698519 /features
parentbb2f4d665e946806d0bb94d3a50569ae6aa12e66 (diff)
downloadgitlab-ce-c2c7d14ec51ec8654cc4e0ca57ba0bc146fd8725.tar.gz
Move all test repos data to ReposHelpers
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'features')
-rw-r--r--features/project/commits/commits.feature4
-rw-r--r--features/project/commits/user_lookup.feature11
-rw-r--r--features/steps/project/browse_commits.rb36
-rw-r--r--features/steps/project/browse_commits_user_lookup.rb47
-rw-r--r--features/steps/project/browse_files.rb3
-rw-r--r--features/steps/shared/paths.rb5
-rw-r--r--features/support/env.rb2
7 files changed, 57 insertions, 51 deletions
diff --git a/features/project/commits/commits.feature b/features/project/commits/commits.feature
index cbe8b321507..7c6db3c465a 100644
--- a/features/project/commits/commits.feature
+++ b/features/project/commits/commits.feature
@@ -38,10 +38,6 @@ Feature: Project Browse commits
Given I visit big commit page
Then I see big commit warning
- Scenario: I browse huge commit
- Given I visit huge commit page
- Then I see huge commit message
-
Scenario: I browse a commit with an image
Given I visit a commit with an image that changed
Then The diff links to both the previous and current image
diff --git a/features/project/commits/user_lookup.feature b/features/project/commits/user_lookup.feature
index aa347e24fe4..7b194ab9206 100644
--- a/features/project/commits/user_lookup.feature
+++ b/features/project/commits/user_lookup.feature
@@ -2,13 +2,14 @@ Feature: Project Browse Commits User Lookup
Background:
Given I sign in as a user
And I own a project
- And I have the user that authored the commits
And I visit my project's commits page
Scenario: I browse commit from list
- Given I click on commit link
- Then I see commit info
+ Given I have user with primary email
+ When I click on commit link
+ Then I see author based on primary email
Scenario: I browse another commit from list
- Given I click on another commit link
- Then I see other commit info
+ Given I have user with secondary email
+ When I click on another commit link
+ Then I see author based on secondary email
diff --git a/features/steps/project/browse_commits.rb b/features/steps/project/browse_commits.rb
index fe47a731915..37207aafebe 100644
--- a/features/steps/project/browse_commits.rb
+++ b/features/steps/project/browse_commits.rb
@@ -2,11 +2,12 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
+ include RepoHelpers
Then 'I see project commits' do
commit = @project.repository.commit
page.should have_content(@project.name)
- page.should have_content(commit.message)
+ page.should have_content(commit.message[0..20])
page.should have_content(commit.id.to_s[0..5])
end
@@ -19,21 +20,21 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
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)
+ page.body.should have_selector("entry summary", text: commit.description[0..10])
end
Given 'I click on commit link' do
- visit project_commit_path(@project, ValidCommit::ID)
+ visit project_commit_path(@project, sample_commit.id)
end
Then 'I see commit info' do
- page.should have_content ValidCommit::MESSAGE
- page.should have_content "Showing 1 changed file"
+ page.should have_content sample_commit.message
+ page.should have_content "Showing #{sample_commit.files_changed_count} changed files"
end
And 'I fill compare fields with refs' do
- fill_in "from", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812"
- fill_in "to", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
+ fill_in "from", with: sample_commit.parent_id
+ fill_in "to", with: sample_commit.id
click_button "Compare"
end
@@ -56,30 +57,24 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
end
Given 'I visit big commit page' do
- visit project_commit_path(@project, BigCommits::BIG_COMMIT_ID)
+ Commit::DIFF_SAFE_FILES = 20
+ visit project_commit_path(@project, sample_big_commit.id)
end
Then 'I see big commit warning' do
- page.should have_content BigCommits::BIG_COMMIT_MESSAGE
+ page.should have_content sample_big_commit.message
page.should have_content "Too many changes"
- end
-
- Given 'I visit huge commit page' do
- visit project_commit_path(@project, BigCommits::HUGE_COMMIT_ID)
- end
-
- Then 'I see huge commit message' do
- page.should have_content BigCommits::HUGE_COMMIT_MESSAGE
+ Commit::DIFF_SAFE_FILES = 100
end
Given 'I visit a commit with an image that changed' do
- visit project_commit_path(@project, 'cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b')
+ visit project_commit_path(@project, sample_image_commit.id)
end
Then 'The diff links to both the previous and current image' do
links = page.all('.two-up span div a')
- links[0]['href'].should =~ %r{blob/bc3735004cb45cec5e0e4fa92710897a910a5957}
- links[1]['href'].should =~ %r{blob/cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b}
+ links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}}
+ links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}}
end
Given 'I click side-by-side diff button' do
@@ -93,5 +88,4 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
Then 'I see inline diff button' do
page.should have_content "Inline Diff"
end
-
end
diff --git a/features/steps/project/browse_commits_user_lookup.rb b/features/steps/project/browse_commits_user_lookup.rb
index 328be373553..198ea29f28d 100644
--- a/features/steps/project/browse_commits_user_lookup.rb
+++ b/features/steps/project/browse_commits_user_lookup.rb
@@ -2,34 +2,47 @@ class ProjectBrowseCommitsUserLookup < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
-
- Given 'I have the user that authored the commits' do
- @user = create(:user, email: 'dmitriy.zaporozhets@gmail.com')
- create(:email, { user: @user, email: 'dzaporozhets@sphereconsultinginc.com' })
- end
Given 'I click on commit link' do
- visit project_commit_path(@project, ValidCommit::ID)
+ visit project_commit_path(@project, sample_commit.id)
end
Given 'I click on another commit link' do
- visit project_commit_path(@project, ValidCommitWithAltEmail::ID)
+ visit project_commit_path(@project, sample_commit.parent_id)
+ end
+
+ step 'I have user with primary email' do
+ user_primary
+ end
+
+ step 'I have user with secondary email' do
+ user_secondary
end
- Then 'I see commit info' do
- page.should have_content ValidCommit::MESSAGE
- check_author_link(ValidCommit::AUTHOR_EMAIL)
+ step 'I see author based on primary email' do
+ check_author_link(sample_commit.author_email, user_primary)
end
-
- Then 'I see other commit info' do
- page.should have_content ValidCommitWithAltEmail::MESSAGE
- check_author_link(ValidCommitWithAltEmail::AUTHOR_EMAIL)
+
+ step 'I see author based on secondary email' do
+ check_author_link(sample_commit.author_email, user_secondary)
end
- def check_author_link(email)
+ def check_author_link(email, user)
author_link = find('.commit-author-link')
- author_link['href'].should == user_path(@user)
+ author_link['href'].should == user_path(user)
author_link['data-original-title'].should == email
- find('.commit-author-name').text.should == @user.name
+ find('.commit-author-name').text.should == user.name
+ end
+
+ def user_primary
+ @user_primary ||= create(:user, email: 'dmitriy.zaporozhets@gmail.com')
+ end
+
+ def user_secondary
+ @user_secondary ||= begin
+ user = create(:user, email: 'dzaporozhets@example.com')
+ create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' })
+ user
+ end
end
end
diff --git a/features/steps/project/browse_files.rb b/features/steps/project/browse_files.rb
index 1e54e00f37a..6fd0c2c2ded 100644
--- a/features/steps/project/browse_files.rb
+++ b/features/steps/project/browse_files.rb
@@ -2,6 +2,7 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
+ include RepoHelpers
step 'I should see files from repository' do
page.should have_content "VERSION"
@@ -28,7 +29,7 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
end
step 'I should see raw file content' do
- page.source.should == ValidCommit::BLOB_FILE
+ page.source.should == sample_blob.data
end
step 'I click button "edit"' do
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 6acf877c256..4e97dba20b3 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -1,5 +1,6 @@
module SharedPaths
include Spinach::DSL
+ include RepoHelpers
step 'I visit new project page' do
visit new_project_path
@@ -257,7 +258,7 @@ module SharedPaths
end
step 'I visit blob file from repo' do
- visit project_blob_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH))
+ visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
end
step 'I visit ".gitignore" file in repo' do
@@ -273,7 +274,7 @@ module SharedPaths
end
step 'I visit project commit page' do
- visit project_commit_path(@project, ValidCommit::ID)
+ visit project_commit_path(@project, sample_commit.id)
end
step 'I visit project "Shop" issues page' do
diff --git a/features/support/env.rb b/features/support/env.rb
index 5b3e78cbec3..480cb361b67 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -15,7 +15,7 @@ require 'spinach/capybara'
require 'sidekiq/testing/inline'
-%w(valid_commit valid_commit_with_alt_email big_commits select2_helper test_env).each do |f|
+%w(select2_helper test_env repo_helpers).each do |f|
require Rails.root.join('spec', 'support', f)
end