arbre 1.0.0.rc1 → 1.0.0.rc2

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.
@@ -0,0 +1,8 @@
1
+ ## 1.0.0.rc2
2
+
3
+ * Fixed bug where Component's build methods were being rendered within the
4
+ parent context.
5
+
6
+ ## 1.0.0.rc1
7
+
8
+ Initial release and extraction from Active Admin
@@ -23,21 +23,12 @@ module Arbre
23
23
  tag = klass.new(arbre_context)
24
24
  tag.parent = current_arbre_element
25
25
 
26
- # If you passed in a block and want the object
27
- if block_given? && block.arity > 0
28
- # Set out context to the tag, and pass responsibility to the tag
29
- with_current_arbre_element tag do
26
+ with_current_arbre_element tag do
27
+ if block_given? && block.arity > 0
30
28
  tag.build(*args, &block)
31
- end
32
- else
33
- # Build the tag
34
- tag.build(*args)
35
-
36
- # Render the blocks contents
37
- if block_given?
38
- with_current_arbre_element tag do
39
- append_return_block(yield)
40
- end
29
+ else
30
+ tag.build(*args)
31
+ append_return_block(yield) if block_given?
41
32
  end
42
33
  end
43
34
 
@@ -1,3 +1,3 @@
1
1
  module Arbre
2
- VERSION = "1.0.0.rc1"
2
+ VERSION = "1.0.0.rc2"
3
3
  end
@@ -1,10 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  # A mock subclass to play with
4
- class MockComponent < Arbre::Component; end
4
+ class MockComponent < Arbre::Component
5
+
6
+ builder_method :mock_component
7
+
8
+ def build
9
+ h2 "Hello World"
10
+ end
11
+
12
+ end
5
13
 
6
14
  describe Arbre::Component do
7
15
 
16
+ let(:assigns) { {} }
17
+ let(:helpers) { nil }
18
+
8
19
  let(:component_class){ MockComponent }
9
20
  let(:component){ component_class.new }
10
21
 
@@ -20,4 +31,14 @@ describe Arbre::Component do
20
31
  component.class_list.should include("mock_component")
21
32
  end
22
33
 
34
+ it "should render the object using the builder method name" do
35
+ comp = arbre {
36
+ mock_component
37
+ }.to_s.should == <<-HTML
38
+ <div class="mock_component">
39
+ <h2>Hello World</h2>
40
+ </div>
41
+ HTML
42
+ end
43
+
23
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arbre
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70148646136380 !ruby/object:Gem::Requirement
16
+ requirement: &70272484758820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70148646136380
24
+ version_requirements: *70272484758820
25
25
  description: An Object Oriented DOM Tree in Ruby
26
26
  email:
27
27
  - gregdbell@gmail.com
@@ -31,6 +31,7 @@ extra_rdoc_files: []
31
31
  files:
32
32
  - .DS_Store
33
33
  - .gitignore
34
+ - CHANGELOG.md
34
35
  - Gemfile
35
36
  - README.rdoc
36
37
  - Rakefile
@@ -54,7 +55,7 @@ files:
54
55
  - lib/arbre/rails/template_handler.rb
55
56
  - lib/arbre/version.rb
56
57
  - spec/arbre/integration/html_spec.rb
57
- - spec/arbre/unit/component.rb
58
+ - spec/arbre/unit/component_spec.rb
58
59
  - spec/arbre/unit/context_spec.rb
59
60
  - spec/arbre/unit/element_finder_methods_spec.rb
60
61
  - spec/arbre/unit/element_spec.rb
@@ -104,7 +105,7 @@ specification_version: 3
104
105
  summary: An Object Oriented DOM Tree in Ruby
105
106
  test_files:
106
107
  - spec/arbre/integration/html_spec.rb
107
- - spec/arbre/unit/component.rb
108
+ - spec/arbre/unit/component_spec.rb
108
109
  - spec/arbre/unit/context_spec.rb
109
110
  - spec/arbre/unit/element_finder_methods_spec.rb
110
111
  - spec/arbre/unit/element_spec.rb