From 4c8e66816b792c4301c588c3af0d2f1e1b42ba38 Mon Sep 17 00:00:00 2001 From: George Vinogradov Date: Thu, 15 Dec 2011 01:30:15 +0400 Subject: [PATCH] [issue #37] Changed specs. --- .../build_lists_controller_spec.rb | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/spec/controllers/build_lists_controller_spec.rb b/spec/controllers/build_lists_controller_spec.rb index 4f1b26055..bc7e8bb9b 100644 --- a/spec/controllers/build_lists_controller_spec.rb +++ b/spec/controllers/build_lists_controller_spec.rb @@ -13,8 +13,6 @@ describe BuildListsController do before(:each) do @build_list = Factory(:build_list_core) @project = @build_list.project - @project.visibility = 'hidden' - @project.save @owner_user = @project.owner @member_user = Factory(:user) rel = @project.relations.build(:role => 'reader') @@ -30,32 +28,39 @@ describe BuildListsController do response.should redirect_to(forbidden_url) end - it 'should not be able to perform show action' do - get :show, @show_params - response.should redirect_to(forbidden_url) - end + context 'for open project' do + it_should_behave_like 'show build list' - context 'that is project owner' do - before (:each) do - set_session_for(@owner_user) + context 'if user is project owner' do + before(:each) {set_session_for(@owner_user)} + it_should_behave_like 'show build list' end - it 'should be able to perform show action' do - get :show, @show_params - response.should be_success + context 'if user is project owner' do + before(:each) {set_session_for(@member_user)} + it_should_behave_like 'show build list' end end - context 'that is project member' do - before (:each) do - set_session_for(@member_user) + context 'for hidden project' do + before(:each) do + @project.visibility = 'hidden' + @project.save end - it 'should be able to perform show action' do - get :show, @show_params - response.should be_success + it_should_behave_like 'not show build list' + + context 'if user is project owner' do + before(:each) {set_session_for(@owner_user)} + it_should_behave_like 'show build list' + end + + context 'if user is project owner' do + before(:each) {set_session_for(@member_user)} + it_should_behave_like 'show build list' end end + end context 'for admin' do