controll 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +19 -0
  4. data/Gemfile.lock +134 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +320 -0
  7. data/Rakefile +49 -0
  8. data/VERSION +1 -0
  9. data/controll.gemspec +184 -0
  10. data/lib/controll.rb +14 -0
  11. data/lib/controll/assistant.rb +19 -0
  12. data/lib/controll/command.rb +24 -0
  13. data/lib/controll/commander.rb +24 -0
  14. data/lib/controll/errors.rb +1 -0
  15. data/lib/controll/executor.rb +6 -0
  16. data/lib/controll/executor/base.rb +16 -0
  17. data/lib/controll/executor/notificator.rb +12 -0
  18. data/lib/controll/flow_handler.rb +11 -0
  19. data/lib/controll/flow_handler/base.rb +19 -0
  20. data/lib/controll/flow_handler/control.rb +85 -0
  21. data/lib/controll/flow_handler/errors.rb +5 -0
  22. data/lib/controll/flow_handler/event_helper.rb +18 -0
  23. data/lib/controll/flow_handler/redirect.rb +51 -0
  24. data/lib/controll/flow_handler/redirect/action.rb +45 -0
  25. data/lib/controll/flow_handler/redirect/mapper.rb +41 -0
  26. data/lib/controll/flow_handler/render.rb +51 -0
  27. data/lib/controll/helper.rb +101 -0
  28. data/lib/controll/helper/event_matcher.rb +21 -0
  29. data/lib/controll/helper/hash_access.rb +26 -0
  30. data/lib/controll/helper/notify.rb +74 -0
  31. data/lib/controll/helper/params.rb +20 -0
  32. data/lib/controll/helper/path_resolver.rb +45 -0
  33. data/lib/controll/helper/session.rb +20 -0
  34. data/lib/controll/notify.rb +7 -0
  35. data/lib/controll/notify/base.rb +75 -0
  36. data/lib/controll/notify/flash.rb +52 -0
  37. data/lib/controll/notify/typed.rb +39 -0
  38. data/spec/acceptance/app_test.rb +156 -0
  39. data/spec/app/.gitignore +15 -0
  40. data/spec/app/Gemfile +6 -0
  41. data/spec/app/Gemfile.lock +108 -0
  42. data/spec/app/README.rdoc +261 -0
  43. data/spec/app/Rakefile +7 -0
  44. data/spec/app/app/controllers/application_controller.rb +6 -0
  45. data/spec/app/app/controllers/posts_controller.rb +52 -0
  46. data/spec/app/app/models/.gitkeep +0 -0
  47. data/spec/app/app/models/post.rb +88 -0
  48. data/spec/app/app/views/layouts/application.html.erb +13 -0
  49. data/spec/app/app/views/posts/_form.html.erb +31 -0
  50. data/spec/app/app/views/posts/edit.html.erb +6 -0
  51. data/spec/app/app/views/posts/index.html.erb +23 -0
  52. data/spec/app/app/views/posts/new.html.erb +5 -0
  53. data/spec/app/app/views/posts/show.html.erb +8 -0
  54. data/spec/app/config.ru +4 -0
  55. data/spec/app/config/application.rb +16 -0
  56. data/spec/app/config/boot.rb +6 -0
  57. data/spec/app/config/environment.rb +5 -0
  58. data/spec/app/config/environments/development.rb +21 -0
  59. data/spec/app/config/environments/test.rb +29 -0
  60. data/spec/app/config/initializers/backtrace_silencers.rb +7 -0
  61. data/spec/app/config/initializers/inflections.rb +15 -0
  62. data/spec/app/config/initializers/mime_types.rb +5 -0
  63. data/spec/app/config/initializers/secret_token.rb +7 -0
  64. data/spec/app/config/initializers/session_store.rb +8 -0
  65. data/spec/app/config/locales/en.yml +5 -0
  66. data/spec/app/config/routes.rb +62 -0
  67. data/spec/app/db/seeds.rb +7 -0
  68. data/spec/app/lib/assets/.gitkeep +0 -0
  69. data/spec/app/lib/tasks/.gitkeep +0 -0
  70. data/spec/app/log/.gitkeep +0 -0
  71. data/spec/app/public/404.html +26 -0
  72. data/spec/app/public/422.html +26 -0
  73. data/spec/app/public/500.html +25 -0
  74. data/spec/app/public/favicon.ico +0 -0
  75. data/spec/app/public/index.html +241 -0
  76. data/spec/app/public/javascripts/application.js +9663 -0
  77. data/spec/app/public/robots.txt +5 -0
  78. data/spec/app/public/stylesheets/application.css +83 -0
  79. data/spec/app/script/rails +6 -0
  80. data/spec/app/spec/controllers/posts_controller_spec.rb +59 -0
  81. data/spec/app/spec/isolated_spec_helper.rb +6 -0
  82. data/spec/app/spec/spec_helper.rb +5 -0
  83. data/spec/app/spec/unit/controllers/posts_controller_isolated_spec.rb +63 -0
  84. data/spec/app/spec/unit/controllers/posts_controller_spec.rb +59 -0
  85. data/spec/app/test/functional/.gitkeep +0 -0
  86. data/spec/app/test/functional/posts_controller_test.rb +67 -0
  87. data/spec/app/test/isolated_test_helper.rb +7 -0
  88. data/spec/app/test/test_helper.rb +6 -0
  89. data/spec/app/test/unit/.gitkeep +0 -0
  90. data/spec/app/test/unit/controllers/posts_controller_isolated_test.rb +71 -0
  91. data/spec/app/test/unit/controllers/posts_controller_test.rb +67 -0
  92. data/spec/app/vendor/assets/javascripts/.gitkeep +0 -0
  93. data/spec/app/vendor/assets/stylesheets/.gitkeep +0 -0
  94. data/spec/app/vendor/plugins/.gitkeep +0 -0
  95. data/spec/controll/asssistant_spec.rb +5 -0
  96. data/spec/controll/command_spec.rb +56 -0
  97. data/spec/controll/commander_spec.rb +68 -0
  98. data/spec/controll/executor/notificator_spec.rb +27 -0
  99. data/spec/controll/flow_handler/control_spec.rb +159 -0
  100. data/spec/controll/flow_handler/redirect/action_spec.rb +48 -0
  101. data/spec/controll/flow_handler/redirect/mapper_spec.rb +69 -0
  102. data/spec/controll/flow_handler/redirect_spec.rb +93 -0
  103. data/spec/controll/flow_handler/render_spec.rb +110 -0
  104. data/spec/controll/helper/event_matcher_spec.rb +21 -0
  105. data/spec/controll/helper/hash_access_spec.rb +25 -0
  106. data/spec/controll/helper/notify_spec.rb +48 -0
  107. data/spec/controll/helper/params_spec.rb +28 -0
  108. data/spec/controll/helper/path_resolver_spec.rb +49 -0
  109. data/spec/controll/helper/session_spec.rb +28 -0
  110. data/spec/controll/helper_spec.rb +108 -0
  111. data/spec/controll/notify/base_spec.rb +123 -0
  112. data/spec/controll/notify/flash_spec.rb +27 -0
  113. data/spec/controll/notify/message_handler.rb +72 -0
  114. data/spec/controll/notify/typed_spec.rb +28 -0
  115. data/spec/functional_test_helper.rb +25 -0
  116. data/spec/helper.rb +33 -0
  117. data/spec/rspec_controller_class.rb +15 -0
  118. data/spec/rspec_functional_helper.rb +25 -0
  119. data/spec/rspec_helper.rb +42 -0
  120. data/spec/spec_helper.rb +11 -0
  121. data/spec/test_helper.rb +183 -0
  122. data/spec/unit/functional_test_helper_test.rb +65 -0
  123. data/spec/unit/macros_test.rb +43 -0
  124. data/spec/unit/mixin_test.rb +147 -0
  125. data/spec/unit/rspec_functional_helper.rb +42 -0
  126. data/spec/unit/rspec_helper_test.rb +91 -0
  127. data/spec/unit/test_helper_test.rb +235 -0
  128. metadata +289 -0
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,83 @@
1
+ /* This is a static file. It was exported so we don't have to depend on
2
+ * the asset pipeline, so we can run the app against Rails 3.0 too. */
3
+
4
+ /* line 1, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
5
+ body {
6
+ background-color: #fff;
7
+ color: #333;
8
+ font-family: verdana, arial, helvetica, sans-serif;
9
+ font-size: 13px;
10
+ line-height: 18px;
11
+ }
12
+
13
+ /* line 8, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
14
+ p, ol, ul, td {
15
+ font-family: verdana, arial, helvetica, sans-serif;
16
+ font-size: 13px;
17
+ line-height: 18px;
18
+ }
19
+
20
+ /* line 13, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
21
+ pre {
22
+ background-color: #eee;
23
+ padding: 10px;
24
+ font-size: 11px;
25
+ }
26
+
27
+ /* line 18, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
28
+ a {
29
+ color: #000;
30
+ }
31
+ /* line 20, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
32
+ a:visited {
33
+ color: #666;
34
+ }
35
+ /* line 22, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
36
+ a:hover {
37
+ color: #fff;
38
+ background-color: #000;
39
+ }
40
+
41
+ /* line 27, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
42
+ div.field, div.actions {
43
+ margin-bottom: 10px;
44
+ }
45
+
46
+ /* line 30, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
47
+ #notice {
48
+ color: green;
49
+ }
50
+
51
+ /* line 33, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
52
+ .field_with_errors {
53
+ padding: 2px;
54
+ background-color: red;
55
+ display: table;
56
+ }
57
+
58
+ /* line 38, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
59
+ #error_explanation {
60
+ width: 450px;
61
+ border: 2px solid red;
62
+ padding: 7px;
63
+ padding-bottom: 0;
64
+ margin-bottom: 20px;
65
+ background-color: #f0f0f0;
66
+ }
67
+ /* line 45, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
68
+ #error_explanation h2 {
69
+ text-align: left;
70
+ font-weight: bold;
71
+ padding: 5px 5px 5px 15px;
72
+ font-size: 12px;
73
+ margin: -7px;
74
+ margin-bottom: 0px;
75
+ background-color: #c00;
76
+ color: #fff;
77
+ }
78
+ /* line 54, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
79
+ #error_explanation ul li {
80
+ font-size: 12px;
81
+ list-style: square;
82
+ }
83
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ describe PostsController do
4
+ include FocusedController::RSpecFunctionalHelper
5
+
6
+ before do
7
+ @post = Post.create(:title => 'Hello', :body => 'Omg')
8
+ end
9
+
10
+ describe PostsController::Index do
11
+ it "should get index" do
12
+ get
13
+ response.should be_success
14
+ subject.posts.should_not be_nil
15
+ end
16
+ end
17
+
18
+ describe PostsController::New do
19
+ it "should get new" do
20
+ get
21
+ response.should be_success
22
+ end
23
+ end
24
+
25
+ describe PostsController::Create do
26
+ it "should create post" do
27
+ expect { post :post => @post.attributes }.to change(Post, :count).by(1)
28
+ response.should redirect_to(post_path(subject.post))
29
+ end
30
+ end
31
+
32
+ describe PostsController::Show do
33
+ it "should show post" do
34
+ get :id => @post.id
35
+ response.should be_success
36
+ end
37
+ end
38
+
39
+ describe PostsController::Edit do
40
+ it "should get edit" do
41
+ get :id => @post.id
42
+ response.should be_success
43
+ end
44
+ end
45
+
46
+ describe PostsController::Update do
47
+ it "should update post" do
48
+ put :id => @post.id, :post => @post.attributes
49
+ response.should redirect_to(post_path(subject.post))
50
+ end
51
+ end
52
+
53
+ describe PostsController::Destroy do
54
+ it "should destroy post" do
55
+ expect { delete :id => @post.id }.to change(Post, :count).by(-1)
56
+ response.should redirect_to(posts_path)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,6 @@
1
+ require 'bundler/setup'
2
+ require 'rspec'
3
+ require 'focused_controller/rspec_helper'
4
+
5
+ APP_ROOT = File.expand_path('../../app', __FILE__)
6
+ POSTS = []
@@ -0,0 +1,5 @@
1
+ require 'rails/application'
2
+ require File.expand_path("../../config/environment", __FILE__)
3
+ require 'rspec'
4
+ require 'focused_controller/rspec_helper'
5
+ require 'focused_controller/rspec_functional_helper'
@@ -0,0 +1,63 @@
1
+ require 'isolated_spec_helper'
2
+ require APP_ROOT + '/controllers/application_controller'
3
+ require APP_ROOT + '/controllers/posts_controller'
4
+ require APP_ROOT + '/models/post'
5
+
6
+ describe PostsController do
7
+ include FocusedController::RSpecHelper
8
+ stub_url :post, :posts
9
+
10
+ before do
11
+ @post = Post.create(:title => 'Hello', :body => 'Omg')
12
+ end
13
+
14
+ describe PostsController::Index do
15
+ it "should get index" do
16
+ req
17
+ response.should be_success
18
+ subject.posts.should_not be(:nil)
19
+ end
20
+ end
21
+
22
+ describe PostsController::New do
23
+ it "should get new" do
24
+ req
25
+ response.should be_success
26
+ end
27
+ end
28
+
29
+ describe PostsController::Create do
30
+ it "should create post" do
31
+ expect { req :post => @post.attributes }.to change(Post, :count).by(1)
32
+ response.should redirect_to(post_url(subject.post))
33
+ end
34
+ end
35
+
36
+ describe PostsController::Show do
37
+ it "should show post" do
38
+ req :id => @post.id
39
+ response.should be_success
40
+ end
41
+ end
42
+
43
+ describe PostsController::Edit do
44
+ it "should get edit" do
45
+ req :id => @post.id
46
+ response.should be_success
47
+ end
48
+ end
49
+
50
+ describe PostsController::Update do
51
+ it "should update post" do
52
+ req :id => @post.id
53
+ response.should redirect_to(post_url(subject.post))
54
+ end
55
+ end
56
+
57
+ describe PostsController::Destroy do
58
+ it "should destroy post" do
59
+ expect { req :id => @post.id }.to change(Post, :count).by(-1)
60
+ response.should redirect_to(posts_url)
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ describe PostsController do
4
+ include FocusedController::RSpecHelper
5
+
6
+ before do
7
+ @post = Post.create(:title => 'Hello', :body => 'Omg')
8
+ end
9
+
10
+ describe PostsController::Index do
11
+ it "should get index" do
12
+ req
13
+ response.should be_success
14
+ subject.posts.should_not be(:nil)
15
+ end
16
+ end
17
+
18
+ describe PostsController::New do
19
+ it "should get new" do
20
+ req
21
+ response.should be_success
22
+ end
23
+ end
24
+
25
+ describe PostsController::Create do
26
+ it "should create post" do
27
+ expect { req :post => @post.attributes }.to change(Post, :count).by(1)
28
+ response.should redirect_to(post_path(subject.post))
29
+ end
30
+ end
31
+
32
+ describe PostsController::Show do
33
+ it "should show post" do
34
+ req :id => @post.id
35
+ response.should be_success
36
+ end
37
+ end
38
+
39
+ describe PostsController::Edit do
40
+ it "should get edit" do
41
+ req :id => @post.id
42
+ response.should be_success
43
+ end
44
+ end
45
+
46
+ describe PostsController::Update do
47
+ it "should update post" do
48
+ req :id => @post.id
49
+ response.should redirect_to(post_path(subject.post))
50
+ end
51
+ end
52
+
53
+ describe PostsController::Destroy do
54
+ it "should destroy post" do
55
+ expect { req :id => @post.id }.to change(Post, :count).by(-1)
56
+ response.should redirect_to(posts_path)
57
+ end
58
+ end
59
+ end
File without changes
@@ -0,0 +1,67 @@
1
+ require 'test_helper'
2
+
3
+ module PostsController
4
+ class TestCase < ActionController::TestCase
5
+ include FocusedController::FunctionalTestHelper
6
+
7
+ setup do
8
+ @post = Post.create(:title => 'Hello', :body => 'Omg')
9
+ end
10
+ end
11
+
12
+ class IndexTest < TestCase
13
+ test "should get index" do
14
+ get
15
+ assert_response :success
16
+ assert_not_nil @controller.posts
17
+ end
18
+ end
19
+
20
+ class NewTest < TestCase
21
+ test "should get new" do
22
+ get
23
+ assert_response :success
24
+ end
25
+ end
26
+
27
+ class CreateTest < TestCase
28
+ test "should create post" do
29
+ assert_difference('Post.count') do
30
+ post :post => @post.attributes
31
+ end
32
+
33
+ assert_redirected_to post_path(@controller.post)
34
+ end
35
+ end
36
+
37
+ class ShowTest < TestCase
38
+ test "should show post" do
39
+ get :id => @post.id
40
+ assert_response :success
41
+ end
42
+ end
43
+
44
+ class EditTest < TestCase
45
+ test "should get edit" do
46
+ get :id => @post.id
47
+ assert_response :success
48
+ end
49
+ end
50
+
51
+ class UpdateTest < TestCase
52
+ test "should update post" do
53
+ put :id => @post.id, :post => @post.attributes
54
+ assert_redirected_to post_path(@controller.post)
55
+ end
56
+ end
57
+
58
+ class DestroyTest < TestCase
59
+ test "should destroy post" do
60
+ assert_difference('Post.count', -1) do
61
+ delete :id => @post.id
62
+ end
63
+
64
+ assert_redirected_to posts_path
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,7 @@
1
+ require 'bundler/setup'
2
+ require 'test/unit'
3
+ require 'active_support/test_case'
4
+ require 'focused_controller/test_helper'
5
+
6
+ APP_ROOT = File.expand_path('../../app', __FILE__)
7
+ POSTS = []
@@ -0,0 +1,6 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ require 'focused_controller/functional_test_helper'
6
+ require 'focused_controller/test_helper'
File without changes
@@ -0,0 +1,71 @@
1
+ require 'isolated_test_helper'
2
+ require APP_ROOT + '/controllers/application_controller'
3
+ require APP_ROOT + '/controllers/posts_controller'
4
+ require APP_ROOT + '/models/post'
5
+
6
+ module PostsController
7
+ class TestCase < ActiveSupport::TestCase
8
+ include FocusedController::TestHelper
9
+ stub_url :post, :posts
10
+
11
+ setup do
12
+ @post = Post.create(:title => 'Hello', :body => 'Omg')
13
+ end
14
+ end
15
+
16
+ class IndexTest < TestCase
17
+ test "should get index" do
18
+ req
19
+ assert_response :success
20
+ assert_not_nil controller.posts
21
+ end
22
+ end
23
+
24
+ class NewTest < TestCase
25
+ test "should get new" do
26
+ req
27
+ assert_response :success
28
+ end
29
+ end
30
+
31
+ class CreateTest < TestCase
32
+ test "should create post" do
33
+ assert_difference('Post.count') do
34
+ req :post => @post.attributes
35
+ end
36
+
37
+ assert_redirected_to post_url(controller.post)
38
+ end
39
+ end
40
+
41
+ class ShowTest < TestCase
42
+ test "should show post" do
43
+ req :id => @post.id
44
+ assert_response :success
45
+ end
46
+ end
47
+
48
+ class EditTest < TestCase
49
+ test "should get edit" do
50
+ req :id => @post.id
51
+ assert_response :success
52
+ end
53
+ end
54
+
55
+ class UpdateTest < TestCase
56
+ test "should update post" do
57
+ req :id => @post.id
58
+ assert_redirected_to post_url(controller.post)
59
+ end
60
+ end
61
+
62
+ class DestroyTest < TestCase
63
+ test "should destroy post" do
64
+ assert_difference('Post.count', -1) do
65
+ req :id => @post.id
66
+ end
67
+
68
+ assert_redirected_to posts_url
69
+ end
70
+ end
71
+ end