rack-less 2.0.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +5 -4
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +15 -19
  4. data/README.rdoc +9 -7
  5. data/Rakefile +3 -3
  6. data/lib/rack/less/base.rb +1 -1
  7. data/lib/rack/less/config.rb +1 -1
  8. data/lib/rack/less/response.rb +4 -4
  9. data/lib/rack/less/source.rb +6 -1
  10. data/lib/rack/less/version.rb +2 -2
  11. data/rack-less.gemspec +4 -3
  12. data/test/app_helper.rb +3 -3
  13. data/test/bootstrap_test.rb +26 -0
  14. data/test/config_test.rb +112 -150
  15. data/test/fixtures/bootstrap_v1.1.0/bootstrap-1.1.0.css +1894 -0
  16. data/test/fixtures/bootstrap_v1.1.0/bootstrap.less +23 -0
  17. data/test/fixtures/bootstrap_v1.1.0/forms.less +369 -0
  18. data/test/fixtures/bootstrap_v1.1.0/patterns.less +683 -0
  19. data/test/fixtures/bootstrap_v1.1.0/preboot.less +267 -0
  20. data/test/fixtures/bootstrap_v1.1.0/reset.less +21 -0
  21. data/test/fixtures/bootstrap_v1.1.0/scaffolding.less +174 -0
  22. data/test/fixtures/bootstrap_v1.1.0/tables.less +148 -0
  23. data/test/fixtures/bootstrap_v1.1.0/type.less +185 -0
  24. data/test/fixtures/sinatra/app/stylesheets/all_compiled.css +7 -3
  25. data/test/fixtures/sinatra/app/stylesheets/nested/file_compiled.css +6 -2
  26. data/test/fixtures/sinatra/app/stylesheets/nested/nested_import.less +3 -0
  27. data/test/fixtures/sinatra/app/stylesheets/nested/really/really.less +5 -3
  28. data/test/fixtures/sinatra/app/stylesheets/nested/really/really_compiled.css +7 -2
  29. data/test/fixtures/sinatra/app/stylesheets/nested/really/really_nested_import.less +4 -0
  30. data/test/fixtures/sinatra/app/stylesheets/normal.less +1 -1
  31. data/test/fixtures/sinatra/app/stylesheets/normal_compiled.css +6 -2
  32. data/test/helper.rb +35 -38
  33. data/test/irb.rb +9 -0
  34. data/test/options_test.rb +25 -22
  35. data/test/request_test.rb +86 -74
  36. data/test/response_test.rb +6 -4
  37. data/test/sinatra_test.rb +38 -37
  38. data/test/source_test.rb +128 -114
  39. metadata +57 -34
  40. data/.bundle/config +0 -2
  41. data/test/env.rb +0 -9
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
- /pkg/
2
- /doc/
3
- /coverage/
1
+ pkg/*
2
+ .bundle
3
+ *.gem
4
4
  *.log
5
- .DS_Store
5
+ .rvmrc
6
+ .rbenv-version
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in rack-less.gemspec
4
4
  gemspec
5
+
6
+ gem "rake", "~> 0.9.2"
7
+ gem "differ"
@@ -1,37 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-less (2.0.2)
5
- less (~> 1.2)
4
+ rack-less (3.0.0)
5
+ less (~> 2.0)
6
6
  rack (~> 1.0)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- json (1.5.1)
12
- kelredd-useful (0.4.1)
13
- json
14
- leftright (0.9.0)
15
- less (1.2.21)
16
- mutter (>= 0.4.2)
17
- treetop (>= 1.4.2)
18
- mutter (0.5.3)
11
+ ansi (1.3.0)
12
+ assert (0.3.0)
13
+ ansi (~> 1.3)
14
+ differ (0.1.2)
15
+ less (2.0.6)
16
+ therubyracer (~> 0.9.2)
17
+ libv8 (3.3.10.2)
19
18
  nokogiri (1.4.4)
20
- polyglot (0.3.1)
21
19
  rack (1.2.2)
22
20
  rack-test (0.5.7)
23
21
  rack (>= 1.0)
24
- shoulda (2.11.3)
22
+ rake (0.9.2)
25
23
  sinatra (1.2.1)
26
24
  rack (~> 1.1)
27
25
  tilt (>= 1.2.2, < 2.0)
28
- test-belt (0.2.1)
29
- kelredd-useful (~> 0.4.0)
30
- leftright (~> 0.9.0)
31
- shoulda (~> 2.11)
26
+ therubyracer (0.9.4)
27
+ libv8 (~> 3.3.10)
32
28
  tilt (1.2.2)
33
- treetop (1.4.9)
34
- polyglot (>= 0.3.1)
35
29
  webrat (0.7.3)
36
30
  nokogiri (>= 1.2.0)
37
31
  rack (>= 1.0)
@@ -42,10 +36,12 @@ PLATFORMS
42
36
  ruby
43
37
 
44
38
  DEPENDENCIES
39
+ assert (~> 0.3.0)
45
40
  bundler (~> 1.0)
41
+ differ
46
42
  rack-less!
47
43
  rack-test (>= 0.5.3)
44
+ rake (~> 0.9.2)
48
45
  sinatra (>= 0.9.4)
49
- test-belt (= 0.2.1)
50
46
  webrat (>= 0.6.0)
51
47
  yui-compressor (>= 0.9.1)
@@ -4,6 +4,8 @@
4
4
 
5
5
  A better way to use LESS CSS in Ruby web apps.
6
6
 
7
+ * Update: rack-less as of v3.x.x \ uses the latest version of the ruby less parser, https://github.com/cowboyd/less.rb (based on less.js). To use the older ruby based parse, require rack-less ~> 2.0.
8
+
7
9
  == Installation
8
10
 
9
11
  $ gem install rack-less
@@ -16,7 +18,7 @@ or uses Rack::Builder to construct the application pipeline, simply require
16
18
  and use as follows:
17
19
 
18
20
  require 'rack/less'
19
-
21
+
20
22
  # optional - use as necessary
21
23
  Rack::Less.configure do |config|
22
24
  config.compress = true
@@ -49,7 +51,7 @@ Add any configs in an initializer (optional - use as necessary):
49
51
  You should now see `Rack::Less` listed in the middleware pipeline:
50
52
 
51
53
  rake middleware
52
-
54
+
53
55
  == Available Configurations
54
56
 
55
57
  * .*cache* [false]
@@ -69,7 +71,7 @@ You should now see `Rack::Less` listed in the middleware pipeline:
69
71
  - :*true* - use Time.now.to_i as the explicit value (will never cache)
70
72
  - :*nil* - change cache bust value if the file is modified (similar to Rails' stylesheet_link_tag)
71
73
  - :*<any other value>* - add the value as "foo.css?<value>"
72
-
74
+
73
75
  == Available Options
74
76
 
75
77
  * :*root* ["."]
@@ -101,7 +103,7 @@ At times, it is useful to combine multiple stylesheets and serve them as one res
101
103
 
102
104
  stylesheet_link_tag 'reset', 'common', 'app_web', :cache => 'web'
103
105
  stylesheet_link_tag 'reset', 'common', 'iui', 'app_mobile', :cache => 'mobile'
104
-
106
+
105
107
  Rack::Less uses combinations, in conjunction with the :cache config setting, to provide this function. Combinations are configured using a hash, where the key is the resource name and the value is an array of names corresponding to stylesheets to combine as the named resource. For the above example, use a configuration like this:
106
108
 
107
109
  Rack::Less.configure do |config|
@@ -115,14 +117,14 @@ and stylesheet link tags like this:
115
117
 
116
118
  # equivalent to: stylesheet_link_tag 'reset', 'common', 'app_web'
117
119
  stylesheet_link_tag Rack::Less.stylesheet('web')
118
-
120
+
119
121
  # equivalent to: stylesheet_link_tag 'reset', 'common', 'iui', 'app_mobile'
120
122
  stylesheet_link_tag Rack::Less.stylesheet('mobile')
121
-
123
+
122
124
  If you configure Rack::Less to cache, with something like this:
123
125
 
124
126
  Rack::Less.config.cache = true
125
-
127
+
126
128
  then the same stylesheet link tags behave like they have the :cache option set, respectively:
127
129
 
128
130
  # equivalent to: stylesheet_link_tag 'reset', 'common', 'app_web', :cache => 'web'
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
+ require 'assert/rake_tasks'
2
+ include Assert::RakeTasks
3
+
1
4
  require 'bundler'
2
5
  Bundler::GemHelper.install_tasks
3
6
 
4
- require 'test_belt/rake_tasks'
5
- TestBelt::RakeTasks.for :test
6
-
7
7
  task :default => :build
@@ -57,4 +57,4 @@ module Rack::Less
57
57
  end
58
58
 
59
59
  end
60
- end
60
+ end
@@ -113,4 +113,4 @@ module Rack::Less
113
113
  end
114
114
 
115
115
  end
116
- end
116
+ end
@@ -11,7 +11,7 @@ module Rack::Less
11
11
 
12
12
  # Rack response tuple accessors.
13
13
  attr_accessor :status, :headers, :body
14
-
14
+
15
15
  class << self
16
16
 
17
17
  # Calculate appropriate content_length
@@ -22,7 +22,7 @@ module Rack::Less
22
22
  body.size
23
23
  end
24
24
  end
25
-
25
+
26
26
  end
27
27
 
28
28
  # Create a Response instance given the env
@@ -36,10 +36,10 @@ module Rack::Less
36
36
  headers["Content-Type"] = Rack::Less::MIME_TYPE
37
37
  headers["Content-Length"] = self.class.content_length(body).to_s
38
38
  end
39
-
39
+
40
40
  def to_rack
41
41
  [status, headers.to_hash, body]
42
42
  end
43
43
 
44
44
  end
45
- end
45
+ end
@@ -48,7 +48,12 @@ module Rack::Less
48
48
  def compiled
49
49
  @compiled ||= begin
50
50
  compiled_css = files.collect do |file_path|
51
- Less::Engine.new(File.new(file_path)).to_css
51
+ opts = {
52
+ :paths => [ File.dirname(file_path) ],
53
+ :filename => File.basename(file_path)
54
+ }
55
+ less = File.send(File.respond_to?(:binread) ? :binread : :read, file_path.to_s)
56
+ Less::Parser.new(opts).parse(less).to_css(:compress => !!@compress)
52
57
  end.join("\n")
53
58
 
54
59
  compiled_css = case @compress
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Less
3
- VERSION = '2.0.2'
3
+ VERSION = '3.0.0'
4
4
  end
5
- end
5
+ end
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.email = ["kelly@kelredd.com"]
11
11
  s.homepage = "http://github.com/kelredd/rack-less"
12
12
  s.summary = %q{LESS CSS preprocessing for Rack apps.}
13
- s.description = %q{Use rack middleware to handle LESS CSS preprocessing. Processing happens on requests to LESS resources. This allows you to develop, check in, and deploy unprocessed LESS stylesheets and leave the processing to the middleware. Allows for optimizing by environment: never-cache, always-reprocess in development; cache, process-once in production (for example).}
13
+ s.description = %q{LESS CSS preprocessing for Rack apps.}
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -18,12 +18,13 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ["lib"]
19
19
 
20
20
  s.add_development_dependency("bundler", ["~> 1.0"])
21
- s.add_development_dependency("test-belt", ["= 0.2.1"]) # locked to a specific version for test stability
21
+ s.add_development_dependency("assert", ["~>0.3.0"])
22
+
22
23
  s.add_development_dependency("sinatra", [">= 0.9.4"])
23
24
  s.add_development_dependency("rack-test", [">= 0.5.3"])
24
25
  s.add_development_dependency("webrat", [">= 0.6.0"])
25
26
  s.add_development_dependency("yui-compressor", [">=0.9.1"])
26
27
 
27
28
  s.add_dependency("rack", ["~> 1.0"])
28
- s.add_dependency("less", ["~> 1.2"])
29
+ s.add_dependency("less", ["~> 2.0"])
29
30
  end
@@ -1,14 +1,14 @@
1
1
  require 'rack/test'
2
2
  require 'webrat'
3
3
 
4
- class Test::Unit::TestCase
4
+ class Assert::Context
5
5
  include Rack::Test::Methods
6
6
  include Webrat::Methods
7
7
  include Webrat::Matchers
8
-
8
+
9
9
  Webrat.configure do |config|
10
10
  config.mode = :rack
11
- end
11
+ end
12
12
 
13
13
  class << self
14
14
 
@@ -0,0 +1,26 @@
1
+ require "assert"
2
+ require 'rack/less/source'
3
+
4
+ require 'differ'
5
+
6
+ module Rack::Less
7
+
8
+ class BootstrapSourceTests < Assert::Context
9
+ desc 'the bootstrap less source'
10
+ setup do
11
+ @source_folder = file_path('test','fixtures', 'bootstrap_v1.1.0')
12
+ @compiled = File.read(File.join(@source_folder, "bootstrap-1.1.0.css"))
13
+ @source = Source.new('bootstrap', :folder => @source_folder)
14
+ end
15
+
16
+ should "compile correctly" do
17
+ assert_equal @compiled.strip, @source.compiled.strip, '.compiled is incorrect'
18
+ assert_equal @compiled.strip, @source.to_css.strip, '.to_css is incorrect'
19
+ assert_equal @compiled.strip, @source.css.strip, '.css is incorrect'
20
+
21
+ puts Differ.diff_by_line(@source.compiled.strip, @compiled.strip).format_as(:color)
22
+ end
23
+
24
+ end
25
+
26
+ end
@@ -1,11 +1,15 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require 'rack/less/config'
3
3
 
4
- class ConfigTest < Test::Unit::TestCase
5
- context 'Rack::Less::Config' do
6
- setup do
7
- @config = Rack::Less::Config.new
8
- end
4
+ module Rack::Less
5
+
6
+ class ConfigTests < Assert::Context
7
+ desc 'the rack-less config'
8
+ setup { @config = Config.new }
9
+ subject { @config }
10
+
11
+ should have_accessors :cache, :compress, :combinations, :cache_bust
12
+ should have_readers :cache?, :compress?
9
13
 
10
14
  { :cache => false,
11
15
  :compress => false,
@@ -15,17 +19,10 @@ class ConfigTest < Test::Unit::TestCase
15
19
  should "default #{k} correctly" do
16
20
  assert_equal v, @config.send(k)
17
21
  end
18
-
19
- should "have an accessor for #{k}" do
20
- assert_respond_to @config, k, "no reader for #{k}"
21
- assert_respond_to @config, "#{k}=".to_sym, "no writer for #{k}"
22
- end
23
22
  end
24
23
 
25
24
  should "provide boolean readers" do
26
- assert_respond_to @config, :cache?, "no reader for :cache?"
27
25
  assert_equal !!@config.cache, @config.cache?
28
- assert_respond_to @config, :compress?, "no reader for :compress?"
29
26
  assert_equal !!@config.compress, @config.compress?
30
27
  end
31
28
 
@@ -47,169 +44,134 @@ class ConfigTest < Test::Unit::TestCase
47
44
  end
48
45
 
49
46
  should "be accessible at Rack::Less class level" do
50
- assert_respond_to Rack::Less, :configure
51
- assert_respond_to Rack::Less, :config
52
- assert_respond_to Rack::Less, :config=
53
- assert_respond_to Rack::Less, :combinations
54
- assert_respond_to Rack::Less, :cache_bust
55
- assert_respond_to Rack::Less, :stylesheet
56
- end
57
-
58
- context "given a new configuration" do
59
- setup do
60
- @old_config = Rack::Less.config
61
- @settings = {
62
- :cache => true,
63
- :compress => true,
64
- :combinations => {
65
- 'all' => ['one', 'two']
66
- },
67
- :cache_bust => false
68
- }
69
- @traditional_config = Rack::Less::Config.new @settings
70
- end
71
- teardown do
72
- Rack::Less.config = @old_config
73
- end
74
-
75
- should "allow Rack::Less to directly apply settings" do
76
- Rack::Less.config = @traditional_config.dup
77
-
78
- assert_equal @traditional_config.cache, Rack::Less.config.cache
79
- assert_equal @traditional_config.compress, Rack::Less.config.compress
80
- assert_equal @traditional_config.combinations, Rack::Less.config.combinations
81
- assert_equal @traditional_config.cache_bust, Rack::Less.config.cache_bust
82
- end
83
-
84
- should "allow Rack::Less to apply settings using a block" do
85
- Rack::Less.configure do |config|
86
- config.cache = true
87
- config.compress = true
88
- config.combinations = {
89
- 'all' => ['one', 'two']
90
- }
91
- config.cache_bust = false
92
- end
93
-
94
- assert_equal @traditional_config.cache, Rack::Less.config.cache
95
- assert_equal @traditional_config.compress, Rack::Less.config.compress
96
- assert_equal @traditional_config.combinations, Rack::Less.config.combinations
97
- assert_equal @traditional_config.cache_bust, Rack::Less.config.cache_bust
98
- end
99
-
100
- context "helpers" do
101
- setup do
102
- @settings = {
103
- :combinations => {
104
- 'all' => ['one', 'two']
105
- },
106
- :cache_bust => false
107
- }
108
- end
109
-
110
- context "#combinations" do
111
- should "should be able to access it's values with a parameter" do
112
- config = Rack::Less::Config.new @settings
113
-
114
- assert_equal [], config.combinations('one')
115
- assert_equal [], config.combinations('wtf')
116
- assert_equal ['one.css', 'two.css'], config.combinations('all')
117
- end
47
+ assert_respond_to :configure, Rack::Less
48
+ assert_respond_to :config, Rack::Less
49
+ assert_respond_to :config=, Rack::Less
50
+ assert_respond_to :combinations, Rack::Less
51
+ assert_respond_to :cache_bust, Rack::Less
52
+ assert_respond_to :stylesheet, Rack::Less
53
+ end
118
54
 
119
- context "if cache setting is true" do
120
- setup do
121
- @settings[:cache] = true
122
- end
55
+ end
123
56
 
124
- should "use the lookup parameter instead of the value" do
125
- config = Rack::Less::Config.new @settings
57
+ class NewConfigTests < Assert::Context
58
+ desc "a new configuration"
59
+ setup do
60
+ @old_config = Rack::Less.config
61
+ @settings = {
62
+ :cache => true,
63
+ :compress => true,
64
+ :combinations => { 'all' => ['one', 'two'] },
65
+ :cache_bust => false
66
+ }
67
+ @traditional_config = Config.new @settings
68
+ end
69
+ teardown do
70
+ Rack::Less.config = @old_config
71
+ end
126
72
 
127
- assert_equal 'all.css', config.combinations('all')
128
- end
129
- end
73
+ should "allow Rack::Less to directly apply settings" do
74
+ Rack::Less.config = @traditional_config.dup
130
75
 
131
- end
76
+ assert_equal @traditional_config.cache, Rack::Less.config.cache
77
+ assert_equal @traditional_config.compress, Rack::Less.config.compress
78
+ assert_equal @traditional_config.combinations, Rack::Less.config.combinations
79
+ assert_equal @traditional_config.cache_bust, Rack::Less.config.cache_bust
80
+ end
132
81
 
133
- context "#stylesheet" do
134
- should "should be able to stylesheet references" do
135
- config = Rack::Less::Config.new @settings
82
+ should "allow Rack::Less to apply settings using a block" do
83
+ Rack::Less.configure do |config|
84
+ config.cache = true
85
+ config.compress = true
86
+ config.combinations = { 'all' => ['one', 'two'] }
87
+ config.cache_bust = false
88
+ end
136
89
 
137
- assert_equal 'one.css', config.stylesheet('one')
138
- assert_equal 'wtf.css', config.stylesheet('wtf')
139
- end
90
+ assert_equal @traditional_config.cache, Rack::Less.config.cache
91
+ assert_equal @traditional_config.compress, Rack::Less.config.compress
92
+ assert_equal @traditional_config.combinations, Rack::Less.config.combinations
93
+ assert_equal @traditional_config.cache_bust, Rack::Less.config.cache_bust
94
+ end
140
95
 
141
- should "should be able to access combination values with a parameter" do
142
- config = Rack::Less::Config.new @settings
96
+ end
143
97
 
144
- assert_equal ['one.css', 'two.css'], config.stylesheet('all')
145
- end
98
+ class ConfigCombinationStylesheetTests < ConfigTests
99
+ desc "a rack less config"
100
+ setup do
101
+ @settings = {
102
+ :combinations => { 'all' => ['one', 'two'] },
103
+ :cache_bust => false
104
+ }
105
+ @config = Rack::Less::Config.new @settings
106
+ end
146
107
 
147
- context "if cache setting is true" do
148
- setup do
149
- @settings[:cache] = true
150
- end
108
+ should "access #combinations by name" do
109
+ assert_equal [], @config.combinations('one')
110
+ assert_equal [], @config.combinations('wtf')
111
+ assert_equal ['one.css', 'two.css'], @config.combinations('all')
112
+ end
151
113
 
152
- should "use the lookup parameter instead of the value" do
153
- config = Rack::Less::Config.new @settings
114
+ should "generate #stylesheet references by name" do
115
+ assert_equal 'one.css', @config.stylesheet('one')
116
+ assert_equal 'wtf.css', @config.stylesheet('wtf')
117
+ assert_equal ['one.css', 'two.css'], @config.stylesheet('all')
118
+ end
154
119
 
155
- assert_equal 'one.css', config.stylesheet('one')
156
- assert_equal 'all.css', config.stylesheet('all')
157
- end
158
- end
120
+ end
159
121
 
160
- context "when cache_bust is false" do
161
- setup do
162
- @settings[:cache_bust] = false
163
- end
122
+ class CachedConfigComboStylesheetTests < ConfigCombinationStylesheetTests
123
+ desc "when cache setting is true"
124
+ setup do
125
+ @settings[:cache] = true
126
+ @config = Rack::Less::Config.new @settings
127
+ end
164
128
 
165
- should "should not put in a cache bust value" do
166
- config = Rack::Less::Config.new @settings
129
+ should "use the lookup combos and stylesheets by the cache name" do
130
+ assert_equal 'all.css', @config.combinations('all')
167
131
 
168
- assert_equal 'one.css', config.stylesheet('one')
169
- end
170
- end
132
+ assert_equal 'one.css', @config.stylesheet('one')
133
+ assert_equal 'all.css', @config.stylesheet('all')
134
+ end
171
135
 
172
- context "when cache_bust is nil" do
173
- setup do
174
- @settings[:cache_bust] = nil
175
- end
136
+ end
176
137
 
177
- should "should not put in a cache bust value" do
178
- config = Rack::Less::Config.new @settings
138
+ class ConfigCacheBustTests < ConfigCombinationStylesheetTests
179
139
 
180
- assert_equal 'one.css', config.stylesheet('one')
181
- end
182
- end
140
+ should "should not put in a cache bust value when cache_bust is false" do
141
+ @settings[:cache_bust] = false
142
+ config = Rack::Less::Config.new @settings
183
143
 
184
- context "when cache_bust is true" do
185
- setup do
186
- @settings[:cache_bust] = true
187
- end
144
+ assert_equal 'one.css', config.stylesheet('one')
145
+ end
188
146
 
189
- should "always put a timestamp value on the end of the href" do
190
- config = Rack::Less::Config.new @settings
147
+ should "should not put in a cache bust value when cache_bust is nil" do
148
+ @settings[:cache_bust] = nil
149
+ config = Rack::Less::Config.new @settings
191
150
 
192
- assert_match /one.css\?[0-9]+/, config.stylesheet('one')
193
- end
194
- end
151
+ assert_equal 'one.css', config.stylesheet('one')
152
+ end
195
153
 
196
- context "when timestamp specified" do
197
- setup do
198
- @stamp = Time.now.to_i - 100_000
199
- @settings[:cache_bust] = @stamp
200
- end
154
+ should "always put a timestamp value on the end of the href when cache_bust is true" do
155
+ @settings[:cache_bust] = true
156
+ config = Rack::Less::Config.new @settings
201
157
 
202
- should "always use that timestamp" do
203
- config = Rack::Less::Config.new @settings
158
+ assert_match /one.css\?[0-9]+/, config.stylesheet('one')
159
+ end
204
160
 
205
- assert_equal ["one.css?#{@stamp}", "two.css?#{@stamp}"], config.stylesheet('all')
206
- end
161
+ end
207
162
 
208
- end
209
- end
163
+ class ConfigTimeStampTests < ConfigCombinationStylesheetTests
164
+ desc "when timestamp specified"
165
+ setup do
166
+ @stamp = Time.now.to_i - 100_000
167
+ @settings[:cache_bust] = @stamp
168
+ @config = Rack::Less::Config.new @settings
169
+ end
210
170
 
211
- end
171
+ should "always use that timestamp" do
172
+ assert_equal ["one.css?#{@stamp}", "two.css?#{@stamp}"], @config.stylesheet('all')
212
173
  end
213
174
 
214
175
  end
176
+
215
177
  end