gitlabhq/spec/requests/merge_requests_spec.rb

68 lines
1.9 KiB
Ruby
Raw Normal View History

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 }
2011-12-15 23:00:28 +01:00
it { should have_content(@merge_request.title[0..10]) }
2011-11-28 19:42:32 +01:00
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 }
2011-12-15 23:00:28 +01:00
it { should have_content(@merge_request.title[0..10]) }
2011-11-28 19:42:32 +01:00
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" }
2011-12-15 23:00:28 +01:00
it { should have_content(@merge_request.title[0..10]) }
2011-11-28 19:42:32 +01:00
it "Show page should inform user that merge request closed" do
2012-01-29 23:43:14 +01:00
page.should have_content "Reopen"
2011-11-28 19:42:32 +01:00
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
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
2011-12-13 22:24:31 +01:00
page.should have_content "Close"
2011-11-28 19:50:25 +01:00
page.should have_content @user.name
end
end
2011-11-28 08:39:43 +01:00
end