Sha256: 50eaa2ff18b51ba7c18bc424c71ac4dd4c80812dad60fb6fa0f5f89dec0e8940

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

require 'rails_helper'

module BootstrapLeather
  RSpec.describe BadgesHelper, folder: :helpers do
    describe '#badge' do
      describe 'with nil' do
        subject { helper.badge nil }
        it { should eq '' }
      end
      describe 'with a number' do
        subject { helper.badge 1 }
        it { should have_tag 'span', with: { class: 'badge' }, text: /1/ }
      end
      describe 'with a string' do
        subject { helper.badge '1' }
        it { should have_tag 'span', with: { class: 'badge' }, text: /1/ }
      end
      describe 'with a type' do
        subject { helper.badge '1', 'success' }
        it do
          should have_tag 'span', with: { class: 'badge-success' }, text: /1/
        end
      end
    end

    describe '#badge_to' do
      subject do
        helper.badge_to 'Link Text', 99, 'http://example.com', class: 'example'
      end
      it do
        should have_tag(
                 'a',
                 class: 'example',
                 href: 'http://example.com',
                 text: /Link Text/
               )
      end
      it { should have_tag 'span', with: { class: 'badge' }, text: /99/ }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bootstrap_leather-0.10.13 spec/helpers/bootstrap_leather/badges_helper_spec.rb
bootstrap_leather-0.10.11 spec/helpers/bootstrap_leather/badges_helper_spec.rb
bootstrap_leather-0.10.10 spec/helpers/bootstrap_leather/badges_helper_spec.rb
bootstrap_leather-0.10.9 spec/helpers/bootstrap_leather/badges_helper_spec.rb
bootstrap_leather-0.10.8 spec/helpers/bootstrap_leather/badges_helper_spec.rb
bootstrap_leather-0.10.7 spec/helpers/bootstrap_leather/badges_helper_spec.rb
bootstrap_leather-0.10.6 spec/helpers/bootstrap_leather/badges_helper_spec.rb
bootstrap_leather-0.10.5 spec/helpers/bootstrap_leather/badges_helper_spec.rb
bootstrap_leather-0.10.4 spec/helpers/bootstrap_leather/badges_helper_spec.rb