apotomo 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 017a9d6267b6b8cf91a80513607f24cd2f0edcd0
4
- data.tar.gz: 2cfe2319182b4536f6c20d5dddf7cbb02224a5e0
3
+ metadata.gz: 869673532c8cc2f950193bfa92152e84f1a72b29
4
+ data.tar.gz: 97d85b797409ec903b0ff2c62c50d3fd975384cc
5
5
  SHA512:
6
- metadata.gz: c39ad60a4f9fc2a4d93b3a928b3ff46ce583443aa25b3a3ade4663221bd639717c3b26d35b4f3b27dfd1456503ca039e70740bb0a2d97b998103eea2789944b4
7
- data.tar.gz: e0b7f965287f2d42ba136dfec5816c90b7514904dbb111bd4dc6654a8cd57a50e9a6214a357b077fbf2075ae415853b3635c37f5dc243c64aa109ceec70aff6d
6
+ metadata.gz: d4771336d38c9b568ed1a945c073026df36becaaa44b6f312aead1c2ea2fcd304141142aaf21a7bf75587ade5b8eaf722c0f6757224147ef937e696297058fde
7
+ data.tar.gz: 7046dc17fc8996102ced3bc8243421496bfa7a535d5a5d700f68bbb444549ac8cf5651a9665e7f62c5581bbce4aeb576b5a0f1d0383d85802d75176fadda0e0b
data/CHANGES.textile CHANGED
@@ -1,3 +1,7 @@
1
+ h2. 1.2.6
2
+
3
+ * Upgrade to newest hooks and uber, fixing `uninitialized constant Hooks::InheritableAttribute ` (fixes #144).
4
+
1
5
  h2. 1.2.5
2
6
 
3
7
  * Introduce @#widget_tag@ helper allowing you to wrap widget content in an arbitrary tag. Extends @#widget_div@.
data/README.md CHANGED
@@ -192,6 +192,8 @@ end
192
192
 
193
193
  You can render your widgets, spec the markup, trigger events and assert the event responses, so far. If you need more, let us know!
194
194
 
195
+ **Using rspec?** please check out [rspec-apotomo].
196
+
195
197
  ## Bubbling events
196
198
 
197
199
  Note: Let's write this paragraph!
@@ -209,3 +211,5 @@ If you wanna be cool, subscribe to our [feed](http://feeds.feedburner.com/Apotom
209
211
  Copyright (c) 2007-2013 Nick Sutterer <apotonick@gmail.com>
210
212
 
211
213
  Released under the MIT License.
214
+
215
+ [rspec-apotomo]: https://github.com/apotonick/rspec-apotomo "apotonick/rspec-apotomo"
data/apotomo.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_dependency "cells", ">= 3.6.7"
24
24
  s.add_dependency "onfire", "~> 0.2.0"
25
- s.add_dependency "hooks", "~> 0.3.0"
25
+ s.add_dependency "hooks", "~> 0.4.0" # brings us uber.
26
26
 
27
27
  s.add_development_dependency "rake"
28
28
  s.add_development_dependency "slim"
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  Rails.application.routes.draw do
2
- match ":controller/render_event_response", :to => "#render_event_response", :as => "apotomo_event", :via => [:get, :post]
2
+ match ":controller/render_event_response", :to => "#render_event_response", :as => "apotomo_event", :via => [:get, :post, :put, :patch, :delete]
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'apotomo/request_processor'
2
+ require 'uber/inheritable_attr'
2
3
 
3
4
  module Apotomo
4
5
  module Rails
@@ -9,28 +10,28 @@ module Apotomo
9
10
  has_widgets(*args, &block)
10
11
  end
11
12
  end
12
-
13
-
13
+
14
+
14
15
  module ActionViewMethods
15
16
  delegate :render_widget, :url_for_event, :to => :controller
16
17
  end
17
-
18
+
18
19
  module ControllerMethods
19
20
  include WidgetShortcuts
20
21
  extend ActiveSupport::Concern
21
-
22
+
22
23
  included do
23
- extend Hooks::InheritableAttribute
24
+ extend Uber::InheritableAttr
24
25
  extend WidgetShortcuts
25
-
26
+
26
27
  inheritable_attr :has_widgets_blocks
27
28
  self.has_widgets_blocks = []
28
-
29
+
29
30
  helper ActionViewMethods
30
31
  end
31
-
32
+
32
33
  module ClassMethods
33
- # Yields the root widget to setup your widgets for a controller. The block is executed in
34
+ # Yields the root widget to setup your widgets for a controller. The block is executed in
34
35
  # controller _instance_ context, so you may use instance methods and variables of the
35
36
  # controller.
36
37
  #
@@ -43,32 +44,32 @@ module Apotomo
43
44
  has_widgets_blocks << block
44
45
  end
45
46
  end
46
-
47
+
47
48
  def apotomo_request_processor
48
49
  return @apotomo_request_processor if @apotomo_request_processor
49
-
50
+
50
51
  # happens once per request:
51
52
  options = {:js_framework => Apotomo.js_framework}
52
-
53
+
53
54
  @apotomo_request_processor = Apotomo::RequestProcessor.new(self, options, self.class.has_widgets_blocks)
54
55
  end
55
-
56
+
56
57
  def apotomo_root
57
58
  apotomo_request_processor.root
58
59
  end
59
-
60
+
60
61
  def render_widget(*args, &block)
61
62
  apotomo_request_processor.render_widget_for(*args, &block)
62
63
  end
63
-
64
+
64
65
  def render_event_response
65
66
  page_updates = apotomo_request_processor.process_for(params)
66
-
67
+
67
68
  return render_iframe_updates(page_updates) if params[:apotomo_iframe]
68
-
69
+
69
70
  render :text => page_updates.join("\n"), :content_type => Mime::JS
70
71
  end
71
-
72
+
72
73
  # Returns the url to trigger a +type+ event from +:source+, which is a non-optional parameter.
73
74
  # Additional +options+ will be appended to the query string.
74
75
  #
@@ -79,16 +80,16 @@ module Apotomo
79
80
  # #=> http://apotomo.de/mouse/process_event_request?type=paginate&source=mouse&page=2
80
81
  def url_for_event(type, options)
81
82
  options.reverse_merge!(:type => type)
82
-
83
+
83
84
  apotomo_event_path(apotomo_request_processor.address_for(options))
84
85
  end
85
-
86
+
86
87
  protected
87
88
  # Renders the page updates through an iframe. Copied from responds_to_parent,
88
89
  # see http://github.com/markcatley/responds_to_parent .
89
90
  def render_iframe_updates(page_updates)
90
91
  escaped_script = Apotomo::JavascriptGenerator.escape(page_updates.join("\n"))
91
-
92
+
92
93
  render :text => "<html><body><script type='text/javascript' charset='utf-8'>
93
94
  var loc = document.location;
94
95
  with(window.parent) { setTimeout(function() { window.eval('#{escaped_script}'); window.loc && loc.replace('about:blank'); }, 1) }
@@ -41,7 +41,7 @@ module Apotomo
41
41
 
42
42
  # Computes the address hash for a +:source+ widget and an event +:type+.
43
43
  # Additional parameters will be merged.
44
- def address_for(options)
44
+ def address_for(options) # DISCUSS: remove/make private/rename?
45
45
  raise "You forgot to provide :source or :type" unless options.has_key?(:source) and options.has_key?(:type)
46
46
  options
47
47
  end
@@ -1,3 +1,3 @@
1
1
  module Apotomo
2
- VERSION = '1.2.5'
2
+ VERSION = '1.2.6'
3
3
  end
@@ -3,19 +3,23 @@ module Apotomo
3
3
  include Enumerable
4
4
  include Apotomo::WidgetShortcuts::DSL
5
5
 
6
+ # DISCUSS: do we need it? we have []!
7
+ # DISCUSS: #children receives a block, but #childrenHash doesn't
6
8
  attr_reader :childrenHash
7
9
  attr_accessor :parent
8
10
 
9
- def setup_tree_node(parent)
11
+ def setup_tree_node(parent) # DISCUSS: make private?
10
12
  @parent = nil
11
13
  @childrenHash = {}
12
- @children = []
14
+ @children = [] # TODO: order of widgets in this variable isn't tested anywhere!!!
13
15
 
16
+ # DISCUSS: and what if not a Widget?
14
17
  parent.add_widget(self) if parent.kind_of? Widget # TODO: as long as cells needs parent_controller.
15
18
  end
16
19
 
17
20
  # Print the string representation of this node.
18
21
  def to_s
22
+ # DISCUSS: why self.widget_id but parent.name ?
19
23
  "Node ID: #{widget_id} Parent: " + (root? ? "ROOT" : "#{parent.name}") +
20
24
  " Children: #{children.length}" + " Total Nodes: #{size}"
21
25
  end
@@ -37,6 +41,7 @@ module Apotomo
37
41
  def remove!(child)
38
42
  @childrenHash.delete(child.name)
39
43
  @children.delete(child)
44
+ # DISCUSS: why `unless child == nil`? if child is nil, an exception has been raised two locs above!
40
45
  child.root! unless child == nil
41
46
  child
42
47
  end
@@ -105,6 +110,8 @@ module Apotomo
105
110
  # Provides a comparision operation for the nodes. Comparision
106
111
  # is based on the natural character-set ordering for the
107
112
  # node names.
113
+ # DUISCUSS: useful?
114
+ # DUISCUSS: <, >, etc., operators doesn't work because of Comparable isn't included
108
115
  def <=>(other)
109
116
  return +1 if other == nil
110
117
  self.name <=> other.name
data/test/apotomo_test.rb CHANGED
@@ -7,25 +7,23 @@ class ApotomoTest < MiniTest::Spec
7
7
  Apotomo.js_framework = :jquery
8
8
  end
9
9
 
10
- it "respond to #js_framework" do
10
+ it "respond to #js_framework and return javascript framework's name" do
11
11
  assert_equal :jquery, Apotomo.js_framework
12
12
  end
13
13
 
14
- it "respond to #js_generator" do
14
+ it "respond to #js_generator and return an correct instance" do
15
15
  assert_kind_of Apotomo::JavascriptGenerator, Apotomo.js_generator
16
- end
17
-
18
- it "include correct javascript framework module" do
19
- assert Apotomo.js_generator.is_a?(Apotomo::JavascriptGenerator::Jquery)
20
- assert_respond_to Apotomo.js_generator, :jquery
16
+ assert_kind_of Apotomo::JavascriptGenerator::Jquery, Apotomo.js_generator
21
17
  end
22
18
  end
23
19
 
24
20
  it "respond to #setup" do
25
- Apotomo.setup { |config| config.js_framework = :jquery }
21
+ Apotomo.setup do |config|
22
+ config.js_framework = :jquery
23
+ end
24
+
26
25
  # TODO: Apotomo expect #js_framework
27
26
  assert_respond_to Apotomo.js_generator, :jquery
28
27
  end
29
28
  end
30
29
  end
31
-
@@ -15,25 +15,23 @@ class EventHandlerTest < MiniTest::Spec
15
15
  assert_equal nil, h.process_event(e)
16
16
  end
17
17
 
18
- describe "#call" do
19
- it "push #process_events' results ordered to root's #page_updates" do
20
- [@mum, @mum[:kid], @mum].each_with_index do |source, i|
21
- e = Apotomo::Event.new(:squeak, source)
22
- h = Apotomo::EventHandler.new
23
- h.stub :process_event, "tick#{i}" do
24
- h.call(e)
25
- end
18
+ it "respond to #call and push #process_events' results ordered to root's #page_updates" do
19
+ [@mum, @mum[:kid], @mum].each_with_index do |source, i|
20
+ e = Apotomo::Event.new(:squeak, source)
21
+ h = Apotomo::EventHandler.new
22
+ h.stub :process_event, "tick#{i}" do
23
+ h.call(e)
26
24
  end
27
-
28
- assert_equal 3, @mum.page_updates.size
29
- assert_equal "tick0", @mum.page_updates[0]
30
- assert_equal "tick1", @mum.page_updates[1]
31
- assert_equal "tick2", @mum.page_updates[2]
32
- assert_equal 0, @mum[:kid].page_updates.size
33
25
  end
34
26
 
35
- #TODO: handler expect #process_event
27
+ assert_equal 3, @mum.page_updates.size
28
+ assert_equal "tick0", @mum.page_updates[0]
29
+ assert_equal "tick1", @mum.page_updates[1]
30
+ assert_equal "tick2", @mum.page_updates[2]
31
+ assert_equal 0, @mum[:kid].page_updates.size
36
32
  end
33
+
34
+ #TODO: handler expect #process_event
37
35
  end
38
36
 
39
37
  end
@@ -7,7 +7,6 @@ class EventMethodsTest < MiniTest::Spec
7
7
  Apotomo::InvokeEventHandler.new(:widget_id => id, :state => state)
8
8
  end
9
9
 
10
-
11
10
  describe "#respond_to_event and #fire" do
12
11
  before do
13
12
  mum_and_kid!
@@ -15,18 +14,20 @@ class EventMethodsTest < MiniTest::Spec
15
14
 
16
15
  it "alert @mum first, then make her squeak when @kid squeaks" do
17
16
  @kid.fire :squeak
17
+
18
18
  assert_equal ['be alerted', 'answer squeak'], @mum.list
19
19
  end
20
20
 
21
21
  it "make @mum just squeak back when jerry squeaks" do
22
22
  @mum << mouse_mock(:jerry)
23
23
  @mum[:jerry].fire :squeak
24
+
24
25
  assert_equal ['answer squeak'], @mum.list
25
26
  end
26
27
 
27
-
28
28
  it "make @mum run away while @kid keeps watching" do
29
29
  @kid.fire :footsteps
30
+
30
31
  assert_equal ['peek', 'escape'], @mum.list
31
32
  end
32
33
 
@@ -34,6 +35,7 @@ class EventMethodsTest < MiniTest::Spec
34
35
  @mum.respond_to_event :peep, :with => :answer_squeak
35
36
  @mum.respond_to_event :peep, :with => :answer_squeak
36
37
  @mum.fire :peep
38
+
37
39
  assert_equal ['answer squeak'], @mum.list
38
40
  end
39
41
 
@@ -41,12 +43,14 @@ class EventMethodsTest < MiniTest::Spec
41
43
  @mum.respond_to_event :peep, :with => :answer_squeak
42
44
  @mum.respond_to_event :peep, :with => :answer_squeak, :once => false
43
45
  @mum.fire :peep
46
+
44
47
  assert_equal ['answer squeak', 'answer squeak'], @mum.list
45
48
  end
46
49
 
47
50
  it "also accept an event argument only" do
48
51
  @mum.respond_to_event :answer_squeak
49
52
  @mum.fire :answer_squeak
53
+
50
54
  assert_equal ['answer squeak'], @mum.list
51
55
  end
52
56
 
@@ -60,6 +64,7 @@ class EventMethodsTest < MiniTest::Spec
60
64
  end
61
65
 
62
66
  @mum.trigger :footsteps, "near"
67
+
63
68
  assert_kind_of Apotomo::Event, @mum.list.last
64
69
  end
65
70
 
@@ -72,6 +77,7 @@ class EventMethodsTest < MiniTest::Spec
72
77
  end
73
78
 
74
79
  @mum.fire :answer_squeak, :volume => 9
80
+
75
81
  assert_equal [{:volume => 9}], @mum.list
76
82
  end
77
83
 
@@ -103,6 +109,7 @@ class EventMethodsTest < MiniTest::Spec
103
109
  class AdultMouse < Apotomo::Widget
104
110
  responds_to_event :peep, :with => :answer_squeak
105
111
  end
112
+
106
113
  class BabyMouse < AdultMouse
107
114
  responds_to_event :peep
108
115
  responds_to_event :footsteps, :with => :squeak
@@ -123,7 +130,6 @@ class EventMethodsTest < MiniTest::Spec
123
130
 
124
131
  it "not share responds_to_event options between different instances" do
125
132
  assert_equal [handler('mum', :answer_squeak)], @mum.event_table.all_handlers_for(:peep, 'mum')
126
-
127
133
  assert_equal [handler('dad', :answer_squeak)], AdultMouse.new(parent_controller, 'dad', :show).event_table.all_handlers_for(:peep, 'dad')
128
134
  end
129
135
  end
@@ -131,11 +137,11 @@ class EventMethodsTest < MiniTest::Spec
131
137
  describe "#trigger" do
132
138
  it "be an alias for #fire" do
133
139
  @kid.trigger :footsteps
140
+
134
141
  assert_equal ['peek', 'escape'], @mum.list
135
142
  end
136
143
  end
137
144
 
138
-
139
145
  describe "page_updates" do
140
146
  it "expose a simple Array for now" do
141
147
  assert_kind_of Array, @mum.page_updates
@@ -144,9 +150,9 @@ class EventMethodsTest < MiniTest::Spec
144
150
 
145
151
  it "be queued in root#page_updates after #fire" do
146
152
  @mum.fire :footsteps
153
+
147
154
  assert_equal ["escape"], @mum.page_updates
148
155
  end
149
156
  end
150
-
151
157
  end
152
158
  end
data/test/event_test.rb CHANGED
@@ -3,25 +3,35 @@ require 'test_helper'
3
3
  class EventTest < MiniTest::Spec
4
4
  include Apotomo::TestCaseMethods::TestController
5
5
 
6
- describe "An Event" do
6
+ describe "Event" do
7
+ it "is a kind of Onfire::Event" do
8
+ @event = Apotomo::Event.new(:footsteps, 'mum')
9
+
10
+ assert_kind_of Onfire::Event, @event
11
+ end
12
+
7
13
  it "respond to #type and #source" do
8
14
  @event = Apotomo::Event.new(:footsteps, 'mum')
9
- assert_equal :footsteps, @event.type
10
- assert_equal 'mum', @event.source
15
+
16
+ assert_equal :footsteps, @event.type
17
+ assert_equal 'mum', @event.source
11
18
  end
12
19
 
13
20
  it "accept an additional data object and respond to #data" do
14
21
  @event = Apotomo::Event.new(:footsteps, 'mum', {:volume => :loud})
22
+
15
23
  assert_equal({:volume => :loud}, @event.data)
16
24
  end
17
25
 
18
26
  it "delegate #[] to data" do
19
27
  @event = Apotomo::Event.new(:footsteps, 'mum', {:volume => :loud})
28
+
20
29
  assert_equal :loud, @event[:volume]
21
30
  end
22
31
 
23
32
  it "respond to #to_s" do
24
33
  @event = Apotomo::Event.new(:footsteps, mouse('mum'))
34
+
25
35
  assert_equal "<Event :footsteps source=mum>", @event.to_s
26
36
  end
27
37
  end
@@ -5,14 +5,16 @@ class EventHandlerTest < MiniTest::Spec
5
5
 
6
6
  describe "InvokeEventHandler" do
7
7
  describe "constructor" do
8
- it "accept no arguments" do
8
+ it "accept no arguments and create clean instance" do
9
9
  h = Apotomo::InvokeEventHandler.new
10
+
10
11
  assert_nil h.widget_id
11
12
  assert_nil h.state
12
13
  end
13
14
 
14
- it "accept options" do
15
+ it "accept options and set them" do
15
16
  h = Apotomo::InvokeEventHandler.new(:widget_id => :widget, :state => :state)
17
+
16
18
  assert_equal :widget, h.widget_id
17
19
  assert_equal :state, h.state
18
20
  end
@@ -50,6 +52,7 @@ class EventHandlerTest < MiniTest::Spec
50
52
  h = Apotomo::InvokeEventHandler.new
51
53
  h.widget_id = :widget_id
52
54
  h.state = :my_state
55
+
53
56
  assert_equal "InvokeEventHandler:widget_id#my_state", h.to_s
54
57
  end
55
58
  end
@@ -64,11 +64,11 @@ class JavascriptGeneratorTest < MiniTest::Spec
64
64
  it "respond to #update_id" do
65
65
  assert_equal "jQuery(\"#drinks\").html(\"EMPTY!\");", @gen.update_id("drinks", 'EMPTY!')
66
66
  end
67
+ end
67
68
 
68
- # TODO: Prototype mode
69
+ # TODO: Prototype mode
69
70
 
70
- # TODO: Right mode
71
+ # TODO: Right mode
71
72
 
72
- end
73
73
  end
74
74
  end
@@ -46,75 +46,77 @@ class RailsIntegrationTest < ActionController::TestCase
46
46
  end
47
47
 
48
48
 
49
- describe "ActionController" do
50
- setup do
51
- @controller.class.has_widgets do |root|
52
- MumWidget.new(root, 'mum')
53
- end
49
+ def setup
50
+ super
54
51
 
55
- @controller.instance_eval do
56
- def mum
57
- render :text => render_widget('mum', params[:state])
58
- end
59
- end
52
+ @controller.class.has_widgets do |root|
53
+ MumWidget.new(root, 'mum')
60
54
  end
61
55
 
62
- test "provide the rails view helpers in state views" do
63
- get 'mum', :state => :make_me_squeak
64
- assert_select "a", "mum"
56
+ @controller.instance_eval do
57
+ def mum
58
+ render :text => render_widget('mum', params[:state])
59
+ end
65
60
  end
61
+ end
66
62
 
67
- # describe "nested widgets" do
68
- test "render" do
69
- get 'mum', :state => :child
70
- assert_equal "/barn/render_event_response?source=kid&amp;type=click\n", @response.body
71
- end
63
+ test "provide the rails view helpers in state views" do
64
+ get 'mum', :state => :make_me_squeak
65
+ assert_select "a", "mum"
66
+ end
72
67
 
73
- test "process events" do
74
- get 'render_event_response', :source => 'root', :type => :squeak
75
- assert_equal "squeak!", @response.body
76
- end
77
- # end
68
+ test "render" do
69
+ get 'mum', :state => :child
70
+ puts "-"
71
+ assert_equal "/barn/render_event_response?source=kid&amp;type=click\n", @response.body
72
+ end
78
73
 
79
- test "pass the event with all params data as state-args" do
80
- get 'render_event_response', :source => "mum", :type => "squeak", :pitch => "high"
81
- assert_equal "{\"source\"=>\"mum\", \"type\"=>\"squeak\", \"pitch\"=>\"high\", \"controller\"=>\"barn\", \"action\"=>\"render_event_response\"}\nsqueak!", @response.body
82
- end
74
+ test "process events" do
75
+ get 'render_event_response', :source => 'root', :type => :squeak
76
+ assert_equal "squeak!", @response.body
77
+ end
83
78
 
84
- test "render updates to the parent window for an iframe request" do
85
- get 'render_event_response', :source => 'mum', :type => :sniff, :apotomo_iframe => true
79
+ test "#page_updates is populated with event responses" do
80
+ get 'render_event_response', :source => 'root', :type => :squeak
86
81
 
87
- assert_response :success
88
- assert_equal 'text/html', @response.content_type
89
- assert_equal "<html><body><script type='text/javascript' charset='utf-8'>\nvar loc = document.location;\nwith(window.parent) { setTimeout(function() { window.eval('<b>sniff sniff<\\/b>'); window.loc && loc.replace('about:blank'); }, 1) }\n</script></body></html>", @response.body
90
- # end
82
+ assert_equal ["squeak!"], @controller.apotomo_root.page_updates
83
+ end
91
84
 
85
+ test "pass the event with all params data as state-args" do
86
+ get 'render_event_response', :source => "mum", :type => "squeak", :pitch => "high"
87
+ assert_equal "{\"source\"=>\"mum\", \"type\"=>\"squeak\", \"pitch\"=>\"high\", \"controller\"=>\"barn\", \"action\"=>\"render_event_response\"}\nsqueak!", @response.body
88
+ end
89
+
90
+ test "render updates to the parent window for an iframe request" do
91
+ get 'render_event_response', :source => 'mum', :type => :sniff, :apotomo_iframe => true
92
+
93
+ assert_response :success
94
+ assert_equal 'text/html', @response.content_type
95
+ assert_equal "<html><body><script type='text/javascript' charset='utf-8'>\nvar loc = document.location;\nwith(window.parent) { setTimeout(function() { window.eval('<b>sniff sniff<\\/b>'); window.loc && loc.replace('about:blank'); }, 1) }\n</script></body></html>", @response.body
96
+ end
92
97
 
93
- # describe "ActionView" do
94
- before do
95
- @controller.instance_eval do
96
- def mum
97
- render :inline => "<%= render_widget 'mum', :eat %>"
98
- end
99
- end
100
- end
101
98
 
102
- test "respond to #render_widget" do
103
- get :mum
104
- assert_select "#mum", "burp!"
99
+ # describe "ActionView" do
100
+ test "respond to #render_widget" do
101
+ @controller.instance_eval do
102
+ def mum
103
+ render :inline => "<%= render_widget 'mum', :eat %>"
105
104
  end
105
+ end
106
106
 
107
- test "respond to #url_for_event" do
108
- @controller.instance_eval do
109
- def mum
110
- render :inline => "<%= url_for_event :footsteps, :source => 'mum' %>"
111
- end
112
- end
107
+ get :mum
108
+ assert_select "#mum", "burp!"
109
+ end
113
110
 
114
- get :mum
115
- assert_equal "/barn/render_event_response?source=mum&amp;type=footsteps", @response.body
111
+ test "respond to #url_for_event" do
112
+ @controller.instance_eval do
113
+ def mum
114
+ render :inline => "<%= url_for_event :footsteps, :source => 'mum' %>"
116
115
  end
117
116
  end
117
+
118
+ get :mum
119
+ assert_equal "/barn/render_event_response?source=mum&amp;type=footsteps", @response.body
118
120
  end
119
121
  end
120
122