attrtastic 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestAttributes < Test::Unit::TestCase
3
+ class TestAttributes < TestCase
4
4
 
5
5
  context "attributes" do
6
6
 
@@ -22,9 +22,7 @@ class TestAttributes < Test::Unit::TestCase
22
22
  <div class="attributes">
23
23
  </div>
24
24
  EOHTML
25
-
26
- @user_builder.attributes
27
- actual = @template.output_buffer.to_s
25
+ actual = @user_builder.attributes
28
26
 
29
27
  assert_equal expected, actual
30
28
  end
@@ -36,9 +34,7 @@ class TestAttributes < Test::Unit::TestCase
36
34
  </ol>
37
35
  </div>
38
36
  EOHTML
39
-
40
- @user_builder.attributes do end
41
- actual = @template.output_buffer.to_s
37
+ actual = @user_builder.attributes do end
42
38
 
43
39
  assert_equal expected, actual
44
40
  end
@@ -51,14 +47,13 @@ class TestAttributes < Test::Unit::TestCase
51
47
  </ol>
52
48
  </div>
53
49
  EOHTML
50
+ actual = @user_builder.attributes "Legend" do end
54
51
 
55
- @user_builder.attributes "Legend" do end
56
- actual = @template.output_buffer.to_s
57
52
  assert_equal expected, actual
58
53
 
59
- @template.output_buffer.clear
60
- @user_builder.attributes :name => "Legend" do end
61
- actual = @template.output_buffer.to_s
54
+ #@template.output_buffer.clear
55
+ actual = @user_builder.attributes :name => "Legend" do end
56
+
62
57
  assert_equal expected, actual
63
58
  end
64
59
 
@@ -79,9 +74,8 @@ class TestAttributes < Test::Unit::TestCase
79
74
  </ol>
80
75
  </div>
81
76
  EOHTML
77
+ actual = @user_builder.attributes :full_name, :email
82
78
 
83
- @user_builder.attributes :full_name, :email
84
- actual = @template.output_buffer.to_s
85
79
  assert_equal expected, actual
86
80
  end
87
81
 
@@ -105,9 +99,8 @@ class TestAttributes < Test::Unit::TestCase
105
99
  </ol>
106
100
  </div>
107
101
  EOHTML
102
+ actual = @user_builder.attributes "Contact", :full_name, :title, :email, :html => {:class => "contact"}, :display_empty => true
108
103
 
109
- @user_builder.attributes "Contact", :full_name, :title, :email, :html => {:class => "contact"}, :display_empty => true
110
- actual = @template.output_buffer.to_s
111
104
  assert_equal expected, actual
112
105
  end
113
106
 
@@ -136,7 +129,7 @@ class TestAttributes < Test::Unit::TestCase
136
129
  end
137
130
 
138
131
  should "generate output for given inner object" do
139
- @blog_builder.attributes :for => :author do |author|
132
+ actual = @blog_builder.attributes :for => :author do |author|
140
133
 
141
134
  expected = html <<-EOHTML
142
135
  <li class="attribute">
@@ -157,14 +150,10 @@ class TestAttributes < Test::Unit::TestCase
157
150
  </div>
158
151
  EOHTML
159
152
 
160
- actual = @template.output_buffer
161
153
  assert_equal expected, actual
162
154
  end
163
155
 
164
156
  should "show header" do
165
- @blog_builder.attributes "Author", :for => :author do |author|
166
- end
167
-
168
157
  expected = html <<-EOHTML
169
158
  <div class="attributes user">
170
159
  <div class="legend">Author</div>
@@ -172,8 +161,9 @@ class TestAttributes < Test::Unit::TestCase
172
161
  </ol>
173
162
  </div>
174
163
  EOHTML
164
+ actual = @blog_builder.attributes "Author", :for => :author do |author|
165
+ end
175
166
 
176
- actual = @template.output_buffer
177
167
  assert_equal expected, actual
178
168
  end
179
169
 
@@ -188,10 +178,8 @@ class TestAttributes < Test::Unit::TestCase
188
178
  </ol>
189
179
  </div>
190
180
  EOHTML
181
+ actual = @blog_builder.attributes :full_name, :for => :author
191
182
 
192
- @blog_builder.attributes :full_name, :for => :author
193
-
194
- actual = @template.output_buffer
195
183
  assert_equal expected, actual
196
184
  end
197
185
  end
