sablon 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,17 +17,17 @@ class SablonTest < Sablon::TestCase
17
17
  position = Struct.new(:duration, :label, :description)
18
18
  language = Struct.new(:name, :skill)
19
19
  context = {
20
- "current_time" => Time.now.strftime("%d.%m.%Y %H:%M"),
21
- "author" => "Yves Senn",
22
- "title" => "Letter of application",
23
- "person" => person,
24
- "items" => [item.new("1.", "Ruby", "★" * 5), item.new("2.", "Java", "★" * 1), item.new("3.", "Python", "★" * 3)],
25
- "career" => [position.new("1999 - 2006", "Junior Java Engineer", "Lorem ipsum dolor\nsit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."),
26
- position.new("2006 - 2013", "Senior Ruby Developer", "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo."),
27
- position.new("2013 - today", "Sales...", nil)],
28
- "technologies" => ["HTML", "CSS", "SASS", "LESS", "JavaScript"],
29
- "languages" => [language.new("German", "native speaker"), language.new("English", "fluent")],
30
- "training" => "At vero eos et accusam et justo duo dolores et ea rebum.\n\nStet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
20
+ current_time: Time.now.strftime("%d.%m.%Y %H:%M"),
21
+ author: "Yves Senn",
22
+ title: "Letter of application",
23
+ person: person,
24
+ items: [item.new("1.", "Ruby", "★" * 5), item.new("2.", "Java", "★" * 1), item.new("3.", "Python", "★" * 3)],
25
+ career: [position.new("1999 - 2006", "Junior Java Engineer", "Lorem ipsum dolor\nsit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."),
26
+ position.new("2006 - 2013", "Senior Ruby Developer", "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo."),
27
+ position.new("2013 - today", "Sales...", nil)],
28
+ technologies: ["HTML", "CSS", "SASS", "LESS", "JavaScript"],
29
+ languages: [language.new("German", "native speaker"), language.new("English", "fluent")],
30
+ training: "At vero eos et accusam et justo duo dolores et ea rebum.\n\nStet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
31
31
  }
32
32
  properties = {
33
33
  start_page_number: 7
@@ -0,0 +1,9 @@
1
+ module XMLSnippets
2
+ def snippet(name)
3
+ File.read(File.expand_path("#{name}.xml", snippet_path))
4
+ end
5
+
6
+ def snippet_path
7
+ @snippet_path ||= File.expand_path("../../fixtures/xml", __FILE__)
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sablon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yves Senn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-14 00:00:00.000000000 Z
11
+ date: 2014-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -123,12 +123,25 @@ files:
123
123
  - test/expression_test.rb
124
124
  - test/fixtures/sablon_sample.docx
125
125
  - test/fixtures/sablon_template.docx
126
+ - test/fixtures/xml/complex_field.xml
127
+ - test/fixtures/xml/conditional.xml
128
+ - test/fixtures/xml/conditional_with_predicate.xml
129
+ - test/fixtures/xml/conditional_without_ending.xml
130
+ - test/fixtures/xml/edited_complex_field.xml
131
+ - test/fixtures/xml/loop_without_ending.xml
132
+ - test/fixtures/xml/paragraph_loop.xml
133
+ - test/fixtures/xml/paragraph_loop_within_table_cell.xml
134
+ - test/fixtures/xml/simple_field.xml
135
+ - test/fixtures/xml/simple_fields.xml
136
+ - test/fixtures/xml/table_multi_row_loop.xml
137
+ - test/fixtures/xml/table_row_loop.xml
126
138
  - test/mail_merge_parser_test.rb
127
139
  - test/processor_test.rb
128
140
  - test/sablon_test.rb
129
141
  - test/sandbox/.gitkeep
130
142
  - test/section_properties_test.rb
131
143
  - test/support/document_xml_helper.rb
144
+ - test/support/xml_snippets.rb
132
145
  - test/test_helper.rb
133
146
  homepage: http://github.com/senny/sablon
134
147
  licenses:
@@ -158,10 +171,23 @@ test_files:
158
171
  - test/expression_test.rb
159
172
  - test/fixtures/sablon_sample.docx
160
173
  - test/fixtures/sablon_template.docx
174
+ - test/fixtures/xml/complex_field.xml
175
+ - test/fixtures/xml/conditional.xml
176
+ - test/fixtures/xml/conditional_with_predicate.xml
177
+ - test/fixtures/xml/conditional_without_ending.xml
178
+ - test/fixtures/xml/edited_complex_field.xml
179
+ - test/fixtures/xml/loop_without_ending.xml
180
+ - test/fixtures/xml/paragraph_loop.xml
181
+ - test/fixtures/xml/paragraph_loop_within_table_cell.xml
182
+ - test/fixtures/xml/simple_field.xml
183
+ - test/fixtures/xml/simple_fields.xml
184
+ - test/fixtures/xml/table_multi_row_loop.xml
185
+ - test/fixtures/xml/table_row_loop.xml
161
186
  - test/mail_merge_parser_test.rb
162
187
  - test/processor_test.rb
163
188
  - test/sablon_test.rb
164
189
  - test/sandbox/.gitkeep
165
190
  - test/section_properties_test.rb
166
191
  - test/support/document_xml_helper.rb
192
+ - test/support/xml_snippets.rb
167
193
  - test/test_helper.rb