Sha256: 5a619d231478bd20ac8adff9e1d378d4f9f1c46b8bc82be039222924a9dd8b52

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

require File.expand_path('../spec_helper', __FILE__)

describe CssController, type: :controller do
  after :all do
    Rails.root.join('tmp').rmtree
    Rails.root.join('log').rmtree
  end

  it "inlines assets" do
    get :test, file: 'inline'
    expect(response).to be_success
    expect(response.body).to eq ".icon{background:#{INLINE}}\n"
  end

  it "raises error on unknown file" do
    expect {
      get :test, file: 'wrong-inline'
    }.to raise_error(/Can't find asset no\.png/)
  end

  it "gets image size" do
    get :test, file: 'size'
    expect(response).to be_success
    expect(response.body).to eq ".icon{width:4px;height:6px}\n"
  end

  it "gets image size by mixin" do
    get :test, file: 'image-size'
    expect(response).to be_success
    expect(response.body).to eq ".icon{width:4px;height:6px}\n"
  end

  it "has hidpi-background mixin" do
    get :test, file: 'hidpi-background'
    expect(response).to be_success
    expect(response.body).to eq ".icon{" +
      "background-image:url(/assets/monolith.png);" +
      "background-size:2px 3px}\n"
  end

  it "has hidpi-image mixin" do
    get :test, file: 'hidpi-image'
    expect(response).to be_success
    expect(response.body).to eq ".icon{" +
      "width:2px;height:3px;" +
      "background-image:url(/assets/monolith.png);" +
      "background-size:2px 3px;" +
      "background-repeat:no-repeat}\n"
  end

  it "has hidpi-inline mixin" do
    get :test, file: 'hidpi-inline'
    expect(response).to be_success
    expect(response.body).to eq ".icon{" +
      "width:2px;height:3px;" +
      "background:#{INLINE} no-repeat;" +
      "background-size:2px 3px}\n"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-sass-images-1.0.0 spec/rails_spec.rb
rails-sass-images-0.6 spec/rails_spec.rb