@@ -207,7 +195,7 @@ class TestAttributes < Test::Unit::TestCase
207
195
  end
208
196
 
209
197
  should "generate output for given inner object" do
210
- @blog_builder.attributes :for => @user do |author|
198
+ actual = @blog_builder.attributes :for => @user do |author|
211
199
 
212
200
  expected = html <<-EOHTML
213
201
  <li class="attribute">
@@ -228,12 +216,11 @@ class TestAttributes < Test::Unit::TestCase
228
216
  </div>
229
217
  EOHTML
230
218
 
231
- actual = @template.output_buffer
232
219
  assert_equal expected, actual
233
220
  end
234
221
 
235
222
  should "show header" do
236
- @blog_builder.attributes "Author", :for => @user do |author|
223
+ actual = @blog_builder.attributes "Author", :for => @user do |author|
237
224
  end
238
225
 
239
226
  expected = html <<-EOHTML
@@ -244,7 +231,6 @@ class TestAttributes < Test::Unit::TestCase
244
231
  </div>
245
232
  EOHTML
246
233
 
247
- actual = @template.output_buffer
248
234
  assert_equal expected, actual
249
235
  end
250
236
 
@@ -259,10 +245,8 @@ class TestAttributes < Test::Unit::TestCase
259
245
  </ol>
260
246
  </div>
261
247
  EOHTML
248
+ actual = @user_builder.attributes :full_name, :for => @user
262
249
 
263
- @blog_builder.attributes :full_name, :for => @user
264
-
265
- actual = @template.output_buffer
266
250
  assert_equal expected, actual
267
251
  end
268
252
  end
@@ -282,9 +266,6 @@ class TestAttributes < Test::Unit::TestCase
282
266
  end
283
267
 
284
268
  should "generate output for given objects" do
285
- @blog_builder.attributes :for => :posts do |post|
286
- end
287
-
288
269
  expected = html <<-EOHTML
289
270
  <div class="attributes post">
290
271
  <ol>
@@ -295,15 +276,13 @@ class TestAttributes < Test::Unit::TestCase
295
276
  </ol>
296
277
  </div>
297
278
  EOHTML
279
+ actual = @blog_builder.attributes :for => :posts do |post|
280
+ end
298
281
 
299
- actual = @template.output_buffer
300
282
  assert_equal expected, actual
301
283
  end
302
284
 
303
285
  should "show header" do
304
- @blog_builder.attributes "Post", :for => :posts do |post|
305
- end
306
-
307
286
  expected = html <<-EOHTML
308
287
  <div class="attributes post">
309
288
  <div class="legend">Post</div>
@@ -316,8 +295,9 @@ class TestAttributes < Test::Unit::TestCase
316
295
  </ol>
317
296
  </div>
318
297
  EOHTML
298
+ actual = @blog_builder.attributes "Post", :for => :posts do |post|
299
+ end
319
300
 
320
- actual = @template.output_buffer
321
301
  assert_equal expected, actual
322
302
  end
323
303
 
@@ -340,10 +320,8 @@ class TestAttributes < Test::Unit::TestCase
340
320
  </ol>
341
321
  </div>
342
322
  EOHTML
323
+ actual = @blog_builder.attributes :title, :for => :posts
343
324
 
344
- @blog_builder.attributes :title, :for => :posts
345
-
346
- actual = @template.output_buffer
347
325
  assert_equal expected, actual
348
326
  end
349
327
  end
@@ -363,9 +341,6 @@ class TestAttributes < Test::Unit::TestCase
363
341
  end
364
342
 
365
343
  should "generate output for given objects" do
366
- @blog_builder.attributes :for => @blog.posts do |post|
367
- end
368
-
369
344
  expected = html <<-EOHTML
370
345
  <div class="attributes post">
371
346
  <ol>
@@ -376,15 +351,13 @@ class TestAttributes < Test::Unit::TestCase
376
351
  </ol>
377
352
  </div>
378
353
  EOHTML
354
+ actual = @blog_builder.attributes :for => @blog.posts do |post|
355
+ end
379
356
 
380
- actual = @template.output_buffer
381
357
  assert_equal expected, actual
382
358
  end
383
359
 
384
360
  should "show header" do
385
- @blog_builder.attributes "Post", :for => @blog.posts do |post|
386
- end
387
-
388
361
  expected = html <<-EOHTML
389
362
  <div class="attributes post">
