Commit cbe4891d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix form mr tests

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 2a6fc1c5
......@@ -4,7 +4,6 @@ Feature: Project Forked Merge Requests
And I am a member of project "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
Given I visit project "Forked Shop" merge requests page
And I click link "New Merge Request"
......
......@@ -9,18 +9,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
@project = Project.find_by(name: "Shop")
@project ||= create(:project, name: "Shop")
@project.team << [@user, :reporter]
@project.ensure_satellite_exists
end
step 'I have a project forked off of "Shop" called "Forked Shop"' do
@forking_user = @user
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!
@forked_project = Projects::ForkService.new(@project, @user).execute
end
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)
@merge_request.title.should == "Merge Request On Forked Project"
@merge_request.source_project.should == @forked_project
@merge_request.source_branch.should == "master"
@merge_request.target_branch.should == "stable"
@merge_request.source_branch.should == "fix"
@merge_request.target_branch.should == "master"
page.should have_content @forked_project.path_with_namespace
page.should have_content @project.path_with_namespace
page.should have_content @merge_request.source_branch
......@@ -42,17 +35,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
end
step 'I fill out a "Merge Request On Forked Project" merge request' do
select2 @forked_project.id, from: "#merge_request_source_project_id"
select2 @project.id, from: "#merge_request_target_project_id"
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"
select @forked_project.path_with_namespace, from: "merge_request_source_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_branch", {}).value.should == 'master'
find(:select, "merge_request_target_branch", {}).value.should == 'stable'
click_button "Compare branches"
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
current_path.should == project_merge_request_path(@project, @merge_request)
@merge_request.source_project.should == @forked_project
@merge_request.source_branch.should == "master"
@merge_request.target_branch.should == "stable"
@merge_request.source_branch.should == "fix"
@merge_request.target_branch.should == "master"
page.should have_content @forked_project.path_with_namespace
page.should have_content @project.path_with_namespace
page.should have_content @merge_request.source_branch
......@@ -114,33 +101,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
page.should have_link "Create Merge Request"
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
find("#edit_merge_request").click
end
......
......@@ -27,49 +27,6 @@ FactoryGirl.define do
factory :admin, traits: [:admin]
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
sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') }
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment