haml-edge 2.3.35 → 2.3.36

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
- 2.3.35
1
+ 2.3.36
data/Rakefile CHANGED
@@ -22,6 +22,7 @@ Rake::TestTask.new do |t|
22
22
  t.libs << 'lib'
23
23
  test_files = FileList['test/**/*_test.rb']
24
24
  test_files.exclude('test/rails/*')
25
+ test_files.exclude('test/haml/spec/*')
25
26
  t.test_files = test_files
26
27
  t.verbose = true
27
28
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.35
1
+ 2.3.36
@@ -9,24 +9,36 @@ end
9
9
  class SpecTest < Test::Unit::TestCase
10
10
  spec_file = File.dirname(__FILE__) + '/spec/tests.json'
11
11
  if !File.exists?(spec_file)
12
- warn <<MSG
12
+ error = <<MSG.rstrip
13
13
  Couldn't load haml-spec, skipping some tests.
14
14
  To use haml-spec, run `git submodule update --init`
15
15
  MSG
16
16
  elsif !defined?(JSON)
17
- warn "Couldn't load json, skipping some tests."
17
+ error = "Couldn't load json, skipping some tests."
18
+ end
19
+
20
+ if error
21
+ define_method(:test_fake_couldnt_load_spec) {warn("\n" + error)}
18
22
  else
19
23
  JSON.parse(File.read(spec_file)).each do |name, tests|
20
- define_method("test_spec: #{name}") do
21
- tests.each do |haml, html|
22
- result = Haml::Engine.new(haml, :locals => [:var]).render(
23
- Object.new,
24
- :var => "value",
25
- :first => "a",
26
- :last => "z")
27
- assert_equal(html, result.rstrip)
24
+ tests.each do |subname, test|
25
+ define_method("test_spec: #{name} (#{subname})") do
26
+ options = convert_hash(test["config"])
27
+ options[:format] = options[:format].to_sym if options[:format]
28
+ engine = Haml::Engine.new(test["haml"], options)
29
+
30
+ result = engine.render(Object.new, convert_hash(test["locals"]))
31
+
32
+ assert_equal(test["html"], result.rstrip)
28
33
  end
29
34
  end
30
35
  end
31
36
  end
37
+
38
+ private
39
+
40
+ def convert_hash(hash)
41
+ return {} unless hash
42
+ Haml::Util.map_keys(hash) {|k| k.to_sym}
43
+ end
32
44
  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: 2.3.35
4
+ version: 2.3.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-18 00:00:00 -04:00
13
+ date: 2009-09-20 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency