apotomo 0.1.4 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/Gemfile +5 -2
  2. data/Gemfile.lock +70 -21
  3. data/Rakefile +7 -7
  4. data/config/routes.rb +3 -3
  5. data/lib/apotomo/persistence.rb +21 -48
  6. data/lib/apotomo/rails/view_helper.rb +3 -11
  7. data/lib/apotomo/request_processor.rb +7 -10
  8. data/lib/apotomo/transition.rb +2 -2
  9. data/lib/apotomo/version.rb +1 -1
  10. data/lib/apotomo/widget.rb +12 -25
  11. data/lib/apotomo/widget_shortcuts.rb +1 -1
  12. data/lib/apotomo.rb +6 -0
  13. data/{generators/widget → lib/generators/apotomo}/USAGE +0 -0
  14. data/lib/generators/apotomo/templates/view.erb +7 -0
  15. data/lib/generators/apotomo/templates/view.haml +4 -0
  16. data/{generators/widget → lib/generators/apotomo}/templates/widget.rb +2 -1
  17. data/lib/generators/apotomo/templates/widget_test.rb +11 -0
  18. data/lib/generators/apotomo/widget_generator.rb +19 -0
  19. data/test/dummy/app/controllers/application_controller.rb +3 -0
  20. data/test/dummy/app/helpers/application_helper.rb +2 -0
  21. data/test/dummy/config/application.rb +45 -0
  22. data/test/dummy/config/boot.rb +10 -0
  23. data/test/dummy/config/environment.rb +5 -0
  24. data/test/dummy/config/environments/development.rb +26 -0
  25. data/test/dummy/config/environments/production.rb +49 -0
  26. data/test/dummy/config/environments/test.rb +35 -0
  27. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  28. data/test/dummy/config/initializers/inflections.rb +10 -0
  29. data/test/dummy/config/initializers/mime_types.rb +5 -0
  30. data/test/dummy/config/initializers/secret_token.rb +7 -0
  31. data/test/dummy/config/initializers/session_store.rb +8 -0
  32. data/test/dummy/config/routes.rb +59 -0
  33. data/test/dummy/tmp/app/cells/mouse_widget.rb +11 -0
  34. data/test/dummy/tmp/test/widgets/mouse_widget_test.rb +15 -0
  35. data/test/rails/controller_methods_test.rb +11 -14
  36. data/test/rails/rails_integration_test.rb +12 -11
  37. data/test/rails/view_helper_test.rb +4 -27
  38. data/test/rails/view_methods_test.rb +4 -6
  39. data/test/rails/widget_generator_test.rb +40 -37
  40. data/test/support/test_case_methods.rb +34 -7
  41. data/test/test_helper.rb +12 -24
  42. data/test/unit/container_test.rb +2 -1
  43. data/test/unit/event_handler_test.rb +2 -0
  44. data/test/unit/event_methods_test.rb +4 -3
  45. data/test/unit/invoke_test.rb +27 -22
  46. data/test/unit/onfire_integration_test.rb +2 -0
  47. data/test/unit/persistence_test.rb +51 -90
  48. data/test/unit/render_test.rb +6 -4
  49. data/test/unit/request_processor_test.rb +70 -48
  50. data/test/unit/stateful_widget_test.rb +3 -1
  51. data/test/unit/transition_test.rb +1 -0
  52. data/test/unit/widget_shortcuts_test.rb +3 -2
  53. data/test/unit/widget_test.rb +69 -56
  54. metadata +57 -34
  55. data/app/.jeweler_doesnt_like_empty_directories +0 -0
  56. data/generators/widget/templates/functional_test.rb +0 -8
  57. data/generators/widget/templates/view.html.erb +0 -2
  58. data/generators/widget/templates/view.html.haml +0 -3
  59. data/generators/widget/widget_generator.rb +0 -34
  60. data/lib/apotomo/test_methods.rb +0 -8
  61. data/test/support/assertions_helper.rb +0 -13
  62. data/test/unit/test_methods_test.rb +0 -11
@@ -1,34 +0,0 @@
1
- require 'rails_generator/generators/components/controller/controller_generator'
2
-
3
- class WidgetGenerator < ControllerGenerator
4
- def add_options!(opt)
5
- opt.on('--haml') { |value| options[:view_format] = 'haml' }
6
- end
7
-
8
- def manifest
9
- options.reverse_merge! :view_format => 'erb'
10
-
11
- record do |m|
12
- # Check for class naming collisions.
13
- m.class_collisions class_path, "#{class_name}"
14
-
15
- # Directories
16
- m.directory File.join('app/cells', class_path)
17
- m.directory File.join('app/cells', class_path, file_name)
18
- m.directory File.join('test/widgets')
19
-
20
- # Widget
21
- m.template 'widget.rb', File.join('app/cells', class_path, "#{file_name}.rb")
22
-
23
- # View template for each state.
24
- format = options[:view_format]
25
- actions.each do |state|
26
- path = File.join('app/cells', class_path, file_name, "#{state}.html.#{format}")
27
- m.template "view.html.#{format}", path, :assigns => { :action => state, :path => path }
28
- end
29
-
30
- # Functional test for the widget.
31
- m.template 'functional_test.rb', File.join('test/widgets/', "#{file_name}_test.rb"), :assigns => {:states => actions}
32
- end
33
- end
34
- end
@@ -1,8 +0,0 @@
1
- module Apotomo
2
- module TestMethods
3
- def render_widget(*args)
4
- @controller.render_widget(*args)
5
- end
6
-
7
- end
8
- end
@@ -1,13 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Apotomo
4
- module AssertionsHelper
5
- def assert_selekt(content, *args)
6
- assert_select(HTML::Document.new(content).root, *args)
7
- end
8
-
9
- def assert_not(assertion)
10
- assert !assertion
11
- end
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- require 'test_helper'
2
- require 'apotomo/test_methods'
3
-
4
- class TestMethodsTest < Test::Unit::TestCase
5
- include Apotomo::TestMethods
6
- context "A Unit test with included module" do
7
- should "provide #render_widget" do
8
- assert_respond_to self, :render_widget
9
- end
10
- end
11
- end