Sha256: 9c072ea5d054454f6d8e0a90120d012fbcae01a22826db8c0bc64a5c878e6581

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the MIT license.

require File.expand_path('../../../../spec/helper', __FILE__)
spec_require 'haml/util', 'sass'

Ramaze::App.options.views = 'sass'

class SpecSass < Ramaze::Controller
  map '/'
  provide :css, :Sass

  def style
%{
body
  :margin 1em

  #content
    :text-align center
}
  end
end

class SpecSassOptions < Ramaze::Controller
  map '/options'
  provide :css, :Sass
  trait :sass_options => { :style => :compact }

  def test
%{
body
  margin: 1em

  #content
    font:
      family: monospace
      size: 10pt
}
  end
end

describe Ramaze::View::Sass do
  behaves_like :rack_test

  should 'render inline' do
    got = get('/style.css')
    got.status.should == 200
    got['Content-Type'].should == 'text/css'
    got.body.strip.should ==
"body {
  margin: 1em; }
  body #content {
    text-align: center; }"
  end

  should 'render from file' do
    got = get('/file.css')
    got.status.should == 200
    got['Content-Type'].should == 'text/css'
    got.body.strip.should ==
"body {
  margin: 1em; }
  body #content {
    text-align: center; }"
  end

  should 'use sass options' do
    got = get('/options/test.css')
    got.status.should == 200
    got['Content-Type'].should == 'text/css'
    got.body.should.not =~ /^ +/
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-2023.01.06 spec/ramaze/view/sass.rb
ramaze-2012.12.08 spec/ramaze/view/sass.rb
ramaze-2012.12.08b spec/ramaze/view/sass.rb
ramaze-2012.04.14 spec/ramaze/view/sass.rb
ramaze-2012.03.07 spec/ramaze/view/sass.rb