Skip to content

Commit 71e19f2

Browse files
committed
Merge pull request coderwall#309 from codebender/bounties/464
Bounties/464 Fix skipped specs
2 parents a93e6ea + b2f00f0 commit 71e19f2

28 files changed

+3928
-339
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ erd.pdf
5454
vagrant.yml
5555
git_stats
5656
*.iml
57-
vcr_cassettes
5857
dump
5958
BACKUP
6059
Guardfile

app/models/badges/early_adopter.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ class EarlyAdopter < BadgeBase
1010
FOUNDING_DATE = Date.parse('Oct 19, 2007')
1111

1212
def reasons
13-
found = user.facts.detect do |fact|
14-
fact.tagged?('github', 'account-created')
15-
end
16-
if found && found.relevant_on <= FOUNDING_DATE + 6.months
17-
"Created an account within GitHub's first 6 months on #{found.relevant_on.to_date.to_s(:long).to_s.capitalize}."
13+
if user.github_profile && user.github_profile.github_created_at <= FOUNDING_DATE + 6.months
14+
"Created an account within GitHub's first 6 months on #{user.github_profile.github_created_at.to_date.to_s(:long).to_s.capitalize}."
1815
else
1916
nil
2017
end
@@ -23,4 +20,4 @@ def reasons
2320
def award?
2421
!reasons.blank?
2522
end
26-
end
23+
end

app/models/github_old.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def initialize(token = nil)
3939
}
4040

4141
def profile(github_username = nil, since=Time.at(0))
42-
(@client.user(github_username) || []).except *%w{followers url public_repos html_url following}
42+
@client.user(github_username) || []
4343
rescue Errno::ECONNREFUSED => e
4444
retry
4545
rescue Octokit::NotFound
@@ -102,9 +102,7 @@ def activities_for(github_username, times=1)
102102
end
103103

104104
def repos_for(github_username, since=Time.at(0))
105-
(@client.repositories(github_username, per_page: 100) || []).map do |repo|
106-
repo.except *%w{master_branch clone_url ssh_url url svn_url forks}
107-
end
105+
@client.repositories(github_username, per_page: 100) || []
108106
rescue Octokit::NotFound => e
109107
Rails.logger.error("Unable to find repos for #{github_username}")
110108
return []
@@ -147,9 +145,7 @@ def repo_watchers(owner, name, since=Time.at(0))
147145
end
148146

149147
def repo_contributors(owner, name, since=Time.at(0))
150-
(@client.contributors("#{owner}/#{name}", false, per_page: 100) || []).map do |user|
151-
user.except *USER_ATTRIBUTES_TO_IGNORE
152-
end
148+
@client.contributors("#{owner}/#{name}", false, per_page: 100) || []
153149
rescue Octokit::NotFound => e
154150
Rails.logger.error("Failed to find contributors for #{owner}/#{name}")
155151
return []

app/models/users/github/profile.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ module Users
2323
module Github
2424
class Profile < ActiveRecord::Base
2525
belongs_to :user
26-
has_many :followers, class_name: 'Users::Github::Profiles::Follower' , foreign_key: :follower_id , dependent: :delete_all
27-
has_many :repositories, :class_name => 'Users::Github::Repository' , foreign_key: :owner_id
26+
has_many :followers, class_name: 'Users::Github::Profiles::Follower',
27+
foreign_key: :follower_id , dependent: :delete_all
28+
has_many :repositories, class_name: 'Users::Github::Repository',
29+
foreign_key: :owner_id
2830
validates :login , presence: true, uniqueness: true
2931
before_validation :copy_login_from_user, on: :create
3032
after_create :extract_data_from_github
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Fabricator(:github_repository, from: 'users/github/repository') do
2+
github_id 123456789
23
end

0 commit comments

Comments
 (0)