Fix form mr tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
2a6fc1c5de
commit
cbe4891d7c
|
@ -4,7 +4,6 @@ Feature: Project Forked Merge Requests
|
||||||
And I am a member of project "Shop"
|
And I am a member of project "Shop"
|
||||||
And I have a project forked off of "Shop" called "Forked Shop"
|
And I have a project forked off of "Shop" called "Forked Shop"
|
||||||
|
|
||||||
@javascript
|
|
||||||
Scenario: I submit new unassigned merge request to a forked project
|
Scenario: I submit new unassigned merge request to a forked project
|
||||||
Given I visit project "Forked Shop" merge requests page
|
Given I visit project "Forked Shop" merge requests page
|
||||||
And I click link "New Merge Request"
|
And I click link "New Merge Request"
|
||||||
|
|
|
@ -9,18 +9,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
|
||||||
@project = Project.find_by(name: "Shop")
|
@project = Project.find_by(name: "Shop")
|
||||||
@project ||= create(:project, name: "Shop")
|
@project ||= create(:project, name: "Shop")
|
||||||
@project.team << [@user, :reporter]
|
@project.team << [@user, :reporter]
|
||||||
|
@project.ensure_satellite_exists
|
||||||
end
|
end
|
||||||
|
|
||||||
step 'I have a project forked off of "Shop" called "Forked Shop"' do
|
step 'I have a project forked off of "Shop" called "Forked Shop"' do
|
||||||
@forking_user = @user
|
@forked_project = Projects::ForkService.new(@project, @user).execute
|
||||||
forked_project_link = build(:forked_project_link)
|
|
||||||
@forked_project = Project.find_by(name: "Forked Shop")
|
|
||||||
@forked_project ||= create(:project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace)
|
|
||||||
|
|
||||||
forked_project_link.forked_from_project = @project
|
|
||||||
forked_project_link.forked_to_project = @forked_project
|
|
||||||
@forked_project.team << [@forking_user , :master]
|
|
||||||
forked_project_link.save!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
step 'I click link "New Merge Request"' do
|
step 'I click link "New Merge Request"' do
|
||||||
|
@ -33,8 +26,8 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
|
||||||
current_path.should == project_merge_request_path(@project, @merge_request)
|
current_path.should == project_merge_request_path(@project, @merge_request)
|
||||||
@merge_request.title.should == "Merge Request On Forked Project"
|
@merge_request.title.should == "Merge Request On Forked Project"
|
||||||
@merge_request.source_project.should == @forked_project
|
@merge_request.source_project.should == @forked_project
|
||||||
@merge_request.source_branch.should == "master"
|
@merge_request.source_branch.should == "fix"
|
||||||
@merge_request.target_branch.should == "stable"
|
@merge_request.target_branch.should == "master"
|
||||||
page.should have_content @forked_project.path_with_namespace
|
page.should have_content @forked_project.path_with_namespace
|
||||||
page.should have_content @project.path_with_namespace
|
page.should have_content @project.path_with_namespace
|
||||||
page.should have_content @merge_request.source_branch
|
page.should have_content @merge_request.source_branch
|
||||||
|
@ -42,17 +35,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
|
||||||
end
|
end
|
||||||
|
|
||||||
step 'I fill out a "Merge Request On Forked Project" merge request' do
|
step 'I fill out a "Merge Request On Forked Project" merge request' do
|
||||||
select2 @forked_project.id, from: "#merge_request_source_project_id"
|
select @forked_project.path_with_namespace, from: "merge_request_source_project_id"
|
||||||
select2 @project.id, from: "#merge_request_target_project_id"
|
select @project.path_with_namespace, from: "merge_request_target_project_id"
|
||||||
|
select "fix", from: "merge_request_source_branch"
|
||||||
|
select "master", from: "merge_request_target_branch"
|
||||||
|
|
||||||
find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s
|
|
||||||
find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s
|
|
||||||
|
|
||||||
select2 "master", from: "#merge_request_source_branch"
|
|
||||||
select2 "stable", from: "#merge_request_target_branch"
|
|
||||||
|
|
||||||
find(:select, "merge_request_source_branch", {}).value.should == 'master'
|
|
||||||
find(:select, "merge_request_target_branch", {}).value.should == 'stable'
|
|
||||||
click_button "Compare branches"
|
click_button "Compare branches"
|
||||||
|
|
||||||
fill_in "merge_request_title", with: "Merge Request On Forked Project"
|
fill_in "merge_request_title", with: "Merge Request On Forked Project"
|
||||||
|
@ -101,8 +88,8 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
|
||||||
@merge_request = @project.merge_requests.last
|
@merge_request = @project.merge_requests.last
|
||||||
current_path.should == project_merge_request_path(@project, @merge_request)
|
current_path.should == project_merge_request_path(@project, @merge_request)
|
||||||
@merge_request.source_project.should == @forked_project
|
@merge_request.source_project.should == @forked_project
|
||||||
@merge_request.source_branch.should == "master"
|
@merge_request.source_branch.should == "fix"
|
||||||
@merge_request.target_branch.should == "stable"
|
@merge_request.target_branch.should == "master"
|
||||||
page.should have_content @forked_project.path_with_namespace
|
page.should have_content @forked_project.path_with_namespace
|
||||||
page.should have_content @project.path_with_namespace
|
page.should have_content @project.path_with_namespace
|
||||||
page.should have_content @merge_request.source_branch
|
page.should have_content @merge_request.source_branch
|
||||||
|
@ -114,33 +101,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
|
||||||
page.should have_link "Create Merge Request"
|
page.should have_link "Create Merge Request"
|
||||||
end
|
end
|
||||||
|
|
||||||
step 'project "Forked Shop" has push event' do
|
|
||||||
@forked_project = Project.find_by(name: "Forked Shop")
|
|
||||||
|
|
||||||
data = {
|
|
||||||
before: "0000000000000000000000000000000000000000",
|
|
||||||
after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
|
|
||||||
ref: "refs/heads/new_design",
|
|
||||||
user_id: @user.id,
|
|
||||||
user_name: @user.name,
|
|
||||||
repository: {
|
|
||||||
name: @forked_project.name,
|
|
||||||
url: "localhost/rubinius",
|
|
||||||
description: "",
|
|
||||||
homepage: "localhost/rubinius",
|
|
||||||
private: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@event = Event.create(
|
|
||||||
project: @forked_project,
|
|
||||||
action: Event::PUSHED,
|
|
||||||
data: data,
|
|
||||||
author_id: @user.id
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
step 'I click link edit "Merge Request On Forked Project"' do
|
step 'I click link edit "Merge Request On Forked Project"' do
|
||||||
find("#edit_merge_request").click
|
find("#edit_merge_request").click
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,49 +27,6 @@ FactoryGirl.define do
|
||||||
factory :admin, traits: [:admin]
|
factory :admin, traits: [:admin]
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :empty_project, class: 'Project' do
|
|
||||||
sequence(:name) { |n| "project#{n}" }
|
|
||||||
path { name.downcase.gsub(/\s/, '_') }
|
|
||||||
namespace
|
|
||||||
creator
|
|
||||||
snippets_enabled true
|
|
||||||
|
|
||||||
trait :public do
|
|
||||||
visibility_level Gitlab::VisibilityLevel::PUBLIC
|
|
||||||
end
|
|
||||||
|
|
||||||
trait :internal do
|
|
||||||
visibility_level Gitlab::VisibilityLevel::INTERNAL
|
|
||||||
end
|
|
||||||
|
|
||||||
trait :private do
|
|
||||||
visibility_level Gitlab::VisibilityLevel::PRIVATE
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Generates a test repository from the repository stored under `spec/seed_project.tar.gz`.
|
|
||||||
# Once you run `rake gitlab:setup`, you can see what the repository looks like under `tmp/repositories/gitlabhq`.
|
|
||||||
# In order to modify files in the repository, you must untar the seed, modify and remake the tar.
|
|
||||||
# Before recompressing, do not forget to `git checkout master`.
|
|
||||||
# After recompressing, you need to run `RAILS_ENV=test bundle exec rake gitlab:setup` to regenerate the seeds under tmp.
|
|
||||||
#
|
|
||||||
# If you want to modify the repository only for an specific type of tests, e.g., markdown tests,
|
|
||||||
# consider using a feature branch to reduce the chances of collision with other tests.
|
|
||||||
# Create a new commit, and use the same commit message that you will use for the change in the main repo.
|
|
||||||
# Changing the commig message and SHA of branch `master` may break tests.
|
|
||||||
factory :project, parent: :empty_project do
|
|
||||||
path { 'gitlabhq' }
|
|
||||||
|
|
||||||
after :create do |project|
|
|
||||||
TestEnv.copy_repo(project)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
factory :redmine_project, parent: :project do
|
|
||||||
issues_tracker { "redmine" }
|
|
||||||
issues_tracker_id { "project_name_in_redmine" }
|
|
||||||
end
|
|
||||||
|
|
||||||
factory :group do
|
factory :group do
|
||||||
sequence(:name) { |n| "group#{n}" }
|
sequence(:name) { |n| "group#{n}" }
|
||||||
path { name.downcase.gsub(/\s/, '_') }
|
path { name.downcase.gsub(/\s/, '_') }
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :empty_project, class: 'Project' do
|
||||||
|
sequence(:name) { |n| "project#{n}" }
|
||||||
|
path { name.downcase.gsub(/\s/, '_') }
|
||||||
|
namespace
|
||||||
|
creator
|
||||||
|
snippets_enabled true
|
||||||
|
|
||||||
|
trait :public do
|
||||||
|
visibility_level Gitlab::VisibilityLevel::PUBLIC
|
||||||
|
end
|
||||||
|
|
||||||
|
trait :internal do
|
||||||
|
visibility_level Gitlab::VisibilityLevel::INTERNAL
|
||||||
|
end
|
||||||
|
|
||||||
|
trait :private do
|
||||||
|
visibility_level Gitlab::VisibilityLevel::PRIVATE
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Generates a test repository from the repository stored under `spec/seed_project.tar.gz`.
|
||||||
|
# Once you run `rake gitlab:setup`, you can see what the repository looks like under `tmp/repositories/gitlabhq`.
|
||||||
|
# In order to modify files in the repository, you must untar the seed, modify and remake the tar.
|
||||||
|
# Before recompressing, do not forget to `git checkout master`.
|
||||||
|
# After recompressing, you need to run `RAILS_ENV=test bundle exec rake gitlab:setup` to regenerate the seeds under tmp.
|
||||||
|
#
|
||||||
|
# If you want to modify the repository only for an specific type of tests, e.g., markdown tests,
|
||||||
|
# consider using a feature branch to reduce the chances of collision with other tests.
|
||||||
|
# Create a new commit, and use the same commit message that you will use for the change in the main repo.
|
||||||
|
# Changing the commig message and SHA of branch `master` may break tests.
|
||||||
|
factory :project, parent: :empty_project do
|
||||||
|
path { 'gitlabhq' }
|
||||||
|
|
||||||
|
after :create do |project|
|
||||||
|
TestEnv.copy_repo(project)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
factory :redmine_project, parent: :project do
|
||||||
|
issues_tracker { "redmine" }
|
||||||
|
issues_tracker_id { "project_name_in_redmine" }
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue