#894: update ability.rb, add new specs
This commit is contained in:
parent
0f4e8c1939
commit
e4924993a7
|
@ -153,6 +153,8 @@ class Ability
|
||||||
cannot [:create, :update, :destroy, :clone], Product, :platform => {:platform_type => 'personal'}
|
cannot [:create, :update, :destroy, :clone], Product, :platform => {:platform_type => 'personal'}
|
||||||
cannot [:clone], Platform, :platform_type => 'personal'
|
cannot [:clone], Platform, :platform_type => 'personal'
|
||||||
|
|
||||||
|
cannot :publish, BuildList, :new_core => false
|
||||||
|
|
||||||
cannot([:get_list, :create], MassBuild) {|mass_build| mass_build.platform.personal?}
|
cannot([:get_list, :create], MassBuild) {|mass_build| mass_build.platform.personal?}
|
||||||
cannot(:cancel, MassBuild) {|mass_build| mass_build.platform.personal? || mass_build.stop_build}
|
cannot(:cancel, MassBuild) {|mass_build| mass_build.platform.personal? || mass_build.stop_build}
|
||||||
|
|
||||||
|
|
|
@ -298,8 +298,22 @@ describe Api::V1::BuildListsController do
|
||||||
@build_list.reload.status.should == BuildList::PROJECT_VERSION_NOT_FOUND
|
@build_list.reload.status.should == BuildList::PROJECT_VERSION_NOT_FOUND
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "if it has been builded on old core" do
|
||||||
|
before do
|
||||||
|
@build_list.update_column(:status, BuildList::FAILED_PUBLISH)
|
||||||
|
@build_list.update_column(:new_core, false)
|
||||||
|
do_publish
|
||||||
|
end
|
||||||
|
it "should return access violation message" do
|
||||||
|
response.body.should == {"message" => "Access violation to this page!"}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should not cancel build list" do
|
||||||
|
@build_list.reload.status.should == BuildList::FAILED_PUBLISH
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'if user is not project owner' do
|
context 'if user is not project owner' do
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue