Drop support for Stylus (#1697)
This commit is contained in:
parent
44ce685218
commit
9dede30f5d
1
Gemfile
1
Gemfile
|
@ -54,7 +54,6 @@ if RUBY_ENGINE == "ruby"
|
|||
gem 'radius'
|
||||
gem 'asciidoctor'
|
||||
gem 'liquid'
|
||||
gem 'stylus'
|
||||
gem 'rabl'
|
||||
gem 'builder'
|
||||
gem 'erubi'
|
||||
|
|
38
README.de.md
38
README.de.md
|
@ -69,7 +69,6 @@ diesen Server verwenden.
|
|||
- [Creole Templates](#creole-templates)
|
||||
- [MediaWiki Templates](#mediawiki-templates)
|
||||
- [CoffeeScript Templates](#coffeescript-templates)
|
||||
- [Stylus Templates](#stylus-templates)
|
||||
- [Yajl Templates](#yajl-templates)
|
||||
- [WLang Templates](#wlang-templates)
|
||||
+ [Auf Variablen in Templates zugreifen](#auf-variablen-in-templates-zugreifen)
|
||||
|
@ -1052,43 +1051,6 @@ Layout, indem die `:layout_engine`-Option verwendet wird.
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Stylus Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Abhängigkeit</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> und eine Möglichkeit
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
JavaScript auszuführen
|
||||
</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dateierweiterung</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Beispiel</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Um Stylus-Templates ausführen zu können, müssen `stylus` und `stylus/tilt`
|
||||
zuerst geladen werden:
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :example
|
||||
end
|
||||
```
|
||||
|
||||
#### Yajl Templates
|
||||
|
||||
<table>
|
||||
|
|
37
README.es.md
37
README.es.md
|
@ -67,7 +67,6 @@ Se recomienda ejecutar `gem install puma`, porque Sinatra lo utilizará si está
|
|||
* [Plantillas Creole](#plantillas-creole)
|
||||
* [Plantillas MediaWiki](#mediawiki-templates)
|
||||
* [Plantillas CofeeScript](#plantillas-coffeescript)
|
||||
* [Plantillas Stylus](#plantillas-stylus)
|
||||
* [Plantillas Yajl](#plantillas-yajl)
|
||||
* [Plantillas Wlang](#plantillas-wlang)
|
||||
* [Accediendo Variables en Plantillas](#accediendo-a-variables-en-plantillas)
|
||||
|
@ -1048,42 +1047,6 @@ De todas maneras, es posible usar otro motor de renderizado para esa plantilla p
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Plantillas Stylus
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependencias</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> y un
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
mecanismo para ejecutar javascript
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensiones de Archivo</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ejemplo</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Antes de poder usar las plantillas de Stylus, necesitas cargar `stylus` y `stylus/tilt`:
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :example
|
||||
end
|
||||
```
|
||||
|
||||
#### Plantillas Yajl
|
||||
|
||||
<table>
|
||||
|
|
39
README.fr.md
39
README.fr.md
|
@ -67,7 +67,6 @@ Sinatra utilise le server Thin quand il est disponible.
|
|||
* [Templates Creole](#templates-creole)
|
||||
* [Templates MediaWiki](#templates-mediawiki)
|
||||
* [Templates CoffeeScript](#templates-coffeescript)
|
||||
* [Templates Stylus](#templates-stylus)
|
||||
* [Templates Yajl](#templates-yajl)
|
||||
* [Templates WLang](#templates-wlang)
|
||||
* [Accéder aux variables dans un Template](#accéder-aux-variables-dans-un-template)
|
||||
|
@ -1059,44 +1058,6 @@ pour le layout en utilisant l’option `:layout_engine`.
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Templates Stylus
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dépendances</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a>
|
||||
et un
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
moyen d'exécuter javascript
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensions de fichier</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exemple</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Avant de pouvoir utiliser des templates Stylus, vous devez auparavant charger
|
||||
`stylus` et `stylus/tilt` :
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :exemple
|
||||
end
|
||||
```
|
||||
|
||||
#### Templates Yajl
|
||||
|
||||
<table>
|
||||
|
|
37
README.ja.md
37
README.ja.md
|
@ -64,7 +64,6 @@ PumaがあればSinatraはこれを利用するので、`gem install puma`する
|
|||
* [Creole テンプレート](#creole-テンプレート)
|
||||
* [MediaWiki テンプレート](#mediawiki-テンプレート)
|
||||
* [CoffeeScript テンプレート](#coffeescript-テンプレート)
|
||||
* [Stylus テンプレート](#stylus-テンプレート)
|
||||
* [Yajl テンプレート](#yajl-テンプレート)
|
||||
* [WLang テンプレート](#wlang-テンプレート)
|
||||
* [テンプレート内での変数へのアクセス](#テンプレート内での変数へのアクセス)
|
||||
|
@ -958,42 +957,6 @@ erb :overview, :locals => { :text => mediawiki(:introduction) }
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Stylus テンプレート
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>依存</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> および
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
JavaScriptの起動方法
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ファイル拡張子</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Stylusテンプレートを使えるようにする前に、まず`stylus`と`stylus/tilt`を読み込む必要があります。
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :example
|
||||
end
|
||||
```
|
||||
|
||||
#### Yajl テンプレート
|
||||
|
||||
<table>
|
||||
|
|
38
README.ko.md
38
README.ko.md
|
@ -62,7 +62,6 @@ thin이 설치되어 있을 경우 Sinatra는 thin을 통해 실행합니다.
|
|||
* [Creole 템플릿](#creole-템플릿)
|
||||
* [MediaWiki 템플릿](#mediawiki-템플릿)
|
||||
* [CoffeeScript 템플릿](#coffeescript-템플릿)
|
||||
* [Stylus 템플릿](#stylus-템플릿)
|
||||
* [Yajl 템플릿](#yajl-템플릿)
|
||||
* [WLang 템플릿](#wlang-템플릿)
|
||||
* [템플릿에서 변수에 접근하기](#템플릿에서-변수에-접근하기)
|
||||
|
@ -967,43 +966,6 @@ MediaWiki에서 루비를 호출할 수 없기 때문에, MediaWiki으로 작성
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Stylus 템플릿
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>의존성</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> 와
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
자바스크립트 실행법
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>파일 확장자</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>예제</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Stylus 템플릿을 사용가능하게 하려면, 먼저 `stylus`와 `stylus/tilt`를 로드
|
||||
해야합니다.
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :example
|
||||
end
|
||||
```
|
||||
|
||||
#### Yajl 템플릿
|
||||
|
||||
<table>
|
||||
|
|
|
@ -66,7 +66,6 @@ View at: [http://localhost:4567](http://localhost:4567)
|
|||
* [Creole ടെംപ്ലേറ്റ്സ്](#creole-templates)
|
||||
* [MediaWiki ടെംപ്ലേറ്റ്സ്](#mediawiki-templates)
|
||||
* [CoffeeScript ടെംപ്ലേറ്റ്സ്](#coffeescript-templates)
|
||||
* [Stylus ടെംപ്ലേറ്റ്സ്](#stylus-templates)
|
||||
* [Yajl ടെംപ്ലേറ്റ്സ്](#yajl-templates)
|
||||
* [WLang ടെംപ്ലേറ്റ്സ്](#wlang-templates)
|
||||
* [വാരിയബിൾസിനെ എടുക്കാൻ സഹായിക്കുന്ന ടെംപ്ലേറ്റ്സ്](#accessing-variables-in-templates)
|
||||
|
@ -1015,43 +1014,6 @@ template than for the layout by passing the `:layout_engine` option.
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Stylus Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> and a
|
||||
<a href="https://github.com/sstephenson/execjs" title="ExecJS">
|
||||
way to execute javascript
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Before being able to use Stylus templates, you need to load `stylus` and
|
||||
`stylus/tilt` first:
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :example
|
||||
end
|
||||
```
|
||||
|
||||
#### Yajl Templates
|
||||
|
||||
<table>
|
||||
|
|
38
README.md
38
README.md
|
@ -68,7 +68,6 @@ pick up if available.
|
|||
* [Creole Templates](#creole-templates)
|
||||
* [MediaWiki Templates](#mediawiki-templates)
|
||||
* [CoffeeScript Templates](#coffeescript-templates)
|
||||
* [Stylus Templates](#stylus-templates)
|
||||
* [Yajl Templates](#yajl-templates)
|
||||
* [WLang Templates](#wlang-templates)
|
||||
* [Accessing Variables in Templates](#accessing-variables-in-templates)
|
||||
|
@ -1044,43 +1043,6 @@ template than for the layout by passing the `:layout_engine` option.
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Stylus Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> and a
|
||||
<a href="https://github.com/sstephenson/execjs" title="ExecJS">
|
||||
way to execute javascript
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Before being able to use Stylus templates, you need to load `stylus` and
|
||||
`stylus/tilt` first:
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :example
|
||||
end
|
||||
```
|
||||
|
||||
#### Yajl Templates
|
||||
|
||||
<table>
|
||||
|
|
|
@ -76,7 +76,6 @@ disponível, o Sinatra irá utilizá-la.
|
|||
* [Creole Templates](#creole-templates)
|
||||
* [MediaWiki Templates](#mediawiki-templates)
|
||||
* [CoffeeScript Templates](#coffeescript-templates)
|
||||
* [Stylus Templates](#stylus-templates)
|
||||
* [Yajl Templates](#yajl-templates)
|
||||
* [WLang Templates](#wlang-templates)
|
||||
* [Acessando Variáveis nos Templates](#acessando-variáveis-nos-templates)
|
||||
|
@ -1084,43 +1083,6 @@ deve-se passar a `:layout_engine` como opção.
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Stylus Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependência</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> and a
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
way to execute javascript
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensão do Arquivo</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exemplo</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Antes que você possa utilizar o template Stylus primeiro você deve carregar
|
||||
`stylus` e `stylus/tilt`:
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :exemplo
|
||||
end
|
||||
```
|
||||
|
||||
#### Yajl Templates
|
||||
|
||||
<table>
|
||||
|
|
38
README.ru.md
38
README.ru.md
|
@ -70,7 +70,6 @@ ruby myapp.rb
|
|||
* [Creole шаблоны](#creole-шаблоны)
|
||||
* [MediaWiki шаблоны](#mediawiki-шаблоны)
|
||||
* [CoffeeScript шаблоны](#coffeescript-шаблоны)
|
||||
* [Stylus шаблоны](#stylus-шаблоны)
|
||||
* [Yajl шаблоны](#yajl-шаблоны)
|
||||
* [WLang шаблоны](#wlang-шаблоны)
|
||||
* [Доступ к переменным в шаблонах](#Доступ-к-переменным-в-шаблонах)
|
||||
|
@ -1051,43 +1050,6 @@ erb :overview, :locals => { :text => mediawiki(:introduction) }
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Stylus шаблоны
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Зависимости</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> и
|
||||
<a href="https://github.com/sstephenson/execjs" title="ExecJS">
|
||||
способ запускать JavaScript
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Расширение файла</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Пример</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Перед тем, как использовать шаблоны Stylus, необходимо сперва подключить
|
||||
`stylus` и `stylus/tilt`:
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :example
|
||||
end
|
||||
```
|
||||
|
||||
#### Yajl шаблоны
|
||||
|
||||
<table>
|
||||
|
|
37
README.zh.md
37
README.zh.md
|
@ -61,7 +61,6 @@ ruby myapp.rb
|
|||
* [Creole 模板](#creole-模板)
|
||||
* [MediaWiki 模板](#mediawiki-模板)
|
||||
* [CoffeeScript 模板](#coffeescript-模板)
|
||||
* [Stylus 模板](#stylus-模板)
|
||||
* [Yajl 模板](#yajl-模板)
|
||||
* [WLang 模板](#wlang-模板)
|
||||
* [在模板中访问变量](#在模板中访问变量)
|
||||
|
@ -966,42 +965,6 @@ erb :overview, :locals => { :text => mediawiki(:introduction) }
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Stylus 模板
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>依赖项</td>
|
||||
<td>
|
||||
<a href="https://github.com/forgecrafted/ruby-stylus" title="Ruby Stylus">
|
||||
Stylus
|
||||
</a> 以及一种
|
||||
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
|
||||
执行 JavaScript 的方式
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>文件扩展名</td>
|
||||
<td><tt>.styl</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例子</td>
|
||||
<td><tt>stylus :index</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
在使用 Stylus 模板之前,你需要先加载 `stylus` 和 `stylus/tilt`:
|
||||
|
||||
```ruby
|
||||
require 'sinatra'
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
get '/' do
|
||||
stylus :example
|
||||
end
|
||||
```
|
||||
|
||||
#### Yajl 模板
|
||||
|
||||
<table>
|
||||
|
|
|
@ -729,11 +729,6 @@ module Sinatra
|
|||
render :less, template, options, locals
|
||||
end
|
||||
|
||||
def stylus(template, options = {}, locals = {})
|
||||
options.merge! :layout => false, :default_content_type => :css
|
||||
render :styl, template, options, locals
|
||||
end
|
||||
|
||||
def builder(template = nil, options = {}, locals = {}, &block)
|
||||
options[:default_content_type] = :xml
|
||||
render_ruby(:builder, template, options, locals, &block)
|
||||
|
|
|
@ -227,7 +227,7 @@ module Sinatra
|
|||
ALLOWED_ENGINES = [
|
||||
:erb, :erubi, :erubis, :haml, :hamlit, :builder, :nokogiri, :sass, :scss,
|
||||
:less, :liquid, :markdown, :textile, :rdoc, :asciidoc, :radius, :markaby,
|
||||
:rabl, :slim, :creole, :mediawiki, :coffee, :stylus, :yajl, :wlang
|
||||
:rabl, :slim, :creole, :mediawiki, :coffee, :yajl, :wlang
|
||||
]
|
||||
|
||||
def self.prefixed(*names)
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
require File.expand_path('../helper', __FILE__)
|
||||
|
||||
begin
|
||||
require 'stylus'
|
||||
require 'stylus/tilt'
|
||||
|
||||
begin
|
||||
Stylus.compile '1'
|
||||
rescue RuntimeError
|
||||
raise LoadError, 'unable to find Stylus compiler'
|
||||
end
|
||||
|
||||
class StylusTest < Minitest::Test
|
||||
def stylus_app(options = {}, &block)
|
||||
mock_app do
|
||||
set :views, __dir__ + '/views'
|
||||
set(options)
|
||||
get('/', &block)
|
||||
end
|
||||
get '/'
|
||||
end
|
||||
|
||||
it 'renders inline Stylus strings' do
|
||||
stylus_app { stylus "a\n margin auto\n" }
|
||||
assert ok?
|
||||
assert body.include?("a {\n margin: auto;\n}\n")
|
||||
end
|
||||
|
||||
it 'defaults content type to css' do
|
||||
stylus_app { stylus :hello }
|
||||
assert ok?
|
||||
assert_equal "text/css;charset=utf-8", response['Content-Type']
|
||||
end
|
||||
|
||||
it 'defaults allows setting content type per route' do
|
||||
stylus_app do
|
||||
content_type :html
|
||||
stylus :hello
|
||||
end
|
||||
assert ok?
|
||||
assert_equal "text/html;charset=utf-8", response['Content-Type']
|
||||
end
|
||||
|
||||
it 'defaults allows setting content type globally' do
|
||||
stylus_app(:styl => { :content_type => 'html' }) do
|
||||
stylus :hello
|
||||
end
|
||||
assert ok?
|
||||
assert_equal "text/html;charset=utf-8", response['Content-Type']
|
||||
end
|
||||
|
||||
it 'renders .styl files in views path' do
|
||||
stylus_app { stylus :hello }
|
||||
assert ok?
|
||||
assert_include body, "a {\n margin: auto;\n}\n"
|
||||
end
|
||||
|
||||
it 'ignores the layout option' do
|
||||
stylus_app { stylus :hello, :layout => :layout2 }
|
||||
assert ok?
|
||||
assert_include body, "a {\n margin: auto;\n}\n"
|
||||
end
|
||||
|
||||
it "raises error if template not found" do
|
||||
mock_app {
|
||||
get('/') { stylus :no_such_template }
|
||||
}
|
||||
assert_raises(Errno::ENOENT) { get('/') }
|
||||
end
|
||||
|
||||
it "passes stylus options to the stylus engine" do
|
||||
stylus_app { stylus :hello, :no_wrap => true }
|
||||
assert ok?
|
||||
assert_body "a {\n margin: auto;\n}\n"
|
||||
end
|
||||
|
||||
it "passes default stylus options to the stylus engine" do
|
||||
mock_app do
|
||||
set :stylus, :no_wrap => true # default stylus style is :nested
|
||||
get('/') { stylus :hello }
|
||||
end
|
||||
get '/'
|
||||
assert ok?
|
||||
assert_body "a {\n margin: auto;\n}\n"
|
||||
end
|
||||
end
|
||||
|
||||
rescue LoadError
|
||||
warn "#{$!}: skipping stylus tests"
|
||||
end
|
Loading…
Reference in New Issue