<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -51,7 +51,7 @@ namespace :test do
 
   desc &quot;Install all gems on which the tests depend on&quot;
   task :install_dependencies do
-    system 'gem install redgreen rr mocha ruby-debug dm-sweatshop'
+    system 'gem install redgreen rr mocha ruby-debug dm-sweatshop webrat'
     system 'gem install -s http://gems.github.com jeremymcanally-context jeremymcanally-matchy jeremymcanally-pending foca-storyteller'
   end
 end
@@ -89,7 +89,7 @@ begin
     s.executables          = ['integrity']
     s.post_install_message = 'Run `integrity help` for information on how to setup Integrity.'
 
-    s.add_dependency 'sinatra', ['&gt;= 0.3.2']
+    s.add_dependency 'sinatra', ['&gt;= 0.9.0.3']
     s.add_dependency 'haml' # ah, you evil monkey you
     s.add_dependency 'dm-core', ['&gt;= 0.9.5']
     s.add_dependency 'dm-validations', ['&gt;= 0.9.5']</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,6 @@
 require File.dirname(__FILE__) + &quot;/lib/integrity&quot;
 require &quot;sinatra&quot;
 require &quot;helpers&quot;
-require &quot;hacks&quot;
 
 set :root,   Integrity.root
 set :public, Integrity.root / &quot;public&quot;
@@ -46,7 +45,7 @@ end
 get &quot;/login&quot; do
   login_required
   session[:user] = current_user
-  redirect &quot;/&quot;
+  redirect root_url
 end
 
 get &quot;/new&quot; do
@@ -62,7 +61,7 @@ post &quot;/&quot; do
   @project = Project.new(params[:project_data])
   if @project.save
     @project.enable_notifiers(params[&quot;enabled_notifiers[]&quot;], params[&quot;notifiers&quot;])
-    redirect project_path(@project)
+    redirect project_url(@project)
   else
     show :new, :title =&gt; [&quot;projects&quot;, &quot;new project&quot;]
   end
@@ -75,7 +74,7 @@ end
 
 get &quot;/:project.atom&quot; do
   login_required unless current_project.public?
-  header &quot;Content-Type&quot; =&gt; &quot;application/atom+xml; charset=utf-8&quot;
+  response[&quot;Content-Type&quot;] = &quot;application/rss+xml; charset=utf-8&quot;
   builder :project
 end
 
@@ -83,7 +82,7 @@ put &quot;/:project&quot; do
   login_required
 
   if current_project.update_attributes(params[:project_data])
-    current_project.enable_notifiers(params[&quot;enabled_notifiers[]&quot;], params[&quot;notifiers&quot;])
+    current_project.enable_notifiers(params[&quot;enabled_notifiers&quot;], params[&quot;notifiers&quot;])
     redirect project_url(current_project)
   else
     show :new, :title =&gt; [&quot;projects&quot;, current_project.permalink, &quot;edit&quot;]
@@ -94,7 +93,7 @@ delete &quot;/:project&quot; do
   login_required
 
   current_project.destroy
-  redirect &quot;/&quot;
+  redirect root_url
 end
 
 get &quot;/:project/edit&quot; do
@@ -129,7 +128,7 @@ get &quot;/:project/builds/:build&quot; do
 end
 
 get &quot;/integrity.css&quot; do
-  header &quot;Content-Type&quot; =&gt; &quot;text/css; charset=utf-8&quot;
+  response[&quot;Content-Type&quot;] = &quot;text/css; charset=utf-8&quot;
   sass :integrity
 end
 </diff>
      <filename>app.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,7 +25,7 @@ module Integrity
       end
 
       def unauthorized!(realm=authorization_realm)
