#1: fix for specs, update ability.rb
This commit is contained in:
parent
8d694f73d6
commit
98891a9153
|
@ -38,7 +38,7 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController
|
|||
|
||||
def find_and_authorize_build_list
|
||||
@build_list = BuildList.find params[:build_list_id]
|
||||
authorize! :update, @build_list.save_to_platform
|
||||
authorize! :update_advisory, @build_list.save_to_platform
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -96,7 +96,7 @@ class Ability
|
|||
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user.group_ids
|
||||
can([:read, :related, :members], Platform, read_relations_for('platforms')) {|platform| local_reader? platform}
|
||||
can([:update, :destroy], Platform) {|platform| owner?(platform) }
|
||||
can([:members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner?(platform) || local_admin?(platform) }
|
||||
can([:update_advisory, :members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner?(platform) || local_admin?(platform) }
|
||||
|
||||
can([:get_list, :create], MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && mass_build.platform.main?}
|
||||
can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && !mass_build.stop_build && mass_build.platform.main?}
|
||||
|
|
|
@ -35,6 +35,7 @@ class ProductBuildList < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
|
||||
|
||||
# before_validation lambda { self.arch_id = Arch.find_by_name('x86_64').id }
|
||||
validates :product_id,
|
||||
:status,
|
||||
:project_id,
|
||||
|
|
|
@ -158,7 +158,7 @@ describe Api::V1::BuildListsController do
|
|||
|
||||
it_should_behave_like 'validation error via build list api', I18n.t('layout.build_lists.cancel_fail')
|
||||
|
||||
it "should not cancel build list" do
|
||||
it "should not change status of build list" do
|
||||
@build_list.reload.status.should == BuildList::PROJECT_VERSION_NOT_FOUND
|
||||
end
|
||||
end
|
||||
|
@ -174,7 +174,7 @@ describe Api::V1::BuildListsController do
|
|||
response.body.should == {"message" => "Access violation to this page!"}.to_json
|
||||
end
|
||||
|
||||
it "should not cancel build list" do
|
||||
it "should not change status of build list" do
|
||||
@build_list.reload.status.should == BuildList::BUILD_PENDING
|
||||
end
|
||||
end
|
||||
|
@ -262,7 +262,7 @@ describe Api::V1::BuildListsController do
|
|||
response.should be_success
|
||||
end
|
||||
|
||||
it "should cancel build list" do
|
||||
it "should change status of build list" do
|
||||
@build_list.reload.status.should == BuildList::BUILD_PUBLISH
|
||||
end
|
||||
end
|
||||
|
@ -292,9 +292,11 @@ describe Api::V1::BuildListsController do
|
|||
do_publish
|
||||
end
|
||||
|
||||
it_should_behave_like 'validation error via build list api', I18n.t('layout.build_lists.publish_fail')
|
||||
it "should return access violation message" do
|
||||
response.body.should == {"message" => "Access violation to this page!"}.to_json
|
||||
end
|
||||
|
||||
it "should not cancel build list" do
|
||||
it "should not change status of build list" do
|
||||
@build_list.reload.status.should == BuildList::PROJECT_VERSION_NOT_FOUND
|
||||
end
|
||||
end
|
||||
|
@ -309,7 +311,7 @@ describe Api::V1::BuildListsController do
|
|||
response.body.should == {"message" => "Access violation to this page!"}.to_json
|
||||
end
|
||||
|
||||
it "should not cancel build list" do
|
||||
it "should not change status of build list" do
|
||||
@build_list.reload.status.should == BuildList::FAILED_PUBLISH
|
||||
end
|
||||
end
|
||||
|
@ -345,7 +347,7 @@ describe Api::V1::BuildListsController do
|
|||
response.body.should == {"message" => "Access violation to this page!"}.to_json
|
||||
end
|
||||
|
||||
it "should not cancel build list" do
|
||||
it "should not change status of build list" do
|
||||
@build_list.reload.status.should == BuildList::FAILED_PUBLISH
|
||||
end
|
||||
end
|
||||
|
@ -392,7 +394,7 @@ describe Api::V1::BuildListsController do
|
|||
|
||||
it_should_behave_like 'validation error via build list api', I18n.t('layout.build_lists.reject_publish_fail')
|
||||
|
||||
it "should not cancel build list" do
|
||||
it "should not change status of build list" do
|
||||
@build_list.reload.status.should == BuildList::PROJECT_VERSION_NOT_FOUND
|
||||
end
|
||||
end
|
||||
|
@ -409,7 +411,7 @@ describe Api::V1::BuildListsController do
|
|||
response.body.should == {"message" => "Access violation to this page!"}.to_json
|
||||
end
|
||||
|
||||
it "should not cancel build list" do
|
||||
it "should not change status of build list" do
|
||||
do_reject_publish
|
||||
@build_list.reload.status.should == BuildList::SUCCESS
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue