Sha256: 5f857e137b17bff555c03c4fe5bc5218fe5804c7d09a93be7bea079e8cf654c5

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

shared_examples_for 'the icon helper' do
  all_tests_pass_with 'no icon options'
  all_tests_pass_with 'extra icon options'
  all_tests_pass_with 'the :library icon option'
end

#--

shared_examples_for 'no icon options' do
  specify 'creates a <span> with an icon' do
    html = '<span class="glyphicon glyphicon-zoom-in"></span>'
    expect(:icon).to generate html
  end
end

shared_examples_for 'extra icon options' do
  specify 'passes the options to the <span>' do
    options = {class: 'important', data: {value: 1}, id: 'my-icon'}
    html = '<span class="important glyphicon glyphicon-zoom-in" data-value="1" id="my-icon"></span>'
    expect(icon: options).to generate html
  end
end

shared_examples_for 'the :library icon option' do
  Bh::Icon.libraries.each do |library, library_class|
    specify %Q{set to :#{library}, adds the class "#{library_class}"} do
      html = %Q{<span class="#{library_class} #{library_class}-zoom-in"></span>}
      expect(icon: {library: library}).to generate html
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bh-1.3.6 spec/shared/icon_helper.rb
bh-1.3.5 spec/shared/icon_helper.rb
bh-1.3.4 spec/shared/icon_helper.rb
bh-1.3.3 spec/shared/icon_helper.rb
bh-1.3.1 spec/shared/icon_helper.rb
bh-1.3.0 spec/shared/icon_helper.rb
bh-1.2.0 spec/shared/icon_helper.rb