Skip to content

Commit

Permalink
[api] Make jobhistory_list a class method
Browse files Browse the repository at this point in the history
Because we are not using the instance attributes.
  • Loading branch information
Ana06 committed Sep 5, 2018
1 parent cb99952 commit bbb4a44
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -7,7 +7,7 @@ class JobHistoryController < WebuiController
before_action :set_architecture

def index
@jobshistory = @package.jobhistory_list(@project.name, @repository.name, @architecture.name, @package_name)
@jobshistory = Package.jobhistory_list(@project.name, @repository.name, @architecture.name, @package_name)
end

private
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/package.rb
Expand Up @@ -914,7 +914,7 @@ def buildresult(prj = project, show_all = false)
LocalBuildResult::ForPackage.new(package: self, project: prj, show_all: show_all)
end

def jobhistory_list(project_name, repository_name, arch_name, package_name)
def self.jobhistory_list(project_name, repository_name, arch_name, package_name)
begin
results = Xmlhash.parse(Backend::Api::BuildResults::JobHistory.all_for_package(project_name, package_name, repository_name, arch_name))
rescue Backend::Error
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/models/package_spec.rb
Expand Up @@ -433,11 +433,11 @@
end
end

describe '#jobhistory_list' do
describe '.jobhistory_list' do
let(:backend_url) { "#{CONFIG['source_url']}/build/#{home_project}/openSUSE_Tumbleweed/x86_64/_jobhistory?limit=100&package=#{package}" }

# the package name is needed because it could be a multibuild
subject { package.jobhistory_list(home_project, 'openSUSE_Tumbleweed', 'x86_64', package.name) }
subject { Package.jobhistory_list(home_project, 'openSUSE_Tumbleweed', 'x86_64', package.name) }

context 'when response is successful' do
let(:local_job_history) do
Expand Down

0 comments on commit bbb4a44

Please sign in to comment.