-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
7,227 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,26 @@ | |||
RSpec.describe AddNewCommits do | |||
let(:contributor_repo) { ContributorRepository.new } | |||
let(:commit_repo) { CommitRepository.new } | |||
let(:project_repo) { ProjectRepository.new } | |||
|
|||
let!(:contributor) { contributor_repo.create(github: 'artofhuman') } | |||
let!(:project) { project_repo.create(name: 'hanami') } | |||
|
|||
after do | |||
commit_repo.clear | |||
contributor_repo.clear | |||
end | |||
|
|||
it 'adds contributor commits to the repo' do | |||
VCR.use_cassette("commits") do | |||
described_class.new.call | |||
|
|||
commits = commit_repo.all_for_contributor(contributor.id) | |||
|
|||
expect(commits).not_to be_empty | |||
expect(commits.first.url).to be | |||
expect(commits.first.title).to be | |||
expect(commits.first.project_id).to eq(project.id) | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
RSpec.describe AddNewContributors do | |||
let(:contributors_repo) { ContributorRepository.new } | |||
let(:project_repo) { ProjectRepository.new} | |||
|
|||
before do | |||
project_repo.create(name: 'contributors') | |||
end | |||
|
|||
after do | |||
project_repo.clear | |||
contributors_repo.clear | |||
end | |||
|
|||
it 'adds new contributors to repo' do | |||
VCR.use_cassette("contributors") do | |||
described_class.new.call | |||
end | |||
|
|||
expect(contributors_repo.find_by_github('jodosha')).to be | |||
expect(contributors_repo.find_by_github('davydovanton')).to be | |||
end | |||
|
|||
context 'when contributor already in repo' do | |||
before do | |||
contributors_repo.create(github: 'davydovanton') | |||
end | |||
|
|||
it 'does not adds' do | |||
VCR.use_cassette("contributors") do | |||
expect { described_class.new.call } | |||
.not_to change { contributors_repo.contributors.where(github: 'davydovanton').count } | |||
end | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,26 @@ | |||
RSpec.describe AllCommits do | |||
let(:repo) { ProjectRepository.new } | |||
let(:contributor) { Contributor.new(id: 1, github: 'artofhuman') } | |||
|
|||
let!(:project) { repo.create(name: 'hanami') } | |||
|
|||
after do | |||
repo.clear | |||
end | |||
|
|||
it 'returns contributor commits' do | |||
VCR.use_cassette("commits") do | |||
result = AllCommits.new.call(contributor) | |||
|
|||
expect(result).not_to be_empty | |||
|
|||
commit = result.first | |||
|
|||
expect(commit[:contributor_id]).to eq(contributor.id) | |||
expect(commit[:project_id]).to eq(project.id) | |||
expect(commit[:created_at]).to be_a(Time) | |||
expect(commit[:sha]).to be | |||
expect(commit[:url]).to be | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
RSpec.describe AllContributors do | |||
let(:repo) { ProjectRepository.new } | |||
|
|||
before do | |||
repo.create(name: 'contributors') | |||
repo.create(name: 'utils') | |||
end | |||
|
|||
after do | |||
repo.clear | |||
end | |||
|
|||
it 'returns array of contributors' do | |||
VCR.use_cassette("contributors") do | |||
result = described_class.new.call | |||
|
|||
contributors = result.select { |i| %w(davydovanton jodosha).include?(i[:github]) } | |||
|
|||
expect(contributors.size).to eq(2) | |||
contributors.each do |h| | |||
expect(h[:avatar_url]).to be | |||
end | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters