Skip to content

Bounties/464 Fix skipped specs #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ erd.pdf
vagrant.yml
git_stats
*.iml
vcr_cassettes
dump
BACKUP
Guardfile
Expand Down
9 changes: 3 additions & 6 deletions app/models/badges/early_adopter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ class EarlyAdopter < BadgeBase
FOUNDING_DATE = Date.parse('Oct 19, 2007')

def reasons
found = user.facts.detect do |fact|
fact.tagged?('github', 'account-created')
end
if found && found.relevant_on <= FOUNDING_DATE + 6.months
"Created an account within GitHub's first 6 months on #{found.relevant_on.to_date.to_s(:long).to_s.capitalize}."
if user.github_profile && user.github_profile.github_created_at <= FOUNDING_DATE + 6.months
"Created an account within GitHub's first 6 months on #{user.github_profile.github_created_at.to_date.to_s(:long).to_s.capitalize}."
else
nil
end
Expand All @@ -23,4 +20,4 @@ def reasons
def award?
!reasons.blank?
end
end
end
10 changes: 3 additions & 7 deletions app/models/github_old.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def initialize(token = nil)
}

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

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

def repo_contributors(owner, name, since=Time.at(0))
(@client.contributors("#{owner}/#{name}", false, per_page: 100) || []).map do |user|
user.except *USER_ATTRIBUTES_TO_IGNORE
end
@client.contributors("#{owner}/#{name}", false, per_page: 100) || []
rescue Octokit::NotFound => e
Rails.logger.error("Failed to find contributors for #{owner}/#{name}")
return []
Expand Down
6 changes: 4 additions & 2 deletions app/models/users/github/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ module Users
module Github
class Profile < ActiveRecord::Base
belongs_to :user
has_many :followers, class_name: 'Users::Github::Profiles::Follower' , foreign_key: :follower_id , dependent: :delete_all
has_many :repositories, :class_name => 'Users::Github::Repository' , foreign_key: :owner_id
has_many :followers, class_name: 'Users::Github::Profiles::Follower',
foreign_key: :follower_id , dependent: :delete_all
has_many :repositories, class_name: 'Users::Github::Repository',
foreign_key: :owner_id
validates :login , presence: true, uniqueness: true
before_validation :copy_login_from_user, on: :create
after_create :extract_data_from_github
Expand Down
1 change: 1 addition & 0 deletions spec/fabricators/users_github_repository_fabricator.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Fabricator(:github_repository, from: 'users/github/repository') do
github_id 123456789
end
Loading