5105: Really call the report_issue action, instead of fetching "/",
authorTom Clegg <tom@curoverse.com>
Thu, 5 Mar 2015 23:58:53 +0000 (18:58 -0500)
committerTom Clegg <tom@curoverse.com>
Thu, 5 Mar 2015 23:58:53 +0000 (18:58 -0500)
when the "send" button is clicked.

apps/workbench/app/assets/javascripts/report_issue.js
apps/workbench/test/integration/errors_test.rb
apps/workbench/test/integration/report_issue_test.rb

index f3c323c63ba72bd05dde4e40a87cdcd46e936511..371dacc1afe1eb8bfc8d11144db59cb724c44b15 100644 (file)
@@ -8,7 +8,7 @@ $(document).
     }
     $('div').remove('.modal-footer-status');
 
-    $.ajax('/').
+    $.ajax('/report_issue', {type: 'POST'}).
       success(function(data, status, jqxhr) {
         var $sendButton = $('#report-issue-submit');
         $sendButton.html('Report sent');
index 8198be4fb395bc5ff2bca82be45893181c593992..32f16a68dfa9bb7da49f0adbce9881aa0480aeda 100644 (file)
@@ -103,6 +103,10 @@ class ErrorsTest < ActionDispatch::IntegrationTest
         assert_no_selector 'a,button:not([disabled])', text: 'Send problem report'
         assert_selector 'a,button', text: 'Cancel'
 
+        report = mock
+        report.expects(:deliver).returns true
+        IssueReporter.expects(:send_report).returns report
+
         # enter a report text and click on report
         find_field('report_issue_text').set 'my test report text'
         click_button 'Send problem report'
index 7d4058db4a974126625af8d1648680924b8f9a4f..4a15851636fba6f0502f741d181af42727a921af 100644 (file)
@@ -59,6 +59,11 @@ class ReportIssueTest < ActionDispatch::IntegrationTest
       # enter a report text and click on report
       page.find_field('report_issue_text').set 'my test report text'
       assert page.has_button?('Send problem report'), 'Send problem report button not enabled after entering text'
+
+      report = mock
+      report.expects(:deliver).returns true
+      IssueReporter.expects(:send_report).returns report
+
       click_button 'Send problem report'
 
       # ajax success updated button texts and added footer message