Sha256: 51266d8cc539667cf3f4c441c4659ca1b0d4ba5b25be3d692547c0b85a70d4ad
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require 'rails_helper' # Specs for view helpers: rails_amp_html_header, rails_amp_google_analytics_page_tracking # These helpers don't use controller or request object. describe RailsAmp::ViewHelpers::ActionView do context '#rails_amp_html_header' do it 'returns correct amp header' do expect(rails_amp_html_header).to include('style amp-boilerplate') expect(rails_amp_html_header).to include('script async src="https://cdn.ampproject.org') end end context '#rails_amp_google_analytics_page_tracking disabled' do it 'returns analytics off' do expect(RailsAmp.analytics).to eq '' expect(rails_amp_google_analytics_page_tracking).to eq '' end end context '#rails_amp_google_analytics_page_tracking enabled' do before(:each) do RailsAmp.analytics = 'UA-12345-6' end after(:each) do RailsAmp.config_file = "#{Rails.root}/config/rails_amp.yml" RailsAmp.reload_config! end it 'returns analytics on' do expect(RailsAmp.analytics).to eq 'UA-12345-6' expect(rails_amp_google_analytics_page_tracking).to include('script async custom-element="amp-analytics"') expect(rails_amp_google_analytics_page_tracking).to include('"account": "UA-12345-6"') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rails_amp-0.1.6 | spec/view_helpers/action_view_spec.rb |
rails_amp-0.1.5 | spec/view_helpers/action_view_spec.rb |
rails_amp-0.1.4 | spec/view_helpers/action_view_spec.rb |