[issue #37] Changed specs.
This commit is contained in:
parent
98bbc2e6e6
commit
4c8e66816b
|
@ -13,8 +13,6 @@ describe BuildListsController do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@build_list = Factory(:build_list_core)
|
@build_list = Factory(:build_list_core)
|
||||||
@project = @build_list.project
|
@project = @build_list.project
|
||||||
@project.visibility = 'hidden'
|
|
||||||
@project.save
|
|
||||||
@owner_user = @project.owner
|
@owner_user = @project.owner
|
||||||
@member_user = Factory(:user)
|
@member_user = Factory(:user)
|
||||||
rel = @project.relations.build(:role => 'reader')
|
rel = @project.relations.build(:role => 'reader')
|
||||||
|
@ -30,32 +28,39 @@ describe BuildListsController do
|
||||||
response.should redirect_to(forbidden_url)
|
response.should redirect_to(forbidden_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not be able to perform show action' do
|
context 'for open project' do
|
||||||
get :show, @show_params
|
it_should_behave_like 'show build list'
|
||||||
response.should redirect_to(forbidden_url)
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'that is project owner' do
|
context 'if user is project owner' do
|
||||||
before (:each) do
|
before(:each) {set_session_for(@owner_user)}
|
||||||
set_session_for(@owner_user)
|
it_should_behave_like 'show build list'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to perform show action' do
|
context 'if user is project owner' do
|
||||||
get :show, @show_params
|
before(:each) {set_session_for(@member_user)}
|
||||||
response.should be_success
|
it_should_behave_like 'show build list'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'that is project member' do
|
context 'for hidden project' do
|
||||||
before (:each) do
|
before(:each) do
|
||||||
set_session_for(@member_user)
|
@project.visibility = 'hidden'
|
||||||
|
@project.save
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to perform show action' do
|
it_should_behave_like 'not show build list'
|
||||||
get :show, @show_params
|
|
||||||
response.should be_success
|
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
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for admin' do
|
context 'for admin' do
|
||||||
|
|
Loading…
Reference in New Issue