[#369] fix specs
This commit is contained in:
parent
79dbe762e5
commit
bfeb3c218b
|
@ -13,7 +13,7 @@ shared_context "comments controller" do
|
|||
|
||||
set_session_for(@user)
|
||||
|
||||
@path = { name_with_owner: @project.name_with_owner, issue_id: @issue.serial_id }
|
||||
@path = { name_with_owner: @project.name_with_owner, issue_id: @issue.serial_id, format: :json }
|
||||
@return_path = project_issue_path(@project, @issue)
|
||||
@create_params = { comment: { body: 'I am a comment!' }}.merge(@path)
|
||||
@update_params = { comment: { body: 'updated' }}.merge(@path)
|
||||
|
|
|
@ -26,7 +26,7 @@ shared_context "issues controller" do
|
|||
}
|
||||
}
|
||||
|
||||
@update_params = { name_with_owner: @project.name_with_owner, issue: { title: "issue2" }}
|
||||
@update_params = { name_with_owner: @project.name_with_owner, issue: { title: "issue2" }, format: :json }
|
||||
|
||||
@pull = @project.pull_requests.new issue_attributes: { title: 'test', body: 'testing' }
|
||||
@pull.issue.user, @pull.issue.project = @project.owner, @pull.to_project
|
||||
|
@ -106,7 +106,7 @@ end
|
|||
shared_examples_for 'user without issue update rights' do
|
||||
it 'should not be able to perform update action' do
|
||||
put :update, {id: @issue.serial_id}.merge(@update_params)
|
||||
response.should redirect_to(controller.current_user ? forbidden_path : new_user_session_path)
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
|
||||
it 'should not update issue title' do
|
||||
|
@ -291,7 +291,17 @@ describe Projects::IssuesController do
|
|||
lambda{ post :create, @create_params }.should_not change{ Issue.count }
|
||||
end
|
||||
|
||||
it_should_behave_like 'user without issue update rights'
|
||||
#it_should_behave_like 'user without issue update rights'
|
||||
it 'should not be able to perform update action' do
|
||||
put :update, {id: @issue.serial_id}.merge(@update_params)
|
||||
response.status.should == 401
|
||||
end
|
||||
|
||||
it 'should not update issue title' do
|
||||
put :update, {id: @issue.serial_id}.merge(@update_params)
|
||||
@issue.reload.title.should_not == 'issue2'
|
||||
end
|
||||
|
||||
# it_should_behave_like 'user without issue destroy rights'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,11 +35,6 @@ shared_context "pull request controller" do
|
|||
end
|
||||
|
||||
shared_examples_for 'pull request user with project guest rights' do
|
||||
it 'should be able to perform index action' do
|
||||
get :index, name_with_owner: @project.name_with_owner
|
||||
response.should render_template(:index)
|
||||
end
|
||||
|
||||
it 'should be able to perform show action when pull request has been created' do
|
||||
@pull.check
|
||||
get :show, name_with_owner: @project.name_with_owner, id: @pull.serial_id
|
||||
|
@ -48,12 +43,6 @@ shared_examples_for 'pull request user with project guest rights' do
|
|||
end
|
||||
|
||||
shared_examples_for 'pull request user with project reader rights' do
|
||||
it 'should be able to perform index action on hidden project' do
|
||||
@project.update_attributes(visibility: 'hidden')
|
||||
get :index, name_with_owner: @project.name_with_owner
|
||||
response.should render_template(:index)
|
||||
end
|
||||
|
||||
it 'should be able to perform create action' do
|
||||
post :create, @create_params
|
||||
response.should redirect_to(project_pull_request_path(@project, @project.pull_requests.last))
|
||||
|
@ -163,10 +152,6 @@ end
|
|||
|
||||
shared_examples_for 'pull request when project with issues turned off' do
|
||||
before { @project.update_attributes(has_issues: false) }
|
||||
it 'should be able to perform index action' do
|
||||
get :index, name_with_owner: @project.name_with_owner
|
||||
response.should render_template(:index)
|
||||
end
|
||||
|
||||
it 'should be able to perform show action when pull request has been created' do
|
||||
@pull.check
|
||||
|
@ -268,22 +253,11 @@ describe Projects::PullRequestsController do
|
|||
it_should_behave_like 'pull request when project with issues turned off'
|
||||
|
||||
else
|
||||
it 'should not be able to perform index action' do
|
||||
get :index, name_with_owner: @project.name_with_owner
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
|
||||
it 'should not be able to perform show action' do
|
||||
@pull.check
|
||||
get :show, name_with_owner: @project.name_with_owner, id: @pull.serial_id
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
|
||||
it 'should not be able to perform index action on hidden project' do
|
||||
@project.update_attributes(visibility: 'hidden')
|
||||
get :index, name_with_owner: @project.name_with_owner
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
it 'should not be able to perform create action' do
|
||||
|
|
|
@ -38,7 +38,7 @@ end
|
|||
shared_examples_for 'user with create comment ability' do
|
||||
it 'should be able to perform create action' do
|
||||
post :create, @create_params
|
||||
response.should redirect_to(@return_path+"#comment#{Comment.last.id}")
|
||||
response.should be_success #redirect_to(@return_path+"#comment#{Comment.last.id}")
|
||||
end
|
||||
|
||||
it 'should create comment in the database' do
|
||||
|
@ -81,7 +81,7 @@ end
|
|||
shared_examples_for 'user with destroy comment ability' do
|
||||
it 'should be able to perform destroy action' do
|
||||
delete :destroy, {id: @comment.id}.merge(@path)
|
||||
response.should redirect_to(@return_path)
|
||||
response.should be_success #redirect_to(@return_path)
|
||||
end
|
||||
|
||||
it 'should delete comment from database' do
|
||||
|
|
Loading…
Reference in New Issue