haml-edge 3.1.37 → 3.1.38

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.37
1
+ 3.1.38
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.37
1
+ 3.1.38
data/lib/haml/util.rb CHANGED
@@ -291,42 +291,22 @@ module Haml
291
291
  #
292
292
  # @return [Boolean]
293
293
  def ap_geq_3?
294
- # The ActionPack module is always loaded automatically in Rails >= 3
295
- return false unless defined?(ActionPack) && defined?(ActionPack::VERSION)
296
-
297
- version =
298
- if defined?(ActionPack::VERSION::MAJOR)
299
- ActionPack::VERSION::MAJOR
300
- else
301
- # Rails 1.2
302
- ActionPack::VERSION::Major
303
- end
304
-
305
- version >= 3
294
+ ap_geq?("3.0.0.beta1")
306
295
  end
307
296
 
308
297
  # Returns whether this environment is using ActionPack
309
- # version 3.0.0.beta.3 or greater.
298
+ # of a version greater than or equal to that specified.
310
299
  #
300
+ # @param version [String] The string version number to check against.
301
+ # Should be greater than or equal to Rails 3,
302
+ # because otherwise ActionPack::VERSION isn't autoloaded
311
303
  # @return [Boolean]
312
- def ap_geq_3_beta_3?
304
+ def ap_geq?(version)
313
305
  # The ActionPack module is always loaded automatically in Rails >= 3
314
- return false unless defined?(ActionPack) && defined?(ActionPack::VERSION)
306
+ return false unless defined?(ActionPack) && defined?(ActionPack::VERSION) &&
307
+ defined?(ActionPack::VERSION::STRING)
315
308
 
316
- version =
317
- if defined?(ActionPack::VERSION::MAJOR)
318
- ActionPack::VERSION::MAJOR
319
- else
320
- # Rails 1.2
321
- ActionPack::VERSION::Major
322
- end
323
- version >= 3 &&
324
- ((defined?(ActionPack::VERSION::TINY) &&
325
- ActionPack::VERSION::TINY.is_a?(Fixnum) &&
326
- ActionPack::VERSION::TINY >= 1) ||
327
- (defined?(ActionPack::VERSION::BUILD) &&
328
- ActionPack::VERSION::BUILD =~ /beta(\d+)/ &&
329
- $1.to_i >= 3))
309
+ ActionPack::VERSION::STRING >= version
330
310
  end
331
311
 
332
312
  # Returns an ActionView::Template* class.
@@ -165,9 +165,10 @@ HAML
165
165
 
166
166
  def test_content_tag_error_wrapping
167
167
  def @base.protect_against_forgery?; false; end
168
+ error_class = Haml::Util.ap_geq?("3.0.0.beta4") ? "field_with_errors" : "fieldWithErrors"
168
169
  assert_equal(<<HTML, render(<<HAML, :action_view))
169
170
  <form action="" method="post">
170
- <div class="fieldWithErrors"><label for="post_error_field">Error field</label></div>
171
+ <div class="#{error_class}"><label for="post_error_field">Error field</label></div>
171
172
  </form>
172
173
  HTML
173
174
  #{rails_block_helper_char} form_for #{form_for_calling_convention('post')}, :url => '' do |f|
@@ -314,7 +315,8 @@ HAML
314
315
  end
315
316
 
316
317
  def test_indented_capture
317
- assert_equal(" \n Foo\n ", @base.render(:inline => " <% res = capture do %>\n Foo\n <% end %><%= res %>"))
318
+ prior = Haml::Util.ap_geq?("3.0.0.beta4") ? "" : " \n"
319
+ assert_equal("#{prior} Foo\n ", @base.render(:inline => " <% res = capture do %>\n Foo\n <% end %><%= res %>"))
318
320
  end
319
321
 
320
322
  def test_capture_deals_properly_with_collections
@@ -62,7 +62,7 @@ click
62
62
  <input id="article_body" name="article[body]" size="30" type="text" value="World" />
63
63
  </form>
64
64
  </div>
65
- - elsif Haml::Util.ap_geq_3_beta_3?
65
+ - elsif Haml::Util.ap_geq?("3.0.0.beta3")
66
66
  %p
67
67
  = form_tag ''
68
68
  %div
data/test/test_helper.rb CHANGED
@@ -65,7 +65,7 @@ class Test::Unit::TestCase
65
65
  end
66
66
 
67
67
  def form_for_calling_convention(name)
68
- return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.ap_geq_3_beta_3?
68
+ return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.ap_geq?("3.0.0.beta3")
69
69
  return ":#{name}, @#{name}"
70
70
  end
71
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.37
4
+ version: 3.1.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2010-06-07 00:00:00 -04:00
14
+ date: 2010-06-08 00:00:00 -04:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency