<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -15,7 +15,7 @@ module HoptoadNotifier
     # any custom processing that is defined with Rails 2's exception helpers.
     def rescue_action_in_public_with_hoptoad(exception)
       unless ignore_user_agent?
-        HoptoadNotifier.notify_or_ignore(exception, :request =&gt; request)
+        HoptoadNotifier.notify_or_ignore(exception, request_data_for_hoptoad)
       end
       rescue_action_in_public_without_hoptoad(exception)
     end
@@ -24,7 +24,7 @@ module HoptoadNotifier
     # inside the controller. Otherwise it works like HoptoadNotifier.notify.
     def notify_hoptoad(hash_or_exception)
       unless consider_all_requests_local || local_request?
-        HoptoadNotifier.notify(hash_or_exception, :request =&gt; request)
+        HoptoadNotifier.notify(hash_or_exception, request_data_for_hoptoad)
       end
     end
 
@@ -34,5 +34,10 @@ module HoptoadNotifier
       HoptoadNotifier.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent }
     end
 
+    def request_data_for_hoptoad
+      { :request =&gt; request,
+        :session =&gt; session.to_hash }
+    end
+
   end
 end</diff>
      <filename>lib/hoptoad_notifier/catcher.rb</filename>
    </modified>
    <modified>
      <diff>@@ -53,6 +53,7 @@ module HoptoadNotifier
     def initialize(args)
       self.args         = args
       self.exception    = args[:exception]
+      # TODO: should this be in Catcher?
       self.request      = args[:request]
       self.api_key      = args[:api_key]
       self.project_root = args[:project_root]
@@ -228,9 +229,7 @@ module HoptoadNotifier
     end
 
     def find_session_data
-      self.session_data = args[:session_data] || args[:session] || request.try(:session) || {}
-      self.session_data = session_data.instance_variable_get('@data') if session_data.instance_variables.include?('@data')
-      self.session_data = session_data.to_hash if session_data.respond_to?(:to_hash)
+      self.session_data = args[:session_data] || args[:session] || {}
       self.session_data = session_data[:data] if session_data[:data]
     end
 </diff>
      <filename>lib/hoptoad_notifier/notice.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,30 @@ class CatcherTest &lt; Test::Unit::TestCase
     end
   end
 
