apotomo 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -3
  3. data/.travis.yml +6 -8
  4. data/CHANGES.textile +9 -5
  5. data/README.md +211 -0
  6. data/apotomo.gemspec +4 -4
  7. data/config/routes.rb +1 -1
  8. data/gemfiles/Gemfile.rails3-0 +6 -0
  9. data/gemfiles/Gemfile.rails3-1 +6 -0
  10. data/gemfiles/Gemfile.rails3-2 +6 -0
  11. data/gemfiles/Gemfile.rails4-0 +6 -0
  12. data/lib/apotomo/javascript_generator.rb +3 -3
  13. data/lib/apotomo/test_case.rb +14 -8
  14. data/lib/apotomo/version.rb +1 -1
  15. data/lib/apotomo/widget/javascript_methods.rb +3 -3
  16. data/lib/apotomo/widget/tree_node.rb +1 -1
  17. data/lib/apotomo/widget.rb +3 -3
  18. data/lib/generators/apotomo/widget_generator.rb +1 -1
  19. data/lib/generators/templates/view.slim +3 -4
  20. data/test/apotomo_test.rb +25 -14
  21. data/test/dummy/config/routes.rb +2 -57
  22. data/test/event_handler_test.rb +30 -60
  23. data/test/event_methods_test.rb +62 -62
  24. data/test/event_test.rb +11 -11
  25. data/test/invoke_event_handler_test.rb +59 -0
  26. data/test/javascript_generator_test.rb +57 -72
  27. data/test/rails/caching_test.rb +11 -11
  28. data/test/rails/controller_methods_test.rb +63 -57
  29. data/test/rails/rails_integration_test.rb +47 -47
  30. data/test/rails/view_helper_test.rb +31 -26
  31. data/test/rails/widget_generator_test.rb +16 -16
  32. data/test/render_test.rb +50 -50
  33. data/test/request_processor_test.rb +74 -74
  34. data/test/test_case_test.rb +45 -45
  35. data/test/test_helper.rb +14 -10
  36. data/test/tree_node_test.rb +5 -10
  37. data/test/widget_shortcuts_test.rb +25 -25
  38. data/test/widget_test.rb +82 -80
  39. metadata +73 -49
  40. data/README.rdoc +0 -205
  41. data/TODO +0 -36
  42. data/lib/apotomo/proc_event_handler.rb +0 -18
  43. data/test/onfire_integration_test.rb +0 -22
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ab4ff5d6b948831051158089f36e5d1fcc51a6dc
4
+ data.tar.gz: e9a1e8f5307939371bb65eec32838fdfc2c959fd
5
+ SHA512:
6
+ metadata.gz: bbba581bafc616e601e27064061147b369cd510b6842ff0c2bd4612288a1f57bcaddf11947eb5264da482b5324f0233a9a718c60c490080ea4f114081ba70d36
7
+ data.tar.gz: a44b757bb6f0a490f08826680e08ec747a01db2abe95004acf4781188e5f564ee9fa7cb6a557bb348374a824b779f2e19a98ddef682c227cff381199434d3f26
data/.gitignore CHANGED
@@ -1,5 +1,9 @@
1
- pkg/*
1
+ .DS_Store
2
+ pkg
2
3
  *.gem
4
+ .*~
3
5
  .bundle
4
- test/dummy/log/*
5
- test/dummy/tmp/*
6
+ Gemfile*.lock
7
+ test/dummy/log/
8
+ test/dummy/tmp/
9
+ /.rvmrc
data/.travis.yml CHANGED
@@ -1,12 +1,10 @@
1
1
  rvm:
2
- - 1.8.7
3
- - 1.9.2
4
2
  - 1.9.3
5
- - rbx-18mode
6
- - rbx-19mode
7
- - ree
8
- - jruby-18mode
9
- - jruby-19mode
10
- - jruby-head
3
+ - 2.0.0
11
4
  notifications:
12
5
  irc: "irc.freenode.org#cells"
6
+ gemfile:
7
+ - gemfiles/Gemfile.rails3-0
8
+ - gemfiles/Gemfile.rails3-1
9
+ - gemfiles/Gemfile.rails3-2
10
+ - gemfiles/Gemfile.rails4-0
data/CHANGES.textile CHANGED
@@ -1,3 +1,7 @@
1
+ h2. 1.2.4
2
+
3
+ * Make it work with Rails 4.
4
+
1
5
  h2. 1.2.3
2
6
 
3
7
  * Maintenance release to make happy people happy.
@@ -10,7 +14,7 @@ h2. 1.2.1
10
14
 
11
15
  h3. Changes
12
16
  * Save the <code>@options</code> hash in the constructor since we cannot rely on cells anymore.
13
-
17
+
14
18
  h2. 1.2.0
15
19
 
16
20
  h3. Changes
@@ -21,7 +25,7 @@ h3. Changes
21
25
  * Removed @#param@ in favor of @#options@.
22
26
  * Removed @#emit@ in favor of @#render@.
23
27
  * Removed @#remove_all!@ and @#remove_from_parent!@. Did you ever use these?
24
-
28
+
25
29
  h2. 1.1.4
26
30
 
27
31
  h3. Changes
@@ -33,7 +37,7 @@ h2. 1.1.1
33
37
  h3. Additions
34
38
  * You can now attach event handlers to other widgets simply by using the @:passing@ option: @responds_to_event :click, :passing => :root@.
35
39
  * If you want to debug events, just include the (WIP) @apotomo/debugging@ file and watch your server output on the console.
36
-
40
+
37
41
  h3. Changes
38
42
  * @Widget.responds_to_event@ is inheritable now.
39
43
  * The generator now places namespaced widgets into the correct sub-directories.
@@ -68,7 +72,7 @@ h3. Removals
68
72
  * Removed #cell, #container and #section widget shortcuts.
69
73
  * Removed @rendered_children@ local in views. Use #render_widget.
70
74
  * Removed ContainerWidget, nobody needs it.
71
-
75
+
72
76
  h3. Bugfixes
73
77
  * Widget.responds_to_event no longer shares its options with multiple widget instances of the same class.
74
78
 
@@ -94,7 +98,7 @@ h2. 1.0.2
94
98
 
95
99
  h3. Changes
96
100
  * removals from ViewHelper: #trigger_event, #form_to_event and friends as they use deprecated Rails helpers.
97
-
101
+
98
102
  h3. Bugfixes
99
103
  * Widget#fire now accepts payload data for the fired event.
100
104
  * triggered states now receive the event object if they expect one argument.
data/README.md ADDED
@@ -0,0 +1,211 @@
1
+ # Apotomo
2
+
3
+ **Web Components for Rails.**
4
+
5
+ [![TravisCI Build Status](https://secure.travis-ci.org/apotonick/apotomo.png)](http://travis-ci.org/apotonick/apotomo)
6
+
7
+ ## Overview
8
+
9
+ Do you need an _interactive user interface_ for your Rails application? A cool Rich Client Application with dashboards, portlets and AJAX, Drag&Drop and jQuery?
10
+
11
+ Is your controller gettin' fat? And your partial-helper-AJAX pile is getting out of control?
12
+
13
+ Do you want a framework to make the implementation easier? _You want Apotomo._
14
+
15
+ **Apotomo** is based on [Cells](http://github.com/apotonick/cells), the popular View Components framework for Rails.
16
+
17
+ It gives you widgets and encapsulation, bubbling events, AJAX page updates, rock-solid testing and more. Check out <http://apotomo.de> for more information.
18
+
19
+ ## Installation
20
+
21
+ Easy as hell. You just need Ruby 1.9.3/2.0.0 and Rails 3/4.
22
+
23
+ Add Apotomo to your `Gemfile`:
24
+
25
+ ```ruby
26
+ gem `apotomo`
27
+ ```
28
+
29
+ ## Example
30
+
31
+ A _shitty_ example is worse than a _shitty_ framework, so let's choose wisely...
32
+
33
+ Say you had a blog application. The page showing the post should have a comments block, with a list of comments and a form to post a new comment. Submitting should validate and send back the updated comments list, via AJAX.
34
+
35
+ Let's wrap that comments block in a widget.
36
+
37
+ ## Generate
38
+
39
+ Go and generate a widget stub.
40
+
41
+ ```shell
42
+ rails generate apotomo:widget Comments display write -e haml
43
+ ```
44
+
45
+ ```
46
+ create app/widgets/
47
+ create app/widgets/comments_widget.rb
48
+ create app/widgets/comments/
49
+ create app/widgets/comments/display.html.haml
50
+ create app/widgets/comments/write.html.haml
51
+ create test/widgets/
52
+ create test/widgets/comments_widget_test.rb
53
+ ```
54
+
55
+ Nothing special.
56
+
57
+ ## Plug it in
58
+
59
+ You now tell your controller about the new widget.
60
+
61
+ ```ruby
62
+ class PostsController < ApplicationController
63
+
64
+ has_widgets do |root|
65
+ root << widget(:comments, :post => @post)
66
+ end
67
+ ```
68
+
69
+ This creates a widget instance called `comments_widget` from the class CommentsWidget. We pass the current post into the widget - the block is executed in controller instance context, that's were `@post` comes from. Handy, isn't it?
70
+
71
+ ## Render the widget
72
+
73
+ Rendering usually happens in your controller view, `app/views/posts/show.html.haml`, for instance.
74
+
75
+ ```haml
76
+ %h1= @post.title
77
+ %p
78
+ = @post.body
79
+ %p
80
+ = render_widget :comments
81
+ ```
82
+
83
+ ## Write the widget
84
+
85
+ A widget is like a cell which is like a mini-controller.
86
+
87
+ ```ruby
88
+ class CommentsWidget < Apotomo::Widget
89
+ responds_to_event :post
90
+
91
+ def display(args)
92
+ @comments = args[:post].comments # the parameter from outside.
93
+
94
+ render
95
+ end
96
+ ```
97
+
98
+ Having `display` as the default state when rendering, this method collects comments to show and renders its view.
99
+
100
+ And look at line 2 - if encountering a `:post` event we invoke `#post`, which is simply another state. How cool is that?
101
+
102
+ ```ruby
103
+ def post(event)
104
+ @comment = Comment.new :post_id => event[:post_id]
105
+ @comment.update_attributes event[:comment] # a bit like params[].
106
+
107
+ update :state => :display
108
+ end
109
+ end
110
+ ```
111
+
112
+ The event is processed with three steps in our widget:
113
+
114
+ * create the new comment
115
+ * re-render the `display` state
116
+ * update itself on the page
117
+
118
+ Apotomo helps you focusing on your app and takes away the pain of _action dispatching_ and _page updating_.
119
+
120
+ ## Triggering events
121
+
122
+ So how and where is the `:post` event triggered?
123
+
124
+ Take a look at the widget's view `display.html.haml`.
125
+
126
+ ```haml
127
+ = widget_div do
128
+ %ul
129
+ - for comment in @comments
130
+ %li= comment.text
131
+
132
+ = form_for :comment, :url => url_for_event(:post), :remote => true do |f|
133
+ = f.text_field :text
134
+ = f.submit
135
+ ```
136
+
137
+ That's a lot of familiar view code, almost looks like a _partial_.
138
+
139
+ As soon as the form is submitted, the form gets serialized and sent using the standard Rails mechanisms. The interesting part here is the endpoint URL returned by #url_for_event as it will trigger an Apotomo event.
140
+
141
+ ## Event processing
142
+
143
+ Now what happens when the event request is sent? Apotomo - again - does three things for you, it
144
+
145
+ * _accepts the request_ on a special event route it adds to your app
146
+ * _triggers the event_ in your ruby widget tree, which will invoke the `#post` state in our comment widget
147
+ * _sends back_ the page updates your widgets rendered
148
+
149
+ ## JavaScript Agnosticism
150
+
151
+ In this example, we use jQuery for triggering. We could also use Prototype, RightJS, YUI, or a self-baked framework, that's up to you.
152
+
153
+ Also, updating the page is in your hands. Where Apotomo provides handy helpers as `#replace`, you could also _emit your own JavaScript_.
154
+
155
+ Look, `replace` basically generates
156
+
157
+ ```ruby
158
+ jQuery("comments").replaceWith(<the rendered view>);
159
+ ```
160
+
161
+ If that's not what you want, do
162
+
163
+ ```ruby
164
+ def post(event)
165
+ if event[:comment][:text].explicit?
166
+ render :text => 'alert("Hey, you wanted to submit a pervert comment!");'
167
+ end
168
+ end
169
+ ```
170
+
171
+ Apotomo doesn't depend on _any_ JS framework - you choose!
172
+
173
+ ## Testing
174
+
175
+ Apotomo comes with its own test case and assertions to _build rock-solid web components_.
176
+
177
+ ```ruby
178
+ class CommentsWidgetTest < Apotomo::TestCase
179
+ has_widgets do |root|
180
+ root << widget(:comments, :post => @pervert_post)
181
+ end
182
+
183
+ def test_render
184
+ render_widget :comments
185
+ assert_select "li#me"
186
+
187
+ trigger :post, :comment => {:text => "Sex on the beach"}
188
+ assert_response 'alert("Hey, you wanted to submit a pervert comment!");'
189
+ end
190
+ end
191
+ ```
192
+
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
+
195
+ ## Bubbling events
196
+
197
+ Note: Let's write this paragraph!
198
+
199
+ ## Bugs, Community
200
+
201
+ Please visit <http://apotomo.de>, the official project page with _lots_ of examples.
202
+
203
+ If you have questions, visit us in the IRC channel #cells at irc.freenode.org.
204
+
205
+ If you wanna be cool, subscribe to our [feed](http://feeds.feedburner.com/Apotomo)!
206
+
207
+ ## License
208
+
209
+ Copyright (c) 2007-2013 Nick Sutterer <apotonick@gmail.com>
210
+
211
+ Released under the MIT License.
data/apotomo.gemspec CHANGED
@@ -13,19 +13,19 @@ Gem::Specification.new do |s|
13
13
  s.homepage = "http://github.com/apotonick/apotomo"
14
14
  s.summary = %q{Web components for Rails.}
15
15
  s.description = %q{Web component framework for Rails providing widgets that trigger events and know when and how to update themselves with AJAX.}
16
-
16
+
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
-
21
+
22
22
  s.add_dependency "cells", ">= 3.6.7"
23
23
  s.add_dependency "onfire", "~> 0.2.0"
24
- s.add_dependency "hooks", "~> 0.2.0"
24
+ s.add_dependency "hooks", "~> 0.3.0"
25
25
 
26
- s.add_development_dependency "shoulda"
27
26
  s.add_development_dependency "rake"
28
27
  s.add_development_dependency "slim"
29
28
  s.add_development_dependency "haml"
30
29
  s.add_development_dependency "tzinfo"
30
+ s.add_development_dependency "minitest", "~> 4.7.5"
31
31
  end
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"
2
+ match ":controller/render_event_response", :to => "#render_event_response", :as => "apotomo_event", :via => [:get, :post]
3
3
  end
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in apotomo.gemspec
4
+ gemspec path: '../'
5
+
6
+ gem 'railties', '~> 3.0.0'
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in apotomo.gemspec
4
+ gemspec path: '../'
5
+
6
+ gem 'railties', '~> 3.1.0'
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in apotomo.gemspec
4
+ gemspec path: '../'
5
+
6
+ gem 'railties', '~> 3.2.0'
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in apotomo.gemspec
4
+ gemspec path: '../'
5
+
6
+ gem 'railties', '~> 4.0.0'
@@ -24,7 +24,7 @@ module Apotomo
24
24
 
25
25
  module Prototype
26
26
  def prototype; end
27
- def element(id); "$(\"#{id}\")"; end
27
+ def element(id); "jQuery(\"#{id}\")"; end
28
28
  def update(id, markup); element(id) + '.update("'+escape(markup)+'");'; end
29
29
  def replace(id, markup); element(id) + '.replace("'+escape(markup)+'");'; end
30
30
  def update_id(id, markup); update(id, markup); end
@@ -33,7 +33,7 @@ module Apotomo
33
33
 
34
34
  module Right
35
35
  def right; end
36
- def element(id); "$(\"#{id}\")"; end
36
+ def element(id); "jQuery(\"#{id}\")"; end
37
37
  def update(id, markup); element(id) + '.update("'+escape(markup)+'");'; end
38
38
  def replace(id, markup); element(id) + '.replace("'+escape(markup)+'");'; end
39
39
  def update_id(id, markup); update(id, markup); end
@@ -42,7 +42,7 @@ module Apotomo
42
42
 
43
43
  module Jquery
44
44
  def jquery; end
45
- def element(id); "$(\"#{id}\")"; end
45
+ def element(id); "jQuery(\"#{id}\")"; end
46
46
  def update(id, markup); element(id) + '.html("'+escape(markup)+'");'; end
47
47
  def replace(id, markup); element(id) + '.replaceWith("'+escape(markup)+'");'; end
48
48
  def update_id(id, markup); update("##{id}", markup); end
@@ -19,7 +19,7 @@ module Apotomo
19
19
  #
20
20
  # it "should redraw on :update" do
21
21
  # trigger :update
22
- # assert_response "$(\"post-comments\").update ..."
22
+ # assert_response "jQuery(\"post-comments\").update ..."
23
23
  # end
24
24
  #
25
25
  # For unit testing, you can grab an instance of your tested widget.
@@ -35,12 +35,12 @@ module Apotomo
35
35
  extend ActiveSupport::Concern
36
36
 
37
37
  include Cell::TestCase::CommonTestMethods
38
-
38
+
39
39
  attr_reader :view_assigns
40
-
40
+
41
41
  def setup
42
42
  super # defined in Cell::TestCase::CommonTestMethods.
43
-
43
+
44
44
  @controller.instance_eval do
45
45
  def controller_path
46
46
  'barn'
@@ -48,13 +48,14 @@ module Apotomo
48
48
  end
49
49
  @controller.extend Apotomo::Rails::ControllerMethods
50
50
  end
51
-
51
+
52
52
  # Renders the widget +name+.
53
53
  def render_widget(*args)
54
54
  @view_assigns = extract_state_ivars_for(root[args.first]) do
55
55
  @last_invoke = root.render_widget(*args)
56
56
  end
57
-
57
+ cleanup_assigns!(@view_assigns)
58
+
58
59
  @last_invoke
59
60
  end
60
61
 
@@ -76,11 +77,16 @@ module Apotomo
76
77
  self.instance_exec(root, &blk)
77
78
  end
78
79
  end
79
-
80
+
80
81
  def parent_controller
81
82
  @controller
82
83
  end
83
84
 
85
+ private
86
+ def cleanup_assigns!(assigns)
87
+ assigns.delete(:lookup_context) # dirty but it works.
88
+ end
89
+
84
90
  module ClassMethods
85
91
  def has_widgets_blocks
86
92
  @has_widgets
@@ -98,7 +104,7 @@ module Apotomo
98
104
  # Example:
99
105
  #
100
106
  # trigger :submit, :source => "post-comments"
101
- # assert_response "alert(\":submit clicked!\")", /\$\("post-comments"\).update/
107
+ # assert_response "alert(\":submit clicked!\")", /\jQuery\("post-comments"\).update/
102
108
  def assert_response(*content)
103
109
  updates = root.page_updates
104
110
 
@@ -1,3 +1,3 @@
1
1
  module Apotomo
2
- VERSION = '1.2.3'
2
+ VERSION = '1.2.4'
3
3
  end
@@ -15,12 +15,12 @@ module Apotomo
15
15
  #
16
16
  # will render the current state's view and wrap it like
17
17
  #
18
- # "$(\"#mouse\").replaceWith(\"<div id=\\\"mouse\\\">hungry!<\\/div>\")"
18
+ # "jQuery(\"#mouse\").replaceWith(\"<div id=\\\"mouse\\\">hungry!<\\/div>\")"
19
19
  #
20
20
  # You may pass a selector and pass options to render here, as well.
21
21
  #
22
22
  # replace "#jerry h1", :view => :squeak
23
- # #=> "$(\"#jerry h1\").replaceWith(\"<div id=\\\"mouse\\\">squeak!<\\/div>\")"
23
+ # #=> "jQuery(\"#jerry h1\").replaceWith(\"<div id=\\\"mouse\\\">squeak!<\\/div>\")"
24
24
  def replace(*args)
25
25
  wrap_in_javascript_for(:replace, *args)
26
26
  end
@@ -30,7 +30,7 @@ module Apotomo
30
30
  # Example for +:jquery+:
31
31
  #
32
32
  # update :view => :peek
33
- # #=> "$(\"#mouse\").html(\"looking...")"
33
+ # #=> "jQuery(\"#mouse\").html(\"looking...")"
34
34
  def update(*args)
35
35
  wrap_in_javascript_for(:update, *args)
36
36
  end
@@ -3,7 +3,7 @@ module Apotomo
3
3
  include Enumerable
4
4
  include Apotomo::WidgetShortcuts::DSL
5
5
 
6
- attr_reader :name, :childrenHash
6
+ attr_reader :childrenHash
7
7
  attr_accessor :parent
8
8
 
9
9
  def setup_tree_node(parent)
@@ -68,7 +68,9 @@ module Apotomo
68
68
  abstract!
69
69
  undef :display # We don't want #display to be listed in #internal_methods.
70
70
 
71
+ attr_reader :name
71
72
  alias_method :widget_id, :name
73
+
72
74
  attr_reader :options
73
75
 
74
76
  after_initialize do
@@ -106,9 +108,7 @@ module Apotomo
106
108
  # a state method.
107
109
  #
108
110
  # ==== Options
109
- # * <tt>:view</tt> - Renders +view+. Defaults to the current state name.
110
- # * <tt>:state</tt> - Invokes the +state+ method and returns whatever the state returns.
111
- # * See http://rdoc.info/gems/cells/3.5.4/Cell/Rails#render-instance_method
111
+ # * See http://rdoc.info/gems/cells/Cell/Rails:render
112
112
  #
113
113
  # Example:
114
114
  # class MouseWidget < Apotomo::Widget
@@ -15,7 +15,7 @@ module Apotomo
15
15
  source_root File.expand_path('../../templates', __FILE__)
16
16
 
17
17
  hook_for(:template_engine)
18
- hook_for(:test_framework) # TODO: implement rspec-apotomo.
18
+ hook_for(:test_framework)
19
19
 
20
20
  check_class_collision :suffix => "Widget"
21
21
 
@@ -1,4 +1,3 @@
1
- h1
2
- <%= class_name %>Widget#<%= @state %>
3
- p
4
- Find me in <%= @path %>
1
+ = widget_div do
2
+ h1 <%= class_name %>Widget#<%= @state %>
3
+ p Find me in <%= @path %>
data/test/apotomo_test.rb CHANGED
@@ -1,20 +1,31 @@
1
1
  require 'test_helper'
2
2
 
3
- class ApotomoTest < Test::Unit::TestCase
4
- context "The main module" do
5
- should "save the JavascriptGenerator instance when setting js_framework" do
6
- Apotomo.js_framework = :jquery
7
- assert_respond_to Apotomo.js_generator, :jquery
8
- end
9
-
10
- should "have an accessor for js_framework" do
11
- Apotomo.js_framework = :jquery
12
- assert_equal :jquery, Apotomo.js_framework
3
+ class ApotomoTest < MiniTest::Spec
4
+ describe "The main module ::Apotomo" do
5
+ describe "when setting #js_framework" do
6
+ before do
7
+ Apotomo.js_framework = :jquery
8
+ end
9
+
10
+ it "respond to #js_framework" do
11
+ assert_equal :jquery, Apotomo.js_framework
12
+ end
13
+
14
+ it "respond to #js_generator" do
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
21
+ end
13
22
  end
14
-
15
- should "have a setup method" do
16
- Apotomo.setup { |config| config.js_framework = :prototype }
17
- assert_respond_to Apotomo.js_generator, :prototype
23
+
24
+ it "respond to #setup" do
25
+ Apotomo.setup { |config| config.js_framework = :jquery }
26
+ # TODO: Apotomo expect #js_framework
27
+ assert_respond_to Apotomo.js_generator, :jquery
18
28
  end
19
29
  end
20
30
  end
31
+
@@ -1,59 +1,4 @@
1
1
  Dummy::Application.routes.draw do
2
- # The priority is based upon order of creation:
3
- # first created -> highest priority.
4
-
5
- # Sample of regular route:
6
- # match 'products/:id' => 'catalog#view'
7
- # Keep in mind you can assign values other than :controller and :action
8
-
9
- # Sample of named route:
10
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
- # This route can be invoked with purchase_url(:id => product.id)
12
-
13
- # Sample resource route (maps HTTP verbs to controller actions automatically):
14
- # resources :products
15
-
16
- # Sample resource route with options:
17
- # resources :products do
18
- # member do
19
- # get 'short'
20
- # post 'toggle'
21
- # end
22
- #
23
- # collection do
24
- # get 'sold'
25
- # end
26
- # end
27
-
28
- # Sample resource route with sub-resources:
29
- # resources :products do
30
- # resources :comments, :sales
31
- # resource :seller
32
- # end
33
-
34
- # Sample resource route with more complex sub-resources
35
- # resources :products do
36
- # resources :comments
37
- # resources :sales do
38
- # get 'recent', :on => :collection
39
- # end
40
- # end
41
-
42
- # Sample resource route within a namespace:
43
- # namespace :admin do
44
- # # Directs /admin/products/* to Admin::ProductsController
45
- # # (app/controllers/admin/products_controller.rb)
46
- # resources :products
47
- # end
48
-
49
- # You can have the root of your site routed with "root"
50
- # just remember to delete public/index.html.
51
- # root :to => "welcome#index"
52
-
53
- # See how all your routes lay out with "rake routes"
54
-
55
- # This is a legacy wild controller route that's not recommended for RESTful applications.
56
- # Note: This route will make all actions in every controller accessible via GET requests.
57
- match "barn/widget", :to => "barn#widget"
58
- match ':controller(/:action(/:id(.:format)))'
2
+ get "barn/widget", :to => "barn#widget"
3
+ get ':controller(/:action(/:id(.:format)))'
59
4
  end