390
363
  <div class="legend">Post</div>
@@ -397,8 +370,9 @@ class TestAttributes < Test::Unit::TestCase
397
370
  </ol>
398
371
  </div>
399
372
  EOHTML
373
+ actual = @blog_builder.attributes "Post", :for => @blog.posts do |post|
374
+ end
400
375
 
401
- actual = @template.output_buffer
402
376
  assert_equal expected, actual
403
377
  end
404
378
 
@@ -421,10 +395,8 @@ class TestAttributes < Test::Unit::TestCase
421
395
  </ol>
422
396
  </div>
423
397
  EOHTML
398
+ actual = @blog_builder.attributes :title, :for => @blog.posts
424
399
 
425
- @blog_builder.attributes :title, :for => @blog.posts
426
-
427
- actual = @template.output_buffer
428
400
  assert_equal expected, actual
429
401
  end
430
402
  end
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestAttrtastic < Test::Unit::TestCase
3
+ class TestAttrtastic < TestCase
4
4
 
5
5
  context "Attrtastic" do
6
6
 
@@ -37,18 +37,17 @@ class TestAttrtastic < Test::Unit::TestCase
37
37
  </div>
38
38
  EOHTML
39
39
 
40
- @template.semantic_attributes_for(@user) do |attr|
41
- attr.attributes "User" do
40
+ actual = @template.semantic_attributes_for(@user) do |attr|
41
+ @template.output_buffer << attr.attributes("User") do
42
42
  @template.output_buffer << (attr.attribute :first_name, :html => {:class => :strong}).to_s
43
43
  @template.output_buffer << (attr.attribute :last_name).to_s
44
44
  @template.output_buffer << (attr.attribute :title).to_s
45
45
  end
46
- attr.attributes :name => "Contact" do
46
+ @template.output_buffer << attr.attributes(:name => "Contact") do
47
47
  @template.output_buffer << (attr.attribute :email).to_s
48
48
  end
49
49
  end
50
50
 
51
- actual = @template.output_buffer.to_s
52
51
  assert_equal expected, actual
53
52
  end
54
53
 
@@ -81,10 +80,12 @@ class TestAttrtastic < Test::Unit::TestCase
81
80
  </div>
82
81
  EOHTML
83
82
 
84
- @template.semantic_attributes_for(@user) do |attr|
85
- attr.attributes "User", :first_name, :last_name, :title
86
- attr.attributes "Contact", :email
83
+ actual = @template.semantic_attributes_for(@user) do |attr|
84
+ @template.output_buffer << attr.attributes("User", :first_name, :last_name, :title)
85
+ @template.output_buffer << attr.attributes("Contact", :email)
87
86
  end
87
+
88
+ assert_equal expected, actual
88
89
  end
89
90
 
90
91
  end
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestSemanticAttributesHelper < Test::Unit::TestCase
3
+ class TestSemanticAttributesHelper < TestCase
4
4
 
5
5
  context "semantic_attributes_helper" do
6
6
 
@@ -13,20 +13,18 @@ class TestSemanticAttributesHelper < Test::Unit::TestCase
13
13
  <div class="attrtastic user">
14
14
  </div>
15
15
  EOHTML
16
+ actual = @template.semantic_attributes_for(@user)
16
17
 
17
- @template.semantic_attributes_for(@user)
18
- actual = @template.output_buffer.to_s
19
18
  assert_equal expected, actual
20
19
 
21
- @template.output_buffer.clear
20
+ #@template.output_buffer.clear
22
21
 
23
22
  expected = html <<-EOHTML
24
23
  <div class="attrtastic blog">
25
24
  </div>
26
25
  EOHTML
26
+ actual = @template.semantic_attributes_for(@blog)
27
27
 
28
- @template.semantic_attributes_for(@blog)
29
- actual = @template.output_buffer.to_s
30
28
  assert_equal expected, actual
31
29
  end
32
30
 
@@ -44,9 +42,8 @@ class TestSemanticAttributesHelper < Test::Unit::TestCase
44
42
  <div class="attrtastic user simple show">
45
43
  </div>
46
44
  EOHTML
45
+ actual = @template.semantic_attributes_for(@user, :html => {:class => 'simple show'})
47
46
 
48
- @template.semantic_attributes_for(@user, :html => {:class => 'simple show'})
49
- actual = @template.output_buffer.to_s
50
47
  assert_equal expected, actual
51
48
  end
