Sha256: a153a5002f3edf5f41af24a3e9a1908d12abae870d2eff1e34c3069d8b59af4e

Contents?: true

Size: 1.91 KB

Versions: 58

Compression:

Stored size: 1.91 KB

Contents

require 'spec_helper'

RSpec.describe Bookends::ApplicationHelper, type: :helper do
  describe 'signup_link' do
    it 'sets the :class option as the value for the class HTML attribute' do
      html = '<a class="btn btn-lg" data-trackable="{&quot;category&quot;:&quot;Sign Up Links&quot;,&quot;action&quot;:&quot;Clicked&quot;,&quot;label&quot;:&quot;github-students&quot;}" href="https://signup.heroku.com">Sign up!</a>'
      expect(helper.signup_link('Sign up!', ga_label: 'github-students', class: 'btn btn-lg')).to eq(html)
    end

    it 'sets the :ga_label option in the data-trackable HTML attribute' do
      html = '<a data-trackable="{&quot;category&quot;:&quot;Sign Up Links&quot;,&quot;action&quot;:&quot;Clicked&quot;,&quot;label&quot;:&quot;github-students&quot;}" href="https://signup.heroku.com">Sign up!</a>'
      expect(helper.signup_link('Sign up!', ga_label: 'github-students')).to eq(html)
    end

    it 'appends the :signup_path option in the generated URL' do
      html = '<a data-trackable="{&quot;category&quot;:&quot;Sign Up Links&quot;,&quot;action&quot;:&quot;Clicked&quot;,&quot;label&quot;:&quot;github-students&quot;}" href="https://signup.heroku.com/github-students">Sign up!</a>'
      expect(helper.signup_link('Sign up!', ga_label: 'github-students', signup_path: 'github-students')).to eq(html)
    end

    it 'sets the :redirect_url argument as a redirect-url param in the resulting URL' do
      html = '<a class="btn btn-lg" data-trackable="{&quot;category&quot;:&quot;Sign Up Links&quot;,&quot;action&quot;:&quot;Clicked&quot;,&quot;label&quot;:&quot;github-students&quot;}" href="https://signup.heroku.com/github-students?redirect-url=https%3A%2F%2Fwww.heroku.com%2Fgithub-students">Sign up!</a>'
      expect(helper.signup_link('Sign up!', ga_label: 'github-students', redirect_url: 'https://www.heroku.com/github-students', signup_path: 'github-students', class: 'btn btn-lg')).to eq html
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
bookends-10.4.6 spec/helpers/bookends/application_helper_spec.rb
bookends-10.4.5 spec/helpers/bookends/application_helper_spec.rb
bookends-10.4.4 spec/helpers/bookends/application_helper_spec.rb
bookends-10.4.3 spec/helpers/bookends/application_helper_spec.rb
bookends-10.4.2 spec/helpers/bookends/application_helper_spec.rb
bookends-10.4.1 spec/helpers/bookends/application_helper_spec.rb
bookends-10.4.0 spec/helpers/bookends/application_helper_spec.rb
bookends-10.3.4 spec/helpers/bookends/application_helper_spec.rb
bookends-10.3.3 spec/helpers/bookends/application_helper_spec.rb
bookends-10.3.2 spec/helpers/bookends/application_helper_spec.rb
bookends-10.3.1 spec/helpers/bookends/application_helper_spec.rb
bookends-10.3.0 spec/helpers/bookends/application_helper_spec.rb
bookends-10.2.8 spec/helpers/bookends/application_helper_spec.rb
bookends-10.2.7 spec/helpers/bookends/application_helper_spec.rb
bookends-10.2.6 spec/helpers/bookends/application_helper_spec.rb
bookends-10.2.5 spec/helpers/bookends/application_helper_spec.rb
bookends-10.2.5.alpha8 spec/helpers/bookends/application_helper_spec.rb
bookends-10.2.5.alpha7 spec/helpers/bookends/application_helper_spec.rb
bookends-10.2.5.alpha6 spec/helpers/bookends/application_helper_spec.rb
bookends-10.2.5.alpha5 spec/helpers/bookends/application_helper_spec.rb