Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
Sends more javascript information back to hoptaod
Browse files Browse the repository at this point in the history
  • Loading branch information
Emma Lindsay committed Oct 18, 2010
1 parent d21754d commit 49512d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion features/rails_with_js_notifier.feature
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions features/step_definitions/rails_application_steps.rb
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions lib/templates/javascript_notifier.erb
Expand Up @@ -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>

0 comments on commit 49512d1

Please sign in to comment.