Skip to content

Commit

Permalink
Fix parsing of author in payload send by GitHub
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Rozet <simon@rozet.name>

[integrity#81 state:resolved]
  • Loading branch information
copiousfreetime authored and sr committed Feb 14, 2009
1 parent bdd65de commit e08195a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/integrity/project.rb
Expand Up @@ -119,7 +119,7 @@ def head_of_remote_repo

def create_commit_from(data)
commits.create(:identifier => data["id"],
:author => data["author"],
:author => "#{data["author"]["name"]} <#{data["author"]["email"]}>",
:message => data["message"],
:committed_at => data["timestamp"])
end
Expand All @@ -139,4 +139,4 @@ def delete_code
Integrity.log "Problem while trying to deleting code: #{error}"
end
end
end
end
9 changes: 9 additions & 0 deletions test/acceptance/api_test.rb
Expand Up @@ -7,6 +7,15 @@ class ApiTest < Test::Unit::AcceptanceTestCase
So that my project is built everytime I push to the Holy Hub
EOF

it "parses payload author correctly" do
repo = git_repo(:my_test_project) # initial commit && successful commit
Project.gen(:my_test_project, :uri => repo.path)
basic_auth "admin", "test"
post "/my-test-project/push", :payload => payload(repo.head, "master", repo.commits)
visit "/my-test-project"
response_body.should have_tag(".who", "by: John Doe")
end

scenario "it only build commits for the branch being monitored" do
repo = git_repo(:my_test_project) # initial commit && successful commit
Project.gen(:my_test_project, :uri => repo.path, :branch => "my-branch")
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/acceptance/git_helper.rb
Expand Up @@ -43,7 +43,7 @@ def commits
Dir.chdir(@path) do
commits = `git log --pretty=oneline`.collect { |line| line.split(" ").first }
commits.inject([]) do |commits, sha1|
format = %Q(---%n:message: >-%n %s%n:timestamp: %ci%n:id: %H%n:author: %an <%ae>)
format = %Q(---%n:message: >-%n %s%n:timestamp: %ci%n:id: %H%n:author: %n :name: %an%n :email: %ae%n)
commits << YAML.load(`git show -s --pretty=format:"#{format}" #{sha1}`)
end
end
Expand Down

0 comments on commit e08195a

Please sign in to comment.