Sha256: 691b9a9b70b1efca519b089f700709c0d74257c2851b6ce89d10ce2be063e02b

Contents?: true

Size: 1.39 KB

Versions: 46

Compression:

Stored size: 1.39 KB

Contents

require_relative 'spec_helper'

describe CssController, type: :controller do
  before :all do
    cache = Rails.root.join('tmp/cache')
    cache.rmtree if cache.exist?
  end

  def test_file(file)
    if Rails.version.split('.').first.to_i >= 5
      get :test, params: { file: file }
    else
      get :test, file: file
    end
  end

  it "integrates with Rails and Sass" do
    test_file 'sass'
    expect(response).to be_successful
    clear_css = response.body.gsub("\n", " ").squeeze(" ").strip
    expect(clear_css).to eq "a { -webkit-mask: none; mask: none }"
  end

  if Sprockets::Context.instance_methods.include?(:evaluate)
    it 'supports evaluate' do
      test_file 'evaluate'
      expect(response).to be_successful
      clear_css = response.body.gsub("\n", ' ').squeeze(' ').strip
      expect(clear_css).to eq 'a { -webkit-mask: none; mask: none }'
    end
  end

  if sprockets_4?
    it "works with sprockets 4 source maps" do
      get :test, params: { exact_file: 'sass.css.map' }
      expect(response).to be_successful

      source_map = JSON.parse(response.body)['sections'].first['map']
      expect(source_map['sources'].first).to match(/loaded.*.sass/)
    end
  end
end

describe 'Rake task' do
  it "shows debug" do
    info = `cd spec/app; bundle exec rake autoprefixer:info`
    expect(info).to match(/Browsers:\n  Chrome: 25\n\n/)
    expect(info).to match(/  transition: webkit/)
  end
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/autoprefixer-rails-9.4.8/spec/rails_spec.rb
autoprefixer-rails-9.4.9 spec/rails_spec.rb
autoprefixer-rails-9.4.8 spec/rails_spec.rb
autoprefixer-rails-9.4.7 spec/rails_spec.rb
autoprefixer-rails-9.4.6 spec/rails_spec.rb
autoprefixer-rails-9.4.5 spec/rails_spec.rb
autoprefixer-rails-9.4.4 spec/rails_spec.rb
autoprefixer-rails-9.4.3 spec/rails_spec.rb
autoprefixer-rails-9.4.2 spec/rails_spec.rb
autoprefixer-rails-9.4.1 spec/rails_spec.rb
autoprefixer-rails-9.4.0 spec/rails_spec.rb
autoprefixer-rails-9.3.1 spec/rails_spec.rb
autoprefixer-rails-9.3.0 spec/rails_spec.rb
autoprefixer-rails-9.2.1 spec/rails_spec.rb
autoprefixer-rails-9.2.0 spec/rails_spec.rb
autoprefixer-rails-9.1.4 spec/rails_spec.rb
autoprefixer-rails-9.1.3 spec/rails_spec.rb
autoprefixer-rails-9.1.2 spec/rails_spec.rb
autoprefixer-rails-9.1.1 spec/rails_spec.rb
autoprefixer-rails-9.1.0 spec/rails_spec.rb