From 5049beca521db84140053f400cf6539d1b1d18dc Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Fri, 10 Aug 2012 01:14:16 +0200 Subject: [PATCH] fix some specs on ruby, but also normalize the output of a method for mri --- lib/travis/model/repository.rb | 2 +- spec/travis/model/repository_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/travis/model/repository.rb b/lib/travis/model/repository.rb index 1664f0e23..dcd79fa17 100644 --- a/lib/travis/model/repository.rb +++ b/lib/travis/model/repository.rb @@ -85,7 +85,7 @@ def counts_by_owner_names(owner_names) query = %(SELECT owner_name, count(*) FROM repositories WHERE owner_name IN (?) GROUP BY owner_name) query = sanitize_sql([query, owner_names]) rows = connection.select_all(query, owner_names) - Hash[*rows.map { |row| row.values }.flatten] + Hash[*rows.map { |row| [row['owner_name'], row['count'].to_i] }.flatten] end end diff --git a/spec/travis/model/repository_spec.rb b/spec/travis/model/repository_spec.rb index 8e38cfcd2..238812ef6 100644 --- a/spec/travis/model/repository_spec.rb +++ b/spec/travis/model/repository_spec.rb @@ -104,7 +104,7 @@ it 'returns repository counts per owner_name for the given owner_names' do counts = Repository.counts_by_owner_names(%w(svenfuchs travis-ci)) - counts.should == { 'svenfuchs' => '1', 'travis-ci' => '1' } + counts.should == { 'svenfuchs' => 1, 'travis-ci' => 1 } end end end