attrtastic 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/attrtastic.gemspec +5 -2
- data/lib/attrtastic.rb +161 -32
- data/test/helper.rb +1 -0
- data/test/test_attribute.rb +120 -95
- data/test/test_attributes.rb +415 -87
- data/test/test_attrtastic.rb +74 -70
- data/test/test_semantic_attributes_helper.rb +38 -34
- metadata +12 -2
@@ -2,50 +2,54 @@ require 'helper'
|
|
2
2
|
|
3
3
|
class TestSemanticAttributesHelper < Test::Unit::TestCase
|
4
4
|
|
5
|
-
|
6
|
-
setup_fixtures
|
7
|
-
end
|
5
|
+
context "semantic_attributes_helper" do
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
</div>
|
13
|
-
EOHTML
|
7
|
+
setup do
|
8
|
+
setup_fixtures
|
9
|
+
end
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
should "generate output event when no block given" do
|
12
|
+
expected = html <<-EOHTML
|
13
|
+
<div class="attrtastic user">
|
14
|
+
</div>
|
15
|
+
EOHTML
|
18
16
|
|
19
|
-
|
17
|
+
@template.semantic_attributes_for(@user)
|
18
|
+
actual = @template.output_buffer.to_s
|
19
|
+
assert_equal expected, actual
|
20
20
|
|
21
|
-
|
22
|
-
<div class="attrtastic blog">
|
23
|
-
</div>
|
24
|
-
EOHTML
|
21
|
+
@template.output_buffer.clear
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
expected = html <<-EOHTML
|
24
|
+
<div class="attrtastic blog">
|
25
|
+
</div>
|
26
|
+
EOHTML
|
30
27
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
block_run = true
|
28
|
+
@template.semantic_attributes_for(@blog)
|
29
|
+
actual = @template.output_buffer.to_s
|
30
|
+
assert_equal expected, actual
|
35
31
|
end
|
36
32
|
|
37
|
-
|
38
|
-
|
33
|
+
should "run block" do
|
34
|
+
block_run = false
|
35
|
+
@template.semantic_attributes_for(@user) do |attr|
|
36
|
+
block_run = true
|
37
|
+
end
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
assert block_run
|
40
|
+
end
|
41
|
+
|
42
|
+
should "accept options" do
|
43
|
+
expected = html <<-EOHTML
|
44
|
+
<div class="attrtastic user simple show">
|
45
|
+
</div>
|
46
|
+
EOHTML
|
47
|
+
|
48
|
+
@template.semantic_attributes_for(@user, :html => {:class => 'simple show'})
|
49
|
+
actual = @template.output_buffer.to_s
|
50
|
+
assert_equal expected, actual
|
51
|
+
end
|
45
52
|
|
46
|
-
@template.semantic_attributes_for(@user, :html => {:class => 'simple show'})
|
47
|
-
actual = @template.output_buffer.to_s
|
48
|
-
assert_equal expected, actual
|
49
53
|
end
|
50
54
|
|
51
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attrtastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boruta Miroslaw
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-15 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,16 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: shoulda
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
25
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"
|
26
36
|
email: boruta.miroslaw@gmail.com
|
27
37
|
executables: []
|