forked from square/kochiku
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joshua Eversmann
committed
Jun 24, 2014
1 parent
6ad14b5
commit 56fd48a
Showing
9 changed files
with
115 additions
and
15 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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/html"> | ||
<head> | ||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> | ||
</head> | ||
<body> | ||
<h2>Project <%= @build.project.name %> succeeded on branch <%= @build.branch %></h2> | ||
<%= project_build_url(@build.project, @build) %><br> | ||
<h2>Changes included in build</h2> | ||
<% @git_changes.each do |git_change| %> | ||
<b>commit <%= link_to(git_change[:hash], "#{@build.project.repository.remote_server.href_for_commit(git_change[:hash])}") %></b><br> | ||
Author: <%= git_change[:author] %><br> | ||
Date: <%= git_change[:date] %><br> | ||
<br> | ||
<%= git_change[:message] %> | ||
<br><br> | ||
<% end %> | ||
</body> | ||
</html> |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Project <%= @build.project.name %> succeded on branch <%= @build.branch %> | ||
<%= project_build_url(@build.project, @build) %> | ||
|
||
-------------------------------------------------------------------------------- | ||
Changes included in build | ||
-------------------------------------------------------------------------------- | ||
|
||
<% @git_changes.each do |git_change| %> | ||
commit <%= git_change[:hash] %> | ||
Author: <%= git_change[:author] %> | ||
Date: <%= git_change[:date] %> | ||
|
||
<%= git_change[:message] %> | ||
|
||
|
||
<% 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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class AddSuccessEmail < ActiveRecord::Migration | ||
def change | ||
add_column :builds, :build_success_email_sent, :boolean, :default => false, :null => false | ||
add_column :repositories, :send_build_success_email, :boolean, :default => true, :null => false | ||
reversible do |dir| | ||
change_table :builds do |t| | ||
dir.up { t.change :build_failure_email_sent, :boolean, :default => false, :null => false } | ||
dir.down { t.change :build_failure_email_sent, :boolean, :default => nil, :null => true } | ||
end | ||
change_table :repositories do |t| | ||
dir.up { t.change :send_build_failure_email, :boolean, :default => true, :null => false } | ||
dir.down { t.change :send_build_failure_email, :boolean, :default => true, :null => true } | ||
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
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 | Diff line number | Diff line change |
---|---|---|
|
@@ -76,4 +76,27 @@ | |
end | ||
end | ||
end | ||
|
||
describe '#build_success_email' do | ||
let(:build) { FactoryGirl.create(:build, :branch => "branch-of-master") } | ||
|
||
before do | ||
allow(GitBlame).to receive(:changes_in_branch).and_return([{:hash => "sha", :author => "Joe", :date => "some day", :message => "always be shipping it"}]) | ||
allow(GitBlame).to receive(:emails_in_branch).and_return(["[email protected]"]) | ||
end | ||
|
||
it "sends an email" do | ||
build_part = build.build_parts.create!(:paths => ["a", "b"], :kind => "cucumber", :queue => :ci) | ||
build_part.build_attempts.create!(:state => :passed, :builder => "test-builder") | ||
|
||
email = BuildMailer.build_success_email(build) | ||
|
||
expect(email.to).to eq(["[email protected]"]) | ||
|
||
expect(email.html_part.body).to include(build_part.project.name) | ||
expect(email.text_part.body).to include(build_part.project.name) | ||
expect(email.html_part.body).to include("http://") | ||
expect(email.text_part.body).to include("http://") | ||
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