Sha256: 6f06733d67fbf36d7d861b732d8bd36e668db6a5e074f8488200055b579a16b9

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

require 'test_helper'

class SimpleLineIconsRailsTest < ActionDispatch::IntegrationTest
  teardown { clean_sprockets_cache }

  test "engine is loaded" do
    assert_equal ::Rails::Engine, SimpleLineIcons::Rails::Engine.superclass
  end

  test "fonts are served" do
    get "/assets/Simple-Line-Icons.eot"
    assert_response :success
    get "/assets/Simple-Line-Icons.ttf"
    assert_response :success
    get "/assets/Simple-Line-Icons.woff"
    assert_response :success
  end

  test "stylesheets are served" do
    get "/assets/simple-line-icons.css"
    assert_simple_line_icons(response)
  end

  test "stylesheets contain asset pipeline references to fonts" do
    get "/assets/simple-line-icons.css"
    assert_match "/assets/Simple-Line-Icons.eot",  response.body
    assert_match "/assets/Simple-Line-Icons.eot?#iefix", response.body
    assert_match "/assets/Simple-Line-Icons.woff", response.body
    assert_match "/assets/Simple-Line-Icons.ttf",  response.body
    assert_match "/assets/Simple-Line-Icons.svg#Simple-Line-Icons", response.body
  end

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

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

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

  test "helpers should be available in the view" do
    get "/icons"
    assert_response :success
  end

  private

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

  def assert_simple_line_icons(response)
    assert_response :success
    assert_match(/font-family:\s*'Simple-Line-Icons';/, response.body)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple-line-icons-rails-0.0.1 test/simple_line_icons_rails_test.rb