Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
:base_url config option; use it in email
  • Loading branch information
pd committed Aug 10, 2008
1 parent 14f3b57 commit 6a833f3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions config/config.sample.yml
@@ -1,3 +1,4 @@
:base_url: http://localhost:4567
:database_uri: sqlite3:///var/integrity.db
:export_directory: /path/to/scm/exports
:hash_admin_password: true
Expand Down
3 changes: 2 additions & 1 deletion lib/integrity.rb
Expand Up @@ -28,7 +28,8 @@ def self.root

def self.default_configuration
{ :database_uri => 'sqlite3::memory:',
:export_directory => root / 'exports' }
:export_directory => root / 'exports',
:base_url => 'http://localhost:4567' }
end

def self.config
Expand Down
2 changes: 1 addition & 1 deletion lib/integrity/notifier/email.rb
Expand Up @@ -43,7 +43,7 @@ def body
Commit Date: #{build.commited_at}
Commit Author: #{build.commit_author.name}
Link: http://localhost:4567/#{build.project.permalink}/builds/#{build.commit_identifier}
Link: #{Integrity.config[:base_url]}/#{build.project.permalink}/builds/#{build.commit_identifier}
Build Output:
Expand Down
3 changes: 2 additions & 1 deletion spec/integrity_spec.rb
Expand Up @@ -8,7 +8,8 @@
specify 'default configuration' do
Integrity.default_configuration.should == {
:database_uri => 'sqlite3::memory:',
:export_directory => Integrity.root / 'exports'
:export_directory => Integrity.root / 'exports',
:base_url => 'http://localhost:4567'
}
end

Expand Down
9 changes: 8 additions & 1 deletion spec/notifier/email_spec.rb
Expand Up @@ -19,7 +19,10 @@ def mock_build(messages={})
before do
@email = stub("email", :deliver! => true)
@mail_notifier = @email
Integrity.stub!(:config).and_return(:email => {:to => "destination@example.com", :from => "integrity@me.com", :config => {}})
Integrity.stub!(:config).and_return({
:email => {:to => "destination@example.com", :from => "integrity@me.com", :config => {}},
:base_url => 'http://integrityapp.com:7654'
})
Sinatra::Mailer::Email.stub!(:new).and_return(@email)
end

Expand Down Expand Up @@ -65,6 +68,10 @@ def mock_build(messages={})
it "should include the commit author" do
@mailer.body.should =~ /Commit Author: Nicolás Sanguinetti/
end

it "should link to the build using the base URL configured in the options" do
@mailer.body.should =~ %r|http://integrityapp\.com:7654/integrity/builds/e7e02b|
end

it "should include the build output" do
@mailer.body.should =~ /the output/
Expand Down

0 comments on commit 6a833f3

Please sign in to comment.