-        header &quot;WWW-Authenticate&quot; =&gt; %(Basic realm=&quot;#{realm}&quot;)
+        response[&quot;WWW-Authenticate&quot;] = %(Basic realm=&quot;#{realm}&quot;)
         throw :halt, [401, show(:unauthorized, :title =&gt; &quot;incorrect credentials&quot;)]
       end
     end</diff>
      <filename>lib/integrity/helpers/authorization.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,20 @@
 module Integrity
   module Helpers
     module Urls
-      def integrity_domain
-        Addressable::URI.parse(Integrity.config[:base_uri]).to_s
+      def url(path)
+        url = &quot;#{request.scheme}://#{request.host}&quot;
+
+        if request.scheme == &quot;https&quot; &amp;&amp; request.port != 443 ||
+            request.scheme == &quot;http&quot; &amp;&amp; request.port != 80
+          url &lt;&lt; &quot;:#{request.port}&quot;
+        end
+
+        url &lt;&lt; &quot;/&quot; unless path.index(&quot;/&quot;).zero?
+        url &lt;&lt; path
+      end
+
+      def root_url
+        url(&quot;/&quot;)
       end
 
       def project_path(project, *path)
@@ -10,14 +22,14 @@ module Integrity
       end
 
       def project_url(project, *path)
-        &quot;#{integrity_domain}#{project_path(project, *path)}&quot;
+        url project_path(project, *path)
       end
 
       def push_url_for(project)
-        Addressable::URI.parse(&quot;#{project_url(project)}/push&quot;).tap do |url|
+        Addressable::URI.parse(project_url(project, &quot;push&quot;)).tap do |url|
           if Integrity.config[:use_basic_auth]
             url.user     = Integrity.config[:admin_username]
-            url.password = Integrity.config[:hash_admin_password] ? 
+            url.password = Integrity.config[:hash_admin_password] ?
               &quot;&lt;password&gt;&quot; : Integrity.config[:admin_password]
           end
         end.to_s
@@ -28,7 +40,7 @@ module Integrity
       end
 
       def build_url(build)
-        &quot;#{integrity_domain}#{build_path(build)}&quot;
+        url build_path(build)
       end
     end
   end</diff>
      <filename>lib/integrity/helpers/urls.rb</filename>
    </modified>
    <modified>
      <diff>@@ -33,7 +33,7 @@ class ApiTest &lt; Test::Unit::AcceptanceTestCase
       end
     end
 
-    Project.gen(:my_test_project, :uri =&gt; repo.path)
+    Project.gen(:my_test_project, :uri =&gt; repo.path, :command =&gt; &quot;echo successful&quot;)
 
     lambda do
       basic_auth &quot;admin&quot;, &quot;test&quot;
@@ -71,7 +71,7 @@ class ApiTest &lt; Test::Unit::AcceptanceTestCase
     Project.gen(:my_test_project, :uri =&gt; git_repo(:my_test_project).path)
     head = git_repo(:my_test_project).head
     post &quot;/my-test-project/push&quot;, :payload =&gt; payload(head, &quot;master&quot;)
-    
+
     response_code.should == 401
   end
 </diff>
      <filename>test/acceptance/api_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,27 +7,23 @@ class BuildNotificationsTest &lt; Test::Unit::AcceptanceTestCase
     I want to setup notifiers on my projects
     So that I get alerts with every build
   EOS
-  
-  before(:each) do
-    Integrity.config[:base_uri] = &quot;http://integrity.example.org&quot;
-  end
 
   scenario &quot;an admin sets up a notifier for a project that didn't have any&quot; do
     git_repo(:my_test_project).add_successful_commit
     Project.gen(:my_test_project, :notifiers =&gt; [], :uri =&gt; git_repo(:my_test_project).path)
     rm_f &quot;/tmp/textfile_notifications.txt&quot;
-    
+
     login_as &quot;admin&quot;, &quot;test&quot;
-    
+
     visit &quot;/my-test-project&quot;
 
     click_link &quot;Edit Project&quot;
     check &quot;enabled_notifiers_textfile&quot;
     fill_in &quot;File&quot;, :with =&gt; &quot;/tmp/textfile_notifications.txt&quot;
     click_button &quot;Update Project&quot;
-    
+
     click_button &quot;manual build&quot;
-    
+
     notification = File.read(&quot;/tmp/textfile_notifications.txt&quot;)
     notification.should =~ /=== Build #{git_repo(:my_test_project).short_head} was successful ===/
     notification.should =~ /Build #{git_repo(:my_test_project).head} was successful/
@@ -37,4 +33,4 @@ class BuildNotificationsTest &lt; Test::Unit::AcceptanceTestCase
     notification.should =~ /Commit Message: This commit will work/
     notification.should =~ /Build Output:\n\nRunning tests...\n/
   end
-end
\ No newline at end of file
+end</diff>
      <filename>test/acceptance/build_notifications_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,61 @@
-require &quot;webrat/sinatra&quot;
+require 'webrat/rack'
+require 'sinatra'
+require 'sinatra/test'
+
+disable :run
+disable :reload
+
+Webrat.configuration.instance_variable_set(&quot;@mode&quot;, :sinatra)
+
+module Webrat
+  class SinatraSession &lt; Session
+    DEFAULT_DOMAIN = &quot;integrity.example.org&quot;
+
+    def initialize(context = nil)
+      super(context)
+      @sinatra_test = Sinatra::TestHarness.new
+    end
+
+    %w(get head post put delete).each do |verb|
+      class_eval &lt;&lt;-METHOD
+        def #{verb}(path, data, headers = {})
+          params = data.inject({}) do |data, (key,value)|
+            data[key] = Rack::Utils.unescape(value)
+            data
+          end
+          headers['HTTP_HOST'] = DEFAULT_DOMAIN
+          @sinatra_test.#{verb}(path, params, headers)
+        end
+      METHOD
+    end
+
+    def response_body
+      @sinatra_test.body
+    end
+
+    def response_code
+      @sinatra_test.status
+    end
+
+    private
+
+    def response
+      @sinatra_test.response
+    end
+
+    def current_host
+      URI.parse(current_url).host || DEFAULT_DOMAIN
+    end
+
+    def response_location_host
+      URI.parse(response_location).host || DEFAULT_DOMAIN
+    end
+  end
+end
+
 require Integrity.root / &quot;app&quot;
 require File.dirname(__FILE__) / &quot;acceptance/git_helper&quot;
 
-Webrat.configuration.mode = :sinatra
-
 module AcceptanceHelper
   include FileUtils
 
@@ -17,14 +69,14 @@ module AcceptanceHelper
     Integrity.config[:admin_password]      = &quot;test&quot;
     Integrity.config[:hash_admin_password] = false
   end
-  
+
   def login_as(user, password)
     def AcceptanceHelper.logged_in; true; end
     basic_auth user, password
     visit &quot;/login&quot;
-    Sinatra.application.before { login_required if AcceptanceHelper.logged_in }
+    Sinatra::Application.before { login_required if AcceptanceHelper.logged_in }
   end
-  
+
   def log_out
     def AcceptanceHelper.logged_in; false; end
     @_webrat_session = Webrat::SinatraSession.new(self)
@@ -47,17 +99,17 @@ module AcceptanceHelper
   end
 end
 
-module WebratHelpers
-  include Webrat::Methods
-  Webrat::Methods.delegate_to_session :response_code, :response_body
-end
-
 class Test::Unit::AcceptanceTestCase &lt; Test::Unit::TestCase
   include AcceptanceHelper
   include Test::Storyteller
-  include WebratHelpers
   include GitHelper
-  
+  include Webrat::Methods
+  Webrat::Methods.delegate_to_session :response_code
+
+  before(:all) do
+    Integrity.config[:base_uri] = &quot;http://#{Webrat::SinatraSession::DEFAULT_DOMAIN}&quot;
+  end
+
   before(:each) do
     # ensure each scenario is run in a clean sandbox
     setup_and_reset_database!
@@ -66,7 +118,7 @@ class Test::Unit::AcceptanceTestCase &lt; Test::Unit::TestCase
     set_and_create_export_directory!
     log_out
   end
-  
+
   after(:each) do
     destroy_all_git_repos
     rm_r export_directory if File.directory?(export_directory)</diff>
      <filename>test/helpers/acceptance.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,8 @@ class BrowsePublicProjectsTest &lt; Test::Unit::TestCase
       @project = Project.gen(:integrity)
       Integrity.config[:admin_username] = &quot;admin&quot;
       Integrity.config[:admin_password] = &quot;test&quot;
-      Integrity.config[:base_uri] = &quot;http://integrity.example.org:1234&quot;
+      
+      stub(self).request { OpenStruct.new(:scheme =&gt; &quot;http&quot;, :port =&gt; &quot;1234&quot;, :host =&gt; &quot;integrity.example.org&quot;) }
     end
 
     test &quot;with auth disabled&quot; do</diff>
      <filename>test/unit/helpers_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-Subproject commit 78b8f3411ad83bea91e7bf98dcb8e9f640e75603
+Subproject commit 0272e818473d12b1d9bd45beed55b54e3e4418a3</diff>
      <filename>vendor/webrat</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>vendor/sinatra-hacks/lib/hacks.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>674bee8f925ce174b6e7fbbf13982080513c960e</id>
    </parent>
    <parent>
      <id>e0c6c5cd3b6cf18f941ab4b9e40825197d3bf684</id>
    </parent>
  </parents>
  <author>
    <name>Nicolas Sanguinetti</name>
    <email>contacto@nicolassanguinetti.info</email>
  </author>
  <url>http://github.com/foca/integrity/commit/a3b778400630ee7beb37981a56b6de5f980978d9</url>
  <id>a3b778400630ee7beb37981a56b6de5f980978d9</id>
  <committed-date>2009-01-25T14:15:40-08:00</committed-date>
  <authored-date>2009-01-25T14:15:40-08:00</authored-date>
  <message>Merge branch 'sinatra-0.9'</message>
  <tree>ee4006e0b2b85def3b812a123d12aa93565a0c93</tree>
  <committer>
    <name>Nicolas Sanguinetti</name>
    <email>contacto@nicolassanguinetti.info</email>
  </committer>
</commit>
