sinatra-pages 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -151,7 +151,7 @@ The following sites are proudly using this extension:
151
151
  If your site is also using this extension, please let us know!
152
152
 
153
153
  ### Notes
154
- This extension have been tested on the versions 1.8.6, 1.8.7 and 1.9.1 of the [Ruby interpreter][8].
154
+ This extension have been tested on [MRI][8] 1.8.6, 1.8.7, 1.9.1 and 1.9.2.
155
155
 
156
156
  ### License
157
157
  This extension is licensed under the [MIT License][9].
@@ -16,7 +16,7 @@ module Sinatra
16
16
  app.set :stylesheet, :scss
17
17
  app.set :cache, :write
18
18
  app.set :format, :tidy
19
- app.set :encoding, :utf8
19
+ app.set :encoding, :utf8 if RUBY_VERSION.to_f > 1.8
20
20
  app.disable :escaping
21
21
 
22
22
  app.configure do
@@ -75,11 +75,13 @@ module Sinatra
75
75
  options[:read_cache] = true if settings.cache == :read
76
76
  end
77
77
 
78
- options[:encoding] = case settings.encoding
79
- when :utf8 then 'utf-8'
80
- when :utf16 then 'utf-16'
81
- when :utf32 then 'utf-32'
82
- when :ascii then 'ascii-8bits'
78
+ if RUBY_VERSION.to_f > 1.8
79
+ options[:encoding] = case settings.encoding
80
+ when :utf8 then 'utf-8'
81
+ when :utf16 then 'utf-16'
82
+ when :utf32 then 'utf-32'
83
+ when :ascii then 'ascii-8bits'
84
+ end
83
85
  end
84
86
 
85
87
  options
@@ -65,7 +65,12 @@ describe Sinatra::Pages do
65
65
  its(:html) {should == :v5}
66
66
  its(:format) {should == :tidy}
67
67
  its(:escaping) {should == false}
68
- its(:haml) {should == {:format => :html5, :ugly => false, :escape_html => false}}
68
+ if RUBY_VERSION.to_f > 1.8
69
+ its(:encoding) {should == :utf8}
70
+ its(:haml) {should == {:format => :html5, :ugly => false, :escape_html => false, :encoding => 'utf-8'}}
71
+ else
72
+ its(:haml) {should == {:format => :html5, :ugly => false, :escape_html => false}}
73
+ end
69
74
  end
70
75
 
71
76
  context 'on defining' do
@@ -99,16 +104,37 @@ describe Sinatra::Pages do
99
104
  it {subject.haml[:escape_html].should == escaping}
100
105
  end
101
106
  end
107
+
108
+ if RUBY_VERSION.to_f > 1.8
109
+ [:utf8, :utf16, :utf32, :ascii].each do |encoding|
110
+ context '#encoding' do
111
+ subject {app.set :encoding, encoding}
112
+ its(:encoding) {should == encoding}
113
+ case encoding
114
+ when :utf8 then it {subject.haml[:encoding].should == 'utf-8'}
115
+ when :utf16 then it {subject.haml[:encoding].should == 'utf-16'}
116
+ when :utf32 then it {subject.haml[:encoding].should == 'utf-32'}
117
+ when :ascii then it {subject.haml[:encoding].should == 'ascii-8bits'}
118
+ end
119
+ end
120
+ end
121
+ end
102
122
  end
103
123
  end
104
124
 
105
125
  context 'SASS settings' do
106
126
  context 'by default' do
127
+ before {app.set :encoding, :utf8}
107
128
  subject {app}
108
129
  its(:stylesheet) {should == :scss}
109
130
  its(:format) {should == :tidy}
110
131
  its(:cache) {should == :write}
111
- its(:sass) {should == {:style => :expanded, :syntax => :scss, :cache => true}}
132
+ if RUBY_VERSION.to_f > 1.8
133
+ its(:encoding) {should == :utf8}
134
+ its(:sass) {should == {:style => :expanded, :syntax => :scss, :cache => true, :encoding => 'utf-8'}}
135
+ else
136
+ its(:sass) {should == {:style => :expanded, :syntax => :scss, :cache => true}}
137
+ end
112
138
  end
113
139
 
114
140
  context 'on defining' do
@@ -148,6 +174,21 @@ describe Sinatra::Pages do
148
174
  end
149
175
  end
150
176
  end
177
+
178
+ if RUBY_VERSION.to_f > 1.8
179
+ [:utf8, :utf16, :utf32, :ascii].each do |encoding|
180
+ context '#encoding' do
181
+ subject {app.set :encoding, encoding}
182
+ its(:encoding) {should == encoding}
183
+ case encoding
184
+ when :utf8 then it {subject.sass[:encoding].should == 'utf-8'}
185
+ when :utf16 then it {subject.sass[:encoding].should == 'utf-16'}
186
+ when :utf32 then it {subject.sass[:encoding].should == 'utf-32'}
187
+ when :ascii then it {subject.sass[:encoding].should == 'ascii-8bits'}
188
+ end
189
+ end
190
+ end
191
+ end
151
192
  end
152
193
  end
153
194
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-pages
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 2
10
- version: 1.5.2
9
+ - 3
10
+ version: 1.5.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julio Javier Cicchelli
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-07 00:00:00 +02:00
18
+ date: 2010-10-09 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency