Skip to content
Snippets Groups Projects
Commit bc5fce44 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

ProjectController specs

parent b832d685
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -90,6 +90,8 @@ class ProjectsController < ApplicationController
else
head 500
end
rescue
head 500
end
 
# Project status badge
Loading
Loading
require "spec_helper"
describe ProjectsController do
before do
@project = FactoryGirl.create :project
end
describe "POST #build" do
it 'should respond 200 if params is ok' do
post :build, id: @project.id,
ref: 'master',
before: '2aa371379db71ac89ae20843fcff3b3477cf1a1d',
after: '1c8a9df454ef68c22c2a33cca8232bb50849e5c5',
token: @project.token
expect(response).to be_success
expect(response.code).to eq('200')
end
it 'should respond 200 if push about removed branch' do
post :build, id: @project.id,
ref: 'master',
before: '2aa371379db71ac89ae20843fcff3b3477cf1a1d',
after: '000000000000000000000000000000000000000',
token: @project.token
expect(response).to be_success
expect(response.code).to eq('200')
end
it 'should respond 500 if something wrong' do
post :build, id: @project.id, token: @project.token
expect(response).not_to be_success
expect(response.code).to eq('500')
end
it 'should respond 403 if token is wrong' do
post :build, id: @project.id, token: 'invalid-token'
expect(response).not_to be_success
expect(response.code).to eq('403')
end
end
end
Loading
Loading
@@ -50,5 +50,13 @@ describe "Projects" do
it { page.should have_content @project.name }
it { page.should have_content 'Integration with GitLab and other services' }
end
end
 
describe "GET /projects/:id/run" do
before do
visit run_project_path(@project, ref: 'master')
end
it { current_path.should == project_build_path(@project, @project.builds.last) }
it { page.should have_content @project.builds.last.git_commit_message }
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment