Sha256: a6848f4795c8d1e5e21ec8a39f87a32a9d0f49800b1c7eca5c1d1ea54bd4ff81

Contents?: true

Size: 1.82 KB

Versions: 6

Compression:

Stored size: 1.82 KB

Contents

require 'test_helper'

class FontIoniconsRailsTest < ActionDispatch::IntegrationTest
  teardown { clean_sprockets_cache }

  test 'engine is loaded' do
    assert_equal ::Rails::Engine, FontIonicons::Rails::Engine.superclass
  end

  test 'fonts are served' do
    get '/assets/ionicons.eot'
    assert_response :success
    get '/assets/ionicons.woff'
    assert_response :success
    get '/assets/ionicons.ttf'
    assert_response :success
    get '/assets/ionicons.svg'
    assert_response :success
  end

  test 'stylesheets are served' do
    get '/assets/ionicons.css'
    assert_ionicons(response)
  end

  test 'stylesheets contain asset pipeline references to fonts' do
    get '/assets/ionicons.css'
    v = FontIonicons::Rails::FI_VERSION
    assert_match "/assets/ionicons.eot?v=#{v}",  response.body
    assert_match "/assets/ionicons.eot?#iefix&v=#{v}", response.body
    assert_match "/assets/ionicons.woff?v=#{v}", response.body
    assert_match "/assets/ionicons.ttf?v=#{v}",  response.body
    assert_match "/assets/ionicons.svg?v=#{v}#ioniconsregular", response.body
  end

  test 'stylesheet is available in a css sprockets require' do
    get '/assets/sprockets-require.css'
    assert_ionicons(response)
  end

  test 'stylesheet is available in a sass import' do
    get '/assets/sass-import.css'
    assert_ionicons(response)
  end

  test 'stylesheet is available in a scss import' do
    get '/assets/scss-import.css'
    assert_ionicons(response)
  end

  test 'helpers should be available in the view' do
    get '/icons'
    assert_response :success
    assert_select 'i.ion-flag'
  end

  private

  def clean_sprockets_cache
    FileUtils.rm_rf File.expand_path('../dummy/tmp',  __FILE__)
  end

  def assert_ionicons(response)
    assert_response :success
    assert_match(/font-family:\s*'Ionicons';/, response.body)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
font-ionicons-rails-2.0.1.6 test/font-ionicons_rails_test.rb
font-ionicons-rails-2.0.1.5 test/font-ionicons_rails_test.rb
font-ionicons-rails-2.0.1.4 test/font-ionicons_rails_test.rb
font-ionicons-rails-2.0.1.3 test/font-ionicons_rails_test.rb
font-ionicons-rails-2.0.1.2 test/font-ionicons_rails_test.rb
font-ionicons-rails-2.0.1.0 test/font-ionicons_rails_test.rb