Skip to content

Commit

Permalink
Merge pull request #6392 from coolo/followup_6370
Browse files Browse the repository at this point in the history
Don't start repository architectures with position 1
  • Loading branch information
ChrisBr committed Nov 29, 2018
2 parents 7db5faa + 03f78a2 commit fa30255
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/app/models/project/update_from_xml_command.rb
Expand Up @@ -294,7 +294,7 @@ def update_repository_architectures(current_repo, xml_hash)
check_for_duplicated_archs!(xml_archs)

architectures = []
xml_archs.each.with_index(1) do |archname, position|
xml_archs.each_with_index do |archname, position|
architecture = Architecture.from_cache!(archname)
current_repo.repository_architectures.find_or_create_by(architecture: architecture).insert_at(position)
architectures << architecture
Expand Down
5 changes: 2 additions & 3 deletions src/api/spec/models/project/update_from_xml_command_spec.rb
Expand Up @@ -161,9 +161,8 @@
)
Project::UpdateFromXmlCommand.new(project).send(:update_repositories, xml_hash, false)

expect(repository_1.architectures.map(&:name).sort).to eq(['i586', 'x86_64'])
expect(repository_1.repository_architectures.where(position: 1).first.architecture.name).to eq('x86_64')
expect(repository_1.repository_architectures.where(position: 2).first.architecture.name).to eq('i586')
expect(repository_1.architectures.map(&:name)).to eq(['x86_64', 'i586'])
expect(repository_1.repository_architectures.map { |repoarch| repoarch.architecture.name }).to eq(['x86_64', 'i586'])
end

it 'should raise an error for unkown architectures' do
Expand Down

0 comments on commit fa30255

Please sign in to comment.