| 1 |
|
| 2 |
|
| 3 |
require_relative "spec_helper" |
| 4 |
|
| 5 |
describe CssController, type: :controller do |
| 6 |
before :all do |
| 7 |
cache = Rails.root.join("tmp/cache") |
| 8 |
cache.rmtree if cache.exist? |
| 9 |
end |
| 10 |
|
| 11 |
def test_file(file) |
| 12 |
if Rails.version.split(".").first.to_i >= 5 |
| 13 |
get :test, params: { file: file } |
| 14 |
else |
| 15 |
get :test, file: file |
| 16 |
end |
| 17 |
end |
| 18 |
|
| 19 |
it "integrates with Rails and Sass" do |
| 20 |
test_file "sass" |
| 21 |
expect(response).to be_successful |
| 22 |
clear_css = response.body.tr("\n", " ").squeeze(" ").strip |
| 23 |
expect(clear_css).to eq "a{-webkit-mask:none;mask:none}" |
| 24 |
end |
| 25 |
|
| 26 |
if Sprockets::Context.instance_methods.include?(:evaluate) |
| 27 |
it "supports evaluate" do |
| 28 |
test_file "evaluate" |
| 29 |
expect(response).to be_successful |
| 30 |
clear_css = response.body.tr("\n", " ").squeeze(" ").strip |
| 31 |
expect(clear_css).to eq "a { -webkit-mask: none; mask: none }" |
| 32 |
end |
| 33 |
end |
| 34 |
end |
| 35 |
|
| 36 |
describe "Rake task" do |
| 37 |
it "shows debug" do |
| 38 |
info = `cd spec/app; bundle exec rake autoprefixer:info` |
| 39 |
expect(info).to match(/Browsers:\n Chrome: 25\n\n/) |
| 40 |
expect(info).to match(/ transition: webkit/) |
| 41 |
end |
| 42 |
end |