Sha256: 2b9cf5e53071a38309af8a7cba8c25425eb47af30ad32cac5fbb2a849c9240ac
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
require 'ostruct' require './lib/pairing_matrix/commit_readers/github_commit_reader' describe PairingMatrix::GithubCommitReader do context '#authors_with_commits' do it 'returns authors with number of commits' do config_reader = PairingMatrix::ConfigReader.new('./spec/lib/pairing_matrix/config/sample_configurations/github_repositories.yml') configuration = config_reader.config github_config = configuration.github days = 10 reader = PairingMatrix::GithubCommitReader.new(github_config) github_client = double(:github_client) expect(Octokit::Client).to receive(:new) .with(access_token: github_config.access_token) .and_return(github_client) commits = [ OpenStruct.new(commit: OpenStruct.new(message: "[Author1/Author2] commit 1")), OpenStruct.new(commit: OpenStruct.new(message: "[Author1/Author2] commit 2")), OpenStruct.new(commit: OpenStruct.new(message: "[Author2/Author3] commit 3")), OpenStruct.new(commit: OpenStruct.new(message: "[Author2/Author3] commit 4")), OpenStruct.new(commit: OpenStruct.new(message: "[Author4/Author1] commit 5")), ] expect(github_client).to receive(:commits_since) .with(github_config.repositories.first, (Date.today - days).to_s) .and_return(commits) expect(github_client).to receive(:commits_since) .with(github_config.repositories.last, (Date.today - days).to_s) .and_return(commits) result = reader.authors_with_commits(10) expect(result).to eql([["Author1", "Author2", 4], ["Author2", "Author3", 4], ["Author1", "Author4", 2]]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pairing_matrix-3.0.0 | spec/lib/pairing_matrix/commit_readers/github_commit_reader_spec.rb |