Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added tests to confirm sprockets requires and sass/scss imports

  • Loading branch information...
commit 57912929d6ad026d99ac9ce0d5cd7aa77b576e5a 1 parent c1c0e14
@rmm5t rmm5t authored
View
1  .gitignore
@@ -5,3 +5,4 @@ pkg/*
bin
vendor/ruby
.rbenv-version
+.sass-cache
View
1  font-awesome-rails.gemspec
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "activesupport"
gem.add_development_dependency "tzinfo"
+ gem.add_development_dependency "sass-rails"
end
View
1  test/dummy/app/assets/stylesheets/sass-import.css.sass
@@ -0,0 +1 @@
+@import font-awesome
View
1  test/dummy/app/assets/stylesheets/scss-import.css.scss
@@ -0,0 +1 @@
+@import "font-awesome";
View
3  test/dummy/app/assets/stylesheets/sprockets-require.css
@@ -0,0 +1,3 @@
+/*
+ *= require font-awesome
+ */
View
3  test/dummy/config/application.rb
@@ -3,8 +3,7 @@
# require "rails/all"
require "sprockets/railtie"
-Bundler.require
-require "font-awesome-rails"
+Bundler.require(:default, :development)
module Dummy
class Application < Rails::Application
View
26 test/font_awesome_rails_test.rb
@@ -1,6 +1,8 @@
require 'test_helper'
class FontAwesomeRailsTest < ActionDispatch::IntegrationTest
+ teardown { clean_sprockets_cache }
+
test "engine is loaded" do
assert_equal ::Rails::Engine, Font::Awesome::Rails::Engine.superclass
end
@@ -30,4 +32,28 @@ class FontAwesomeRailsTest < ActionDispatch::IntegrationTest
assert_match "/assets/fontawesome-webfont.woff", response.body
assert_match "/assets/fontawesome-webfont.ttf", response.body
end
+
+ test "stylesheet is available in a css sprockets require" do
+ get "/assets/sprockets-require.css"
+ assert_response :success
+ assert_match "font-family: 'FontAwesome';", response.body
+ end
+
+ test "stylesheet is available in a sass import" do
+ get "/assets/sass-import.css"
+ assert_response :success
+ assert_match "font-family: 'FontAwesome';", response.body
+ end
+
+ test "stylesheet is available in a scss import" do
+ get "/assets/scss-import.css"
+ assert_response :success
+ assert_match "font-family: 'FontAwesome';", response.body
+ end
+
+ private
+
+ def clean_sprockets_cache
+ FileUtils.rm_rf File.expand_path("../dummy/tmp", __FILE__)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.