Feature: Install the Gem in a Rails application and enable the JavaScript notifier Background: Given I have built and installed the "projectlocker_errata" gem Scenario: Include the Javascript notifier when enabled When I generate a new Rails application And I configure the ProjectlockerErrata shim And I configure my application to require the "projectlocker_errata" gem When I configure the notifier to use the following configuration lines: """ config.api_key = "myapikey" """ And I define a response for "TestController#index": """ render :inline => '<%= projectlocker_errata_javascript_notifier %>' """ And I route "/test/index" to "test#index" And I perform a request to "http://example.com:123/test/index" Then I should see the notifier JavaScript for the following: | api_key | environment | host | | myapikey | production | api.projectlocker_errata.io | And the notifier JavaScript should provide the following errorDefaults: | url | component | action | | 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 And I configure the ProjectlockerErrata shim And I configure my application to require the "projectlocker_errata" gem When I configure the notifier to use the following configuration lines: """ config.api_key = "myapikey!" config.host = "myprojectlocker_errata.com" config.port = 3001 """ And I define a response for "TestController#index": """ render :inline => '<%= projectlocker_errata_javascript_notifier %>' """ And I route "/test/index" to "test#index" And I perform a request to "http://example.com:123/test/index" Then I should see the notifier JavaScript for the following: | api_key | environment | host | | myapikey! | production | myprojectlocker_errata.com:3001 | Scenario: Don't include the Javascript notifier by default When I generate a new Rails application And I configure the ProjectlockerErrata shim And I configure my application to require the "projectlocker_errata" gem When I configure the notifier to use the following configuration lines: """ config.api_key = "myapikey!" """ And I define a response for "TestController#index": """ render :inline => "" """ And I route "/test/index" to "test#index" And I perform a request to "http://example.com:123/test/index" Then I should not see notifier JavaScript Scenario: Don't include the Javascript notifier when enabled in non-public environments When I generate a new Rails application And I configure the ProjectlockerErrata shim And I configure my application to require the "projectlocker_errata" gem When I configure the notifier to use the following configuration lines: """ config.api_key = "myapikey!" config.environment_name = 'test' """ And I define a response for "TestController#index": """ render :inline => '<%= projectlocker_errata_javascript_notifier %>' """ And I route "/test/index" to "test#index" And I perform a request to "http://example.com:123/test/index" in the "test" environment Then I should not see notifier JavaScript Scenario: Include the Javascript notifier with a custom api key When I generate a new Rails application And I configure the ProjectlockerErrata shim And I configure my application to require the "projectlocker_errata" gem When I configure the notifier to use the following configuration lines: """ config.api_key = "myapikey!" config.js_api_key = "myjsapikey!" """ And I define a response for "TestController#index": """ render :inline => '<%= projectlocker_errata_javascript_notifier %>' """ And I route "/test/index" to "test#index" And I perform a request to "http://example.com:123/test/index" Then I should see the notifier JavaScript for the following: | api_key | environment | host | | myjsapikey! | production | api.projectlocker_errata.io |