+  def assert_sent_session_data(data)
+    assert_not_nil notice = last_sent_notice_data, &quot;should send a notice&quot;
+    assert_not_nil notice['session'], &quot;should send a session, (got #{notice.inspect})&quot;
+    assert_equal data, notice['session']['data']
+  end
+
+  def assert_sent_parameter_data(data)
+    assert_not_nil notice = last_sent_notice_data, &quot;should send a notice&quot;
+    assert_not_nil notice['params'], &quot;should send parameters, (got #{notice.inspect})&quot;
+    assert_equal data, notice['params']
+  end
+
+  def sender
+    HoptoadNotifier.sender
+  end
+
+  def last_sent_notice_yaml
+    sender.collected.last
+  end
+
+  def last_sent_notice_data
+    YAML.load(last_sent_notice_yaml)['notice']
+  end
+
   def process_action(opts = {}, &amp;action)
     opts[:request]  ||= ActionController::TestRequest.new
     opts[:response] ||= ActionController::TestResponse.new
@@ -43,22 +67,36 @@ class CatcherTest &lt; Test::Unit::TestCase
     klass.local                       = opts[:local]
     controller = klass.new
     controller.stubs(:rescue_action_in_public_without_hoptoad)
+    opts[:request].session.clear
+    opts[:request].session.merge!(opts[:session] || {})
     controller.process(opts[:request], opts[:response])
     controller
   end
 
+  def process_action_with_manual_notification(args = {})
+    process_action(args) do
+      notify_hoptoad(:error_message =&gt; 'fail')
+      # Rails will raise a template error if we don't render something
+      render :nothing =&gt; true
+    end
+  end
+
+  def process_action_with_automatic_notification(args = {})
+    process_action(args) { raise &quot;Hello&quot; }
+  end
+
   should &quot;deliver notices from exceptions raised in public requests&quot; do
-    process_action { raise &quot;Hello&quot; }
+    process_action_with_automatic_notification
     assert_caught_and_sent
   end
 
   should &quot;not deliver notices from exceptions in local requests&quot; do
-    process_action(:local =&gt; true) { raise &quot;Hello&quot; }
+    process_action_with_automatic_notification(:local =&gt; true)
     assert_caught_and_not_sent
   end
 
   should &quot;not deliver notices from exceptions when all requests are local&quot; do
-    process_action(:all_local =&gt; true) { raise &quot;Hello&quot; }
+    process_action_with_automatic_notification(:all_local =&gt; true)
     assert_caught_and_not_sent
   end
 
@@ -70,44 +108,33 @@ class CatcherTest &lt; Test::Unit::TestCase
 
   should &quot;not deliver ignored exceptions raised by actions&quot; do
     ignore(RuntimeError)
-    process_action { raise &quot;Hello&quot; }
+    process_action_with_automatic_notification
     assert_caught_and_not_sent
   end
 
   should &quot;deliver ignored exception raised manually&quot; do
     ignore(RuntimeError)
-    process_action { notify_hoptoad(:message =&gt; 'uh oh') }
+    process_action_with_manual_notification
     assert_caught_and_sent
   end
 
   should &quot;deliver manually sent notices in public requests&quot; do
-    process_action do
-      notify_hoptoad(:error_message =&gt; 'Yeah')
-      render :text =&gt; 'Hello'
-    end
+    process_action_with_manual_notification
     assert_caught_and_sent
   end
 
   should &quot;not deliver manually sent notices in local requests&quot; do
-    process_action(:local =&gt; true) do
-      notify_hoptoad(:error_message =&gt; 'Yeah')
-      render :text =&gt; 'Hello'
-    end
+    process_action_with_manual_notification(:local =&gt; true)
     assert_caught_and_not_sent
   end
 
   should &quot;not deliver manually sent notices when all requests are local&quot; do
-    process_action(:all_local =&gt; true) do
-      notify_hoptoad(:error_message =&gt; 'Yeah')
-      render :text =&gt; 'Hello'
-    end
+    process_action_with_manual_notification(:all_local =&gt; true)
     assert_caught_and_not_sent
   end
 
   should &quot;continue with default behavior after delivering an exception&quot; do
-    controller = process_action(:public =&gt; true) do
-      raise 'Oh no'
-    end
+    controller = process_action_with_automatic_notification(:public =&gt; true)
     # TODO: can we test this without stubbing?
     assert_received(controller, :rescue_action_in_public_without_hoptoad)
   end
@@ -119,9 +146,7 @@ class CatcherTest &lt; Test::Unit::TestCase
 
   should &quot;pass the request to the notifier&quot; do
     stub_notice!
-    controller = process_action(:public =&gt; true) do
-      raise 'Oh no'
-    end
+    controller = process_action_with_automatic_notification(:public =&gt; true)
     assert_received(HoptoadNotifier::Notice, :new) do |expect|
       expect.with(has_entries(:request =&gt; controller.request))
     end
@@ -129,19 +154,44 @@ class CatcherTest &lt; Test::Unit::TestCase
 
   should &quot;ignore exceptions when user agent is being ignored by regular expression&quot; do
     HoptoadNotifier.configuration.ignore_user_agent_only = [/Ignored/]
-    process_action(:user_agent =&gt; 'ShouldBeIgnored') { raise 'Oh no' }
+    process_action_with_automatic_notification(:user_agent =&gt; 'ShouldBeIgnored')
     assert_caught_and_not_sent
   end
 
   should &quot;ignore exceptions when user agent is being ignored by string&quot; do
     HoptoadNotifier.configuration.ignore_user_agent_only = ['IgnoredUserAgent']
-    process_action(:user_agent =&gt; 'IgnoredUserAgent') { raise 'Oh no' }
+    process_action_with_automatic_notification(:user_agent =&gt; 'IgnoredUserAgent')
     assert_caught_and_not_sent
   end
 
   should &quot;not ignore exceptions when user agent is not being ignored&quot; do
     HoptoadNotifier.configuration.ignore_user_agent_only = ['IgnoredUserAgent']
-    process_action(:user_agent =&gt; 'NonIgnoredAgent') { raise 'Oh no' }
+    process_action_with_automatic_notification(:user_agent =&gt; 'NonIgnoredAgent')
     assert_caught_and_sent
   end
+
+  should &quot;send session data for manual notifications&quot; do
+    data = { 'one' =&gt; 'two' }
+    process_action_with_manual_notification(:session =&gt; data)
+    assert_sent_session_data data
+  end
+
+  should &quot;send session data for automatic notification&quot; do
+    data = { 'one' =&gt; 'two' }
+    process_action_with_automatic_notification(:session =&gt; data)
+    assert_sent_session_data data
+  end
+
+  should &quot;send request data for manual notification&quot; do
+    params = { 'controller' =&gt; &quot;users&quot;, 'action' =&gt; &quot;create&quot; }
+    process_action_with_manual_notification(:params =&gt; params)
+    assert_sent_parameter_data params
+  end
+
+  should &quot;send request data for automatic notification&quot; do
+    params = { 'controller' =&gt; &quot;users&quot;, 'action' =&gt; &quot;create&quot; }
+    process_action_with_automatic_notification(:params =&gt; params)
+    assert_sent_parameter_data params
+  end
+
 end</diff>
      <filename>test/catcher_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -83,29 +83,6 @@ class NoticeTest &lt; Test::Unit::TestCase
     assert_equal data, notice.session_data
   end
 
-  should &quot;accept session data from a session object that converts to a hash&quot; do
-    data = { 'one' =&gt; 'two' }
-    session = stub('session', :to_hash =&gt; data)
-    notice = build_notice(:session =&gt; session)
-    assert_equal data, notice.session_data
-  end
-
-  should &quot;accept session data from a session object with a @data variable&quot; do
-    data = { 'one' =&gt; 'two' }
-    session = &quot;session&quot;
-    session.instance_variable_set('@data', data)
-    notice = build_notice(:session =&gt; session)
-    assert_equal data, notice.session_data
-  end
-
-  should &quot;accept session data from a request object with a session method&quot; do
-    data = { 'one' =&gt; 'two' }
-    session = stub('session', :to_hash =&gt; data)
-    request = stub_request(:session =&gt; session)
-    notice = build_notice(:request =&gt; request)
-    assert_equal data, notice.session_data
-  end
-
   should &quot;set the environment from a hash or ENV&quot; do
     custom_env = { 'string' =&gt; 'value' }
     custom_notice = build_notice(:environment =&gt; custom_env)</diff>
      <filename>test/notice_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fabd3529f7b78c0f25f6d6f572fabfa7b9fdb8de</id>
    </parent>
  </parents>
  <author>
    <name>Joe Ferris</name>
    <email>jferris@metaphor.local</email>
  </author>
  <url>http://github.com/thoughtbot/hoptoad_notifier/commit/d530aa90a8c2f1b5e1f206db05a179e4fb32909c</url>
  <id>d530aa90a8c2f1b5e1f206db05a179e4fb32909c</id>
  <committed-date>2009-11-05T08:12:09-08:00</committed-date>
  <authored-date>2009-08-17T12:32:03-07:00</authored-date>
  <message>Moved session object parsing into the Catcher</message>
  <tree>71316ff0ee249f6b97d27448b2c7fd0c69e455c2</tree>
  <committer>
    <name>Joe Ferris</name>
    <email>jferris@metaphor.local</email>
  </committer>
</commit>
