2011-11-28 08:39:43 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "MergeRequests" do
|
2011-11-28 19:42:32 +01:00
|
|
|
let(:project) { Factory :project }
|
|
|
|
|
|
|
|
before do
|
|
|
|
login_as :user
|
|
|
|
project.add_access(@user, :read, :write)
|
|
|
|
@merge_request = Factory :merge_request,
|
|
|
|
:author => @user,
|
|
|
|
:assignee => @user,
|
|
|
|
:project => project
|
|
|
|
end
|
|
|
|
|
2011-11-28 08:39:43 +01:00
|
|
|
describe "GET /merge_requests" do
|
2011-11-28 19:42:32 +01:00
|
|
|
before do
|
|
|
|
visit project_merge_requests_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { page }
|
|
|
|
|
|
|
|
it { should have_content(@merge_request.title) }
|
|
|
|
it { should have_content(@merge_request.target_branch) }
|
|
|
|
it { should have_content(@merge_request.source_branch) }
|
|
|
|
it { should have_content(@merge_request.assignee.name) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /merge_request/:id" do
|
|
|
|
before do
|
|
|
|
visit project_merge_request_path(project, @merge_request)
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { page }
|
|
|
|
|
|
|
|
it { should have_content(@merge_request.title) }
|
|
|
|
it { should have_content(@merge_request.target_branch) }
|
|
|
|
it { should have_content(@merge_request.source_branch) }
|
|
|
|
it { should have_content(@merge_request.assignee.name) }
|
|
|
|
|
|
|
|
describe "Close merge request" do
|
|
|
|
before { click_link "Close" }
|
|
|
|
|
|
|
|
it { should have_content(@merge_request.title) }
|
|
|
|
it "Show page should inform user that merge request closed" do
|
|
|
|
within ".merge-request-show-holder h3" do
|
|
|
|
page.should have_content "Closed"
|
|
|
|
end
|
|
|
|
end
|
2011-11-28 08:39:43 +01:00
|
|
|
end
|
|
|
|
end
|
2011-11-28 19:50:25 +01:00
|
|
|
|
|
|
|
describe "GET /merge_requests/new" do
|
2011-12-08 01:07:02 +01:00
|
|
|
before do
|
2011-11-28 19:50:25 +01:00
|
|
|
visit new_project_merge_request_path(project)
|
|
|
|
fill_in "merge_request_title", :with => "Merge Request Title"
|
|
|
|
select "master", :from => "merge_request_source_branch"
|
|
|
|
select "master", :from => "merge_request_target_branch"
|
|
|
|
select @user.name, :from => "merge_request_assignee_id"
|
|
|
|
click_button "Save"
|
|
|
|
end
|
|
|
|
|
|
|
|
it { current_path.should == project_merge_request_path(project, project.merge_requests.last) }
|
|
|
|
|
|
|
|
it "should create merge request" do
|
|
|
|
page.should have_content "Open"
|
|
|
|
page.should have_content @user.name
|
|
|
|
end
|
|
|
|
end
|
2011-11-28 08:39:43 +01:00
|
|
|
end
|