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-3.7.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-2.9.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-2.7.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-2.6.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-2.3.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-2.3.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-2.2.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.13.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.10.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.10.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.9.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.9.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.8.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.7.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.6.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.6.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.5.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.4.0 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.3.1 test/mapbox-gl-directions-plugin_test.rb
mapbox-gl-rails-1.3.0 test/mapbox-gl-directions-plugin_test.rb