fix feature flag for_branch endpoint
This commit is contained in:
parent
69df412aa1
commit
9734e7133f
|
@ -2,7 +2,9 @@ module Travis::API::V3
|
|||
class Services::Cron::ForBranch < Service
|
||||
|
||||
def run!
|
||||
query.find_for_branch(find(:branch, find(:repository)))
|
||||
repo = find(:repository)
|
||||
raise InsufficientAccess unless Travis::Features.owner_active?(:cron, repo.owner)
|
||||
query.find_for_branch(find(:branch, repo))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,13 +11,13 @@ describe Travis::API::V3::Services::Cron::ForBranch do
|
|||
end
|
||||
|
||||
describe "find cron job for branch with feature disabled" do
|
||||
before { cron }
|
||||
before { Travis::Features.deactivate_owner(:cron, repo.owner) }
|
||||
before { get("/v3/repo/#{repo.id}/branch/#{branch.name}/cron") }
|
||||
example { expect(parsed_body).to be == {
|
||||
"@type" => "error",
|
||||
"error_type" => "not_found",
|
||||
"error_message" => "cron not found (or insufficient access)",
|
||||
"resource_type" => "cron"
|
||||
"error_type" => "insufficient_access",
|
||||
"error_message" => "forbidden"
|
||||
}}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user