52
49
 
metadata CHANGED
@@ -1,53 +1,114 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attrtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
5
10
  platform: ruby
6
11
  authors:
7
- - Boruta Miroslaw
12
+ - "Boruta Miros\xC5\x82aw"
8
13
  autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-01-15 00:00:00 +01:00
17
+ date: 2010-12-03 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: yard
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 6
31
+ - 0
32
+ version: 0.6.0
17
33
  type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: bluecloth
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
20
40
  requirements:
21
- - - ">="
41
+ - - ~>
22
42
  - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
43
+ segments:
44
+ - 2
45
+ - 0
46
+ - 0
47
+ version: 2.0.0
48
+ type: :development
49
+ version_requirements: *id002
25
50
  - !ruby/object:Gem::Dependency
26
51
  name: shoulda
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 2
60
+ - 11
61
+ - 0
62
+ version: 2.11.0
27
63
  type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: activesupport
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 3
75
+ - 0
76
+ - 0
77
+ version: 3.0.0
78
+ type: :runtime
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: actionpack
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
30
85
  requirements:
31
- - - ">="
86
+ - - ~>
32
87
  - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
- description: " Attrtastic, in its assumtion, should be similar in usage to formtastic and\n ease of displaying AR record informations (attributes). It should help\n scafforld show/index pages.\n"
36
- email: boruta.miroslaw@gmail.com
88
+ segments:
89
+ - 3
90
+ - 0
91
+ - 0
92
+ version: 3.0.0
93
+ type: :runtime
94
+ version_requirements: *id005
95
+ description: Rails view helper for scaffolding show/index pages for objects
96
+ email:
97
+ - boruta.miroslaw@gmail.com
37
98
  executables: []
38
99
 
39
100
  extensions: []
40
101
 
41
- extra_rdoc_files:
42
- - LICENSE
43
- - README.md
102
+ extra_rdoc_files: []
103
+
44
104
  files:
45
105
  - .document
46
106
  - .gitignore
107
+ - Gemfile
108
+ - Gemfile.lock
47
109
  - LICENSE
48
110
  - README.md
49
111
  - Rakefile
50
- - VERSION
51
112
  - attrtastic.gemspec
52
113
  - doc/Attrtastic.html
53
114
  - doc/Attrtastic/SemanticAttributesBuilder.html
@@ -66,7 +127,11 @@ files:
66
127
  - doc/js/jquery.js
67
128
  - doc/method_list.html
68
129
  - doc/top-level-namespace.html
130
+ - init.rb
69
131
  - lib/attrtastic.rb
132
+ - lib/attrtastic/semantic_attributes_builder.rb
133
+ - lib/attrtastic/semantic_attributes_helper.rb
134
+ - lib/attrtastic/version.rb
70
135
  - rails/init.rb
71
136
  - test/helper.rb
72
137
  - test/test_attribute.rb
@@ -78,32 +143,32 @@ homepage: http://github.com/MBO/attrtastic
78
143
  licenses: []
79
144
 
80
145
  post_install_message:
81
- rdoc_options:
82
- - --charset=UTF-8
146
+ rdoc_options: []
147
+
83
148
  require_paths:
84
149
  - lib
85
150
  required_ruby_version: !ruby/object:Gem::Requirement
151
+ none: false
86
152
  requirements:
87
153
  - - ">="
88
154
  - !ruby/object:Gem::Version
155
+ segments:
156
+ - 0
89
157
  version: "0"
90
- version:
91
158
  required_rubygems_version: !ruby/object:Gem::Requirement
159
+ none: false
92
160
  requirements:
93
161
  - - ">="
94
162
  - !ruby/object:Gem::Version
163
+ segments:
164
+ - 0
95
165
  version: "0"
96
- version:
97
166
  requirements: []
98
167
 
99
- rubyforge_project:
100
- rubygems_version: 1.3.5
168
+ rubyforge_project: attrtastic
169
+ rubygems_version: 1.3.7
101
170
  signing_key:
102
171
  specification_version: 3
103
- summary: Helps display attributes of AR record
104
- test_files:
105
- - test/helper.rb
106
- - test/test_attrtastic.rb
107
- - test/test_attribute.rb
108
- - test/test_semantic_attributes_helper.rb
109
- - test/test_attributes.rb
172
+ summary: Rails view helper for scaffolding show/index pages for objects
173
+ test_files: []
174
+
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.2