Commit 60c6649a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

tests for merge request index/show

parent 6b941cf9
......@@ -34,6 +34,12 @@ Factory.add(:issue, Issue) do |obj|
obj.title = Faker::Lorem.sentence
end
Factory.add(:merge_request, MergeRequest) do |obj|
obj.title = Faker::Lorem.sentence
obj.source_branch = "master"
obj.target_branch = "master"
end
Factory.add(:snippet, Snippet) do |obj|
obj.title = Faker::Lorem.sentence
obj.file_name = Faker::Lorem.sentence
......
require 'spec_helper'
describe "MergeRequests" do
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
describe "GET /merge_requests" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get merge_requests_path
response.status.should be(200)
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
end
end
end
......@@ -122,5 +122,14 @@ describe "Projects" do
it { project_snippets_path(@project).should be_denied_for :user }
it { project_snippets_path(@project).should be_denied_for :visitor }
end
describe "GET /project_code/merge_requests" do
it { project_merge_requests_path(@project).should be_allowed_for @u1 }
it { project_merge_requests_path(@project).should be_allowed_for @u3 }
it { project_merge_requests_path(@project).should be_denied_for :admin }
it { project_merge_requests_path(@project).should be_denied_for @u2 }
it { project_merge_requests_path(@project).should be_denied_for :user }
it { project_merge_requests_path(@project).should be_denied_for :visitor }
end
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