Sha256: fd85a20cda1a141c0c86bfe082a5a50936f43f2b37c74de674f3cacf1cb31d97

Contents?: true

Size: 1.23 KB

Versions: 32

Compression:

Stored size: 1.23 KB

Contents

require 'test_helper'

class MapboxRailsDirectionsPluginTest < ActionDispatch::IntegrationTest
  teardown { clean_sprockets_cache }

  def plugin
    :directions
  end

  test "javascript are served" do
    get "/assets/mapbox-gl-#{plugin}.js"
    assert_mapbox_gl_plugin(response)
  end

  test "stylesheets are served" do
    get "/assets/mapbox-gl-#{plugin}.css"
    assert_mapbox_gl_css_plugin(response)
  end

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

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

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

  private

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

  def assert_mapbox_gl_css_plugin(response, pattern = /mapbox-directions-origin/)
    assert_response :success
    assert_match(pattern, response.body)
  end

  def assert_mapbox_gl_plugin(response, pattern = /fetchDirections/)
    assert_response :success
    assert_match(pattern, response.body)
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
mapbox-gl-rails-1.2.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.1.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.1.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.0.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-0.54.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-0.53.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-0.53.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-0.52.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-0.51.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-0.50.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-0.49.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-0.48.0 test/mapbox-gl-directions-plugin_test.rb