Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sends more javascript information back to hoptaod

  • Loading branch information...
commit 49512d13d65d21e1957e9392b28dde9f50572cc7 1 parent d21754d
Emma Lindsay authored
View
2  features/rails_with_js_notifier.feature
@@ -23,7 +23,7 @@ Feature: Install the Gem in a Rails application and enable the JavaScript notifi
| myapikey | production | hoptoadapp.com |
And the notifier JavaScript should provide the following errorDefaults:
| url | component | action |
- | http://example.com/test/index | test | index |
+ | http://example.com:123/test/index | test | index |
Scenario: Include the Javascript notifier when enabled using custom configuration settings
When I generate a new Rails application
View
3  features/step_definitions/rails_application_steps.rb
@@ -342,14 +342,13 @@ def rails_non_initializer_hoptoad_config_file
hash = table.hashes.first
document_body = '<html>' + @terminal.output.split('<html>').last
- document_body.should include("#{host}/javascripts/notifier.js")
response = Nokogiri::HTML.parse(document_body)
response.css("script[type='text/javascript']:last-child").each do |element|
content = element.content
hash.each do |key, value|
- content.should =~ %r{Hoptoad\.setErrorDefaults.*#{key}:'#{value}'}
+ content.should =~ %r{Hoptoad\.setErrorDefaults.*#{key}: "#{value}}m
end
end
end
View
5 lib/templates/javascript_notifier.erb
@@ -9,4 +9,9 @@ document.write(unescape("%3Cscript src='" + notifierJsScheme + "<%= host %>/java
Hoptoad.setKey('<%= api_key %>');
Hoptoad.setHost('<%= host %>');
Hoptoad.setEnvironment('<%= environment %>');
+ Hoptoad.setErrorDefaults({
+ url: "<%= request.url %>",
+ component: "<%= controller_name %>",
+ action: "<%= action_name %>"
+ });
</script>
Please sign in to comment.
Something went wrong with that request. Please try again.