controll 0.2.0
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.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +134 -0
- data/LICENSE.txt +20 -0
- data/README.md +320 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/controll.gemspec +184 -0
- data/lib/controll.rb +14 -0
- data/lib/controll/assistant.rb +19 -0
- data/lib/controll/command.rb +24 -0
- data/lib/controll/commander.rb +24 -0
- data/lib/controll/errors.rb +1 -0
- data/lib/controll/executor.rb +6 -0
- data/lib/controll/executor/base.rb +16 -0
- data/lib/controll/executor/notificator.rb +12 -0
- data/lib/controll/flow_handler.rb +11 -0
- data/lib/controll/flow_handler/base.rb +19 -0
- data/lib/controll/flow_handler/control.rb +85 -0
- data/lib/controll/flow_handler/errors.rb +5 -0
- data/lib/controll/flow_handler/event_helper.rb +18 -0
- data/lib/controll/flow_handler/redirect.rb +51 -0
- data/lib/controll/flow_handler/redirect/action.rb +45 -0
- data/lib/controll/flow_handler/redirect/mapper.rb +41 -0
- data/lib/controll/flow_handler/render.rb +51 -0
- data/lib/controll/helper.rb +101 -0
- data/lib/controll/helper/event_matcher.rb +21 -0
- data/lib/controll/helper/hash_access.rb +26 -0
- data/lib/controll/helper/notify.rb +74 -0
- data/lib/controll/helper/params.rb +20 -0
- data/lib/controll/helper/path_resolver.rb +45 -0
- data/lib/controll/helper/session.rb +20 -0
- data/lib/controll/notify.rb +7 -0
- data/lib/controll/notify/base.rb +75 -0
- data/lib/controll/notify/flash.rb +52 -0
- data/lib/controll/notify/typed.rb +39 -0
- data/spec/acceptance/app_test.rb +156 -0
- data/spec/app/.gitignore +15 -0
- data/spec/app/Gemfile +6 -0
- data/spec/app/Gemfile.lock +108 -0
- data/spec/app/README.rdoc +261 -0
- data/spec/app/Rakefile +7 -0
- data/spec/app/app/controllers/application_controller.rb +6 -0
- data/spec/app/app/controllers/posts_controller.rb +52 -0
- data/spec/app/app/models/.gitkeep +0 -0
- data/spec/app/app/models/post.rb +88 -0
- data/spec/app/app/views/layouts/application.html.erb +13 -0
- data/spec/app/app/views/posts/_form.html.erb +31 -0
- data/spec/app/app/views/posts/edit.html.erb +6 -0
- data/spec/app/app/views/posts/index.html.erb +23 -0
- data/spec/app/app/views/posts/new.html.erb +5 -0
- data/spec/app/app/views/posts/show.html.erb +8 -0
- data/spec/app/config.ru +4 -0
- data/spec/app/config/application.rb +16 -0
- data/spec/app/config/boot.rb +6 -0
- data/spec/app/config/environment.rb +5 -0
- data/spec/app/config/environments/development.rb +21 -0
- data/spec/app/config/environments/test.rb +29 -0
- data/spec/app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/app/config/initializers/inflections.rb +15 -0
- data/spec/app/config/initializers/mime_types.rb +5 -0
- data/spec/app/config/initializers/secret_token.rb +7 -0
- data/spec/app/config/initializers/session_store.rb +8 -0
- data/spec/app/config/locales/en.yml +5 -0
- data/spec/app/config/routes.rb +62 -0
- data/spec/app/db/seeds.rb +7 -0
- data/spec/app/lib/assets/.gitkeep +0 -0
- data/spec/app/lib/tasks/.gitkeep +0 -0
- data/spec/app/log/.gitkeep +0 -0
- data/spec/app/public/404.html +26 -0
- data/spec/app/public/422.html +26 -0
- data/spec/app/public/500.html +25 -0
- data/spec/app/public/favicon.ico +0 -0
- data/spec/app/public/index.html +241 -0
- data/spec/app/public/javascripts/application.js +9663 -0
- data/spec/app/public/robots.txt +5 -0
- data/spec/app/public/stylesheets/application.css +83 -0
- data/spec/app/script/rails +6 -0
- data/spec/app/spec/controllers/posts_controller_spec.rb +59 -0
- data/spec/app/spec/isolated_spec_helper.rb +6 -0
- data/spec/app/spec/spec_helper.rb +5 -0
- data/spec/app/spec/unit/controllers/posts_controller_isolated_spec.rb +63 -0
- data/spec/app/spec/unit/controllers/posts_controller_spec.rb +59 -0
- data/spec/app/test/functional/.gitkeep +0 -0
- data/spec/app/test/functional/posts_controller_test.rb +67 -0
- data/spec/app/test/isolated_test_helper.rb +7 -0
- data/spec/app/test/test_helper.rb +6 -0
- data/spec/app/test/unit/.gitkeep +0 -0
- data/spec/app/test/unit/controllers/posts_controller_isolated_test.rb +71 -0
- data/spec/app/test/unit/controllers/posts_controller_test.rb +67 -0
- data/spec/app/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/app/vendor/plugins/.gitkeep +0 -0
- data/spec/controll/asssistant_spec.rb +5 -0
- data/spec/controll/command_spec.rb +56 -0
- data/spec/controll/commander_spec.rb +68 -0
- data/spec/controll/executor/notificator_spec.rb +27 -0
- data/spec/controll/flow_handler/control_spec.rb +159 -0
- data/spec/controll/flow_handler/redirect/action_spec.rb +48 -0
- data/spec/controll/flow_handler/redirect/mapper_spec.rb +69 -0
- data/spec/controll/flow_handler/redirect_spec.rb +93 -0
- data/spec/controll/flow_handler/render_spec.rb +110 -0
- data/spec/controll/helper/event_matcher_spec.rb +21 -0
- data/spec/controll/helper/hash_access_spec.rb +25 -0
- data/spec/controll/helper/notify_spec.rb +48 -0
- data/spec/controll/helper/params_spec.rb +28 -0
- data/spec/controll/helper/path_resolver_spec.rb +49 -0
- data/spec/controll/helper/session_spec.rb +28 -0
- data/spec/controll/helper_spec.rb +108 -0
- data/spec/controll/notify/base_spec.rb +123 -0
- data/spec/controll/notify/flash_spec.rb +27 -0
- data/spec/controll/notify/message_handler.rb +72 -0
- data/spec/controll/notify/typed_spec.rb +28 -0
- data/spec/functional_test_helper.rb +25 -0
- data/spec/helper.rb +33 -0
- data/spec/rspec_controller_class.rb +15 -0
- data/spec/rspec_functional_helper.rb +25 -0
- data/spec/rspec_helper.rb +42 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/test_helper.rb +183 -0
- data/spec/unit/functional_test_helper_test.rb +65 -0
- data/spec/unit/macros_test.rb +43 -0
- data/spec/unit/mixin_test.rb +147 -0
- data/spec/unit/rspec_functional_helper.rb +42 -0
- data/spec/unit/rspec_helper_test.rb +91 -0
- data/spec/unit/test_helper_test.rb +235 -0
- metadata +289 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
require 'focused_controller/rspec_functional_helper'
|
|
3
|
+
|
|
4
|
+
module FocusedController
|
|
5
|
+
module RSpecFunctionalHelper
|
|
6
|
+
class FakePostsController
|
|
7
|
+
class Action < ActionController::Base; end
|
|
8
|
+
class Index < Action; end
|
|
9
|
+
class Show < Action; end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
index_spec = RSpec::Core::ExampleGroup.describe FakePostsController::Index do
|
|
13
|
+
include RSpec::Rails::ControllerExampleGroup
|
|
14
|
+
include FocusedController::RSpecFunctionalHelper
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
show_spec = nil
|
|
18
|
+
inner_show_spec = nil
|
|
19
|
+
RSpec::Core::ExampleGroup.describe FakePostsController do
|
|
20
|
+
include RSpec::Rails::ControllerExampleGroup
|
|
21
|
+
include FocusedController::RSpecFunctionalHelper
|
|
22
|
+
|
|
23
|
+
show_spec = describe(FakePostsController::Show) do
|
|
24
|
+
inner_show_spec = describe('foo') { }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe RSpecFunctionalHelper do
|
|
29
|
+
subject { index_spec.new }
|
|
30
|
+
|
|
31
|
+
it 'automatically determines the controller class' do
|
|
32
|
+
index_spec.controller_class.must_equal FakePostsController::Index
|
|
33
|
+
show_spec.controller_class.must_equal FakePostsController::Show
|
|
34
|
+
inner_show_spec.controller_class.must_equal FakePostsController::Show
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'includes the FocusedController::FunctionalTestHelper' do
|
|
38
|
+
subject.is_a?(FocusedController::FunctionalTestHelper).must_equal true
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
require 'action_controller'
|
|
3
|
+
require 'focused_controller/rspec_helper'
|
|
4
|
+
|
|
5
|
+
module FocusedController
|
|
6
|
+
module RSpecHelper
|
|
7
|
+
module FakePostsController
|
|
8
|
+
class Action < ActionController::Base
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class Index < Action
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Show < Action
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Edit < Action
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class Destroy < Action
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
index_spec = RSpec::Core::ExampleGroup.describe FakePostsController::Index do
|
|
25
|
+
include FocusedController::RSpecHelper
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
show_spec = nil
|
|
29
|
+
inner_show_spec = nil
|
|
30
|
+
RSpec::Core::ExampleGroup.describe FakePostsController do
|
|
31
|
+
show_spec = describe FakePostsController::Show do
|
|
32
|
+
include FocusedController::RSpecHelper
|
|
33
|
+
|
|
34
|
+
inner_show_spec = describe 'foo' do
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
edit_spec = RSpec::Core::ExampleGroup.describe "the edit action" do
|
|
40
|
+
include FocusedController::RSpecHelper
|
|
41
|
+
self.controller_class = FakePostsController::Edit
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe RSpecHelper do
|
|
45
|
+
it 'finds the correct controller class' do
|
|
46
|
+
index_spec.controller_class.must_equal FakePostsController::Index
|
|
47
|
+
show_spec.controller_class.must_equal FakePostsController::Show
|
|
48
|
+
inner_show_spec.controller_class.must_equal FakePostsController::Show
|
|
49
|
+
edit_spec.controller_class.must_equal FakePostsController::Edit
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
subject { index_spec.new }
|
|
53
|
+
|
|
54
|
+
def must_fail(&block)
|
|
55
|
+
block.must_raise RSpec::Expectations::ExpectationNotMetError
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def must_succeed(&block)
|
|
59
|
+
block.call
|
|
60
|
+
true.must_equal true # to count the assertion
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'has a redirect_to matcher' do
|
|
64
|
+
must_fail { subject.should subject.redirect_to('/foo') }
|
|
65
|
+
subject.controller.redirect_to('/foo')
|
|
66
|
+
must_succeed { subject.should subject.redirect_to('/foo') }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it 'matches response type' do
|
|
70
|
+
must_succeed { subject.response.should subject.be_success }
|
|
71
|
+
must_fail { subject.response.should subject.be_error }
|
|
72
|
+
|
|
73
|
+
subject.controller.render :status => :not_found
|
|
74
|
+
|
|
75
|
+
must_fail { subject.response.should subject.be_success }
|
|
76
|
+
must_succeed { subject.response.should subject.be_missing }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it 'has a render_template matcher' do
|
|
80
|
+
subject.controller.render :foo
|
|
81
|
+
|
|
82
|
+
must_succeed { subject.response.should subject.render_template(:foo) }
|
|
83
|
+
must_fail { subject.response.should subject.render_template(:bar) }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'sets the subject to be the controller instance' do
|
|
87
|
+
subject.subject.must_equal subject.controller
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
require 'focused_controller/test_helper'
|
|
3
|
+
require 'action_controller'
|
|
4
|
+
|
|
5
|
+
module FocusedController
|
|
6
|
+
module TestHelper
|
|
7
|
+
module FakePostsController
|
|
8
|
+
class Action < ActionController::Base
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class Index < Action
|
|
12
|
+
def run
|
|
13
|
+
if params[:omg]
|
|
14
|
+
"omg"
|
|
15
|
+
elsif params[:set_session]
|
|
16
|
+
session[:foo] = 'omg'
|
|
17
|
+
elsif params[:set_flash]
|
|
18
|
+
flash[:foo] = 'omg'
|
|
19
|
+
elsif params[:set_cookie]
|
|
20
|
+
cookies[:foo] = 'omg'
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self._routes
|
|
25
|
+
OpenStruct.new(
|
|
26
|
+
:named_routes => OpenStruct.new(
|
|
27
|
+
:module => Module.new do
|
|
28
|
+
def foo_path
|
|
29
|
+
'/foo'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class Show < Action
|
|
38
|
+
def self._routes
|
|
39
|
+
OpenStruct.new(
|
|
40
|
+
:named_routes => OpenStruct.new(
|
|
41
|
+
:module => Module.new do
|
|
42
|
+
def bar_path
|
|
43
|
+
'/bar'
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class TestCase < ActiveSupport::TestCase
|
|
52
|
+
include FocusedController::TestHelper
|
|
53
|
+
|
|
54
|
+
def initialize(method_name = :foo)
|
|
55
|
+
super
|
|
56
|
+
@_result = OpenStruct.new
|
|
57
|
+
end
|
|
58
|
+
def foo; end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class IndexTest < TestCase
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class ShowTest < TestCase
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class OtherShowTest < TestCase
|
|
68
|
+
self.controller_class = Show
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
class OtherOtherShowTest < OtherShowTest
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe TestHelper do
|
|
76
|
+
it 'instantiates the correct controller' do
|
|
77
|
+
mappings = {
|
|
78
|
+
FakePostsController::IndexTest => FakePostsController::Index,
|
|
79
|
+
FakePostsController::ShowTest => FakePostsController::Show,
|
|
80
|
+
FakePostsController::OtherShowTest => FakePostsController::Show,
|
|
81
|
+
FakePostsController::OtherOtherShowTest => FakePostsController::Show
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
mappings.each do |test, action|
|
|
85
|
+
test.new.controller.is_a?(action).must_equal true
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
subject { FakePostsController::IndexTest.new }
|
|
90
|
+
|
|
91
|
+
def must_fail(&block)
|
|
92
|
+
block.must_raise ActiveSupport::TestCase::Assertion
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def must_succeed(&block)
|
|
96
|
+
block.call
|
|
97
|
+
# this is just so the assertion is counted. the block will
|
|
98
|
+
# raise if it fails
|
|
99
|
+
assert_equal true, true
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it 'supports assert_template :foo' do
|
|
103
|
+
subject.controller.render :foo
|
|
104
|
+
must_succeed { subject.assert_template :foo }
|
|
105
|
+
must_fail { subject.assert_template :bar }
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it "supports assert_template 'foo'" do
|
|
109
|
+
subject.controller.render :foo
|
|
110
|
+
must_succeed { subject.assert_template 'foo' }
|
|
111
|
+
must_fail { subject.assert_template 'bar' }
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it 'supports assert_response :success' do
|
|
115
|
+
must_succeed { subject.assert_response :success }
|
|
116
|
+
must_fail { subject.assert_response :error }
|
|
117
|
+
|
|
118
|
+
subject.controller.render 'foo'
|
|
119
|
+
|
|
120
|
+
must_succeed { subject.assert_response :success }
|
|
121
|
+
must_fail { subject.assert_response :error }
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it 'supports assert_response :redirect' do
|
|
125
|
+
must_fail { subject.assert_response :redirect }
|
|
126
|
+
|
|
127
|
+
subject.controller.redirect_to 'foo'
|
|
128
|
+
must_succeed { subject.assert_response :redirect }
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
it 'supports assert_redirected_to' do
|
|
132
|
+
must_fail { subject.assert_redirected_to '/foo' }
|
|
133
|
+
|
|
134
|
+
subject.controller.redirect_to '/foo'
|
|
135
|
+
|
|
136
|
+
must_succeed { subject.assert_redirected_to '/foo' }
|
|
137
|
+
must_fail { subject.assert_redirected_to '/bar' }
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
it "responds to the controller's url helpers" do
|
|
141
|
+
subject.respond_to?(:foo_path).must_equal true
|
|
142
|
+
subject.respond_to?(:bar_path).must_equal false
|
|
143
|
+
subject.foo_path.must_equal '/foo'
|
|
144
|
+
|
|
145
|
+
other = FakePostsController::ShowTest.new
|
|
146
|
+
other.respond_to?(:foo_path).must_equal false
|
|
147
|
+
other.respond_to?(:bar_path).must_equal true
|
|
148
|
+
other.bar_path.must_equal '/bar'
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it 'supports session' do
|
|
152
|
+
subject.req(:set_session => true)
|
|
153
|
+
subject.session[:foo].must_equal 'omg'
|
|
154
|
+
subject.session['foo'].must_equal 'omg'
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it 'supports flash' do
|
|
158
|
+
subject.req(:set_flash => true)
|
|
159
|
+
subject.flash[:foo].must_equal 'omg'
|
|
160
|
+
|
|
161
|
+
# This is consistent with the behaviour of standard rails functional tests
|
|
162
|
+
subject.flash['foo'].must_equal nil
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
it 'supports cookies' do
|
|
166
|
+
subject.req(:set_cookie => true)
|
|
167
|
+
subject.cookies[:foo].must_equal 'omg'
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
describe "#req" do
|
|
171
|
+
it "sets params and calls the controller's #run" do
|
|
172
|
+
subject.req(:omg => true).must_equal 'omg'
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it 'sets session' do
|
|
176
|
+
subject.req(nil, { :foo => 'bar' })
|
|
177
|
+
subject.session[:foo].must_equal 'bar'
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
it 'set flash' do
|
|
181
|
+
subject.req(nil, nil, { :foo => 'bar' })
|
|
182
|
+
subject.flash[:foo].must_equal 'bar'
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
it "doesn't overwrite existing params, session, or flash if new ones aren't provided" do
|
|
186
|
+
subject.controller.params[:param] = true
|
|
187
|
+
subject.controller.flash[:flash] = true
|
|
188
|
+
subject.controller.session[:session] = true
|
|
189
|
+
|
|
190
|
+
subject.req
|
|
191
|
+
|
|
192
|
+
subject.controller.params[:param].must_equal true
|
|
193
|
+
subject.controller.flash[:flash].must_equal true
|
|
194
|
+
subject.controller.session[:session].must_equal true
|
|
195
|
+
|
|
196
|
+
subject.req({})
|
|
197
|
+
|
|
198
|
+
subject.controller.params[:param].must_equal(nil)
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
describe 'url stubbing' do
|
|
203
|
+
before do
|
|
204
|
+
subject.stub_url :foo, :bar
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
it 'handles equality' do
|
|
208
|
+
foo, bar = Object.new, Object.new
|
|
209
|
+
StubbedURL.new(:foo_path, [foo]).must_equal StubbedURL.new(:foo_path, [foo])
|
|
210
|
+
StubbedURL.new(:foo_path, [foo, bar]).wont_equal StubbedURL.new(:foo_path, [foo])
|
|
211
|
+
StubbedURL.new(:foo_path, [bar]).wont_equal StubbedURL.new(:foo_path, [foo])
|
|
212
|
+
StubbedURL.new(:bar_path, [foo]).wont_equal StubbedURL.new(:foo_path, [foo])
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it 'has a to_s' do
|
|
216
|
+
StubbedURL.new(:foo_path, ['omg', 'lol']).to_s.must_equal "foo_path(omg, lol)"
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
it 'creates a stub method on the test and controller instances' do
|
|
220
|
+
foo = Object.new
|
|
221
|
+
subject.foo_path(foo).must_equal StubbedURL.new(:foo_path, [foo])
|
|
222
|
+
subject.controller.foo_path(foo).must_equal StubbedURL.new(:foo_path, [foo])
|
|
223
|
+
subject.foo_url(foo).must_equal StubbedURL.new(:foo_url, [foo])
|
|
224
|
+
subject.controller.foo_url(foo).must_equal StubbedURL.new(:foo_url, [foo])
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it 'works with a controller' do
|
|
228
|
+
foo = Object.new
|
|
229
|
+
subject.controller.redirect_to StubbedURL.new(:foo_path, [foo])
|
|
230
|
+
must_succeed { subject.assert_redirected_to StubbedURL.new(:foo_path, [foo]) }
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: controll
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Kristian Mandrup
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-08-16 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: hashie
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ~>
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '1.2'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ~>
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '1.2'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: liquid
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: rspec
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 2.8.0
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 2.8.0
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: rdoc
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ! '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '3.12'
|
|
70
|
+
type: :development
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ! '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '3.12'
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: bundler
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - ! '>='
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: 1.0.0
|
|
86
|
+
type: :development
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ! '>='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: 1.0.0
|
|
94
|
+
- !ruby/object:Gem::Dependency
|
|
95
|
+
name: jeweler
|
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
|
97
|
+
none: false
|
|
98
|
+
requirements:
|
|
99
|
+
- - ! '>='
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: 1.8.4
|
|
102
|
+
type: :development
|
|
103
|
+
prerelease: false
|
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
+
none: false
|
|
106
|
+
requirements:
|
|
107
|
+
- - ! '>='
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: 1.8.4
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: simplecov
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
none: false
|
|
114
|
+
requirements:
|
|
115
|
+
- - ! '>='
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0.5'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
none: false
|
|
122
|
+
requirements:
|
|
123
|
+
- - ! '>='
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: '0.5'
|
|
126
|
+
description: FlowHandler, Executor, Notifier and more, all tied together tool pack
|
|
127
|
+
email: kmandrup@gmail.com
|
|
128
|
+
executables: []
|
|
129
|
+
extensions: []
|
|
130
|
+
extra_rdoc_files:
|
|
131
|
+
- LICENSE.txt
|
|
132
|
+
- README.md
|
|
133
|
+
files:
|
|
134
|
+
- .document
|
|
135
|
+
- .rspec
|
|
136
|
+
- Gemfile
|
|
137
|
+
- Gemfile.lock
|
|
138
|
+
- LICENSE.txt
|
|
139
|
+
- README.md
|
|
140
|
+
- Rakefile
|
|
141
|
+
- VERSION
|
|
142
|
+
- controll.gemspec
|
|
143
|
+
- lib/controll.rb
|
|
144
|
+
- lib/controll/assistant.rb
|
|
145
|
+
- lib/controll/command.rb
|
|
146
|
+
- lib/controll/commander.rb
|
|
147
|
+
- lib/controll/errors.rb
|
|
148
|
+
- lib/controll/executor.rb
|
|
149
|
+
- lib/controll/executor/base.rb
|
|
150
|
+
- lib/controll/executor/notificator.rb
|
|
151
|
+
- lib/controll/flow_handler.rb
|
|
152
|
+
- lib/controll/flow_handler/base.rb
|
|
153
|
+
- lib/controll/flow_handler/control.rb
|
|
154
|
+
- lib/controll/flow_handler/errors.rb
|
|
155
|
+
- lib/controll/flow_handler/event_helper.rb
|
|
156
|
+
- lib/controll/flow_handler/redirect.rb
|
|
157
|
+
- lib/controll/flow_handler/redirect/action.rb
|
|
158
|
+
- lib/controll/flow_handler/redirect/mapper.rb
|
|
159
|
+
- lib/controll/flow_handler/render.rb
|
|
160
|
+
- lib/controll/helper.rb
|
|
161
|
+
- lib/controll/helper/event_matcher.rb
|
|
162
|
+
- lib/controll/helper/hash_access.rb
|
|
163
|
+
- lib/controll/helper/notify.rb
|
|
164
|
+
- lib/controll/helper/params.rb
|
|
165
|
+
- lib/controll/helper/path_resolver.rb
|
|
166
|
+
- lib/controll/helper/session.rb
|
|
167
|
+
- lib/controll/notify.rb
|
|
168
|
+
- lib/controll/notify/base.rb
|
|
169
|
+
- lib/controll/notify/flash.rb
|
|
170
|
+
- lib/controll/notify/typed.rb
|
|
171
|
+
- spec/acceptance/app_test.rb
|
|
172
|
+
- spec/app/.gitignore
|
|
173
|
+
- spec/app/Gemfile
|
|
174
|
+
- spec/app/Gemfile.lock
|
|
175
|
+
- spec/app/README.rdoc
|
|
176
|
+
- spec/app/Rakefile
|
|
177
|
+
- spec/app/app/controllers/application_controller.rb
|
|
178
|
+
- spec/app/app/controllers/posts_controller.rb
|
|
179
|
+
- spec/app/app/models/.gitkeep
|
|
180
|
+
- spec/app/app/models/post.rb
|
|
181
|
+
- spec/app/app/views/layouts/application.html.erb
|
|
182
|
+
- spec/app/app/views/posts/_form.html.erb
|
|
183
|
+
- spec/app/app/views/posts/edit.html.erb
|
|
184
|
+
- spec/app/app/views/posts/index.html.erb
|
|
185
|
+
- spec/app/app/views/posts/new.html.erb
|
|
186
|
+
- spec/app/app/views/posts/show.html.erb
|
|
187
|
+
- spec/app/config.ru
|
|
188
|
+
- spec/app/config/application.rb
|
|
189
|
+
- spec/app/config/boot.rb
|
|
190
|
+
- spec/app/config/environment.rb
|
|
191
|
+
- spec/app/config/environments/development.rb
|
|
192
|
+
- spec/app/config/environments/test.rb
|
|
193
|
+
- spec/app/config/initializers/backtrace_silencers.rb
|
|
194
|
+
- spec/app/config/initializers/inflections.rb
|
|
195
|
+
- spec/app/config/initializers/mime_types.rb
|
|
196
|
+
- spec/app/config/initializers/secret_token.rb
|
|
197
|
+
- spec/app/config/initializers/session_store.rb
|
|
198
|
+
- spec/app/config/locales/en.yml
|
|
199
|
+
- spec/app/config/routes.rb
|
|
200
|
+
- spec/app/db/seeds.rb
|
|
201
|
+
- spec/app/lib/assets/.gitkeep
|
|
202
|
+
- spec/app/lib/tasks/.gitkeep
|
|
203
|
+
- spec/app/log/.gitkeep
|
|
204
|
+
- spec/app/public/404.html
|
|
205
|
+
- spec/app/public/422.html
|
|
206
|
+
- spec/app/public/500.html
|
|
207
|
+
- spec/app/public/favicon.ico
|
|
208
|
+
- spec/app/public/index.html
|
|
209
|
+
- spec/app/public/javascripts/application.js
|
|
210
|
+
- spec/app/public/robots.txt
|
|
211
|
+
- spec/app/public/stylesheets/application.css
|
|
212
|
+
- spec/app/script/rails
|
|
213
|
+
- spec/app/spec/controllers/posts_controller_spec.rb
|
|
214
|
+
- spec/app/spec/isolated_spec_helper.rb
|
|
215
|
+
- spec/app/spec/spec_helper.rb
|
|
216
|
+
- spec/app/spec/unit/controllers/posts_controller_isolated_spec.rb
|
|
217
|
+
- spec/app/spec/unit/controllers/posts_controller_spec.rb
|
|
218
|
+
- spec/app/test/functional/.gitkeep
|
|
219
|
+
- spec/app/test/functional/posts_controller_test.rb
|
|
220
|
+
- spec/app/test/isolated_test_helper.rb
|
|
221
|
+
- spec/app/test/test_helper.rb
|
|
222
|
+
- spec/app/test/unit/.gitkeep
|
|
223
|
+
- spec/app/test/unit/controllers/posts_controller_isolated_test.rb
|
|
224
|
+
- spec/app/test/unit/controllers/posts_controller_test.rb
|
|
225
|
+
- spec/app/vendor/assets/javascripts/.gitkeep
|
|
226
|
+
- spec/app/vendor/assets/stylesheets/.gitkeep
|
|
227
|
+
- spec/app/vendor/plugins/.gitkeep
|
|
228
|
+
- spec/controll/asssistant_spec.rb
|
|
229
|
+
- spec/controll/command_spec.rb
|
|
230
|
+
- spec/controll/commander_spec.rb
|
|
231
|
+
- spec/controll/executor/notificator_spec.rb
|
|
232
|
+
- spec/controll/flow_handler/control_spec.rb
|
|
233
|
+
- spec/controll/flow_handler/redirect/action_spec.rb
|
|
234
|
+
- spec/controll/flow_handler/redirect/mapper_spec.rb
|
|
235
|
+
- spec/controll/flow_handler/redirect_spec.rb
|
|
236
|
+
- spec/controll/flow_handler/render_spec.rb
|
|
237
|
+
- spec/controll/helper/event_matcher_spec.rb
|
|
238
|
+
- spec/controll/helper/hash_access_spec.rb
|
|
239
|
+
- spec/controll/helper/notify_spec.rb
|
|
240
|
+
- spec/controll/helper/params_spec.rb
|
|
241
|
+
- spec/controll/helper/path_resolver_spec.rb
|
|
242
|
+
- spec/controll/helper/session_spec.rb
|
|
243
|
+
- spec/controll/helper_spec.rb
|
|
244
|
+
- spec/controll/notify/base_spec.rb
|
|
245
|
+
- spec/controll/notify/flash_spec.rb
|
|
246
|
+
- spec/controll/notify/message_handler.rb
|
|
247
|
+
- spec/controll/notify/typed_spec.rb
|
|
248
|
+
- spec/functional_test_helper.rb
|
|
249
|
+
- spec/helper.rb
|
|
250
|
+
- spec/rspec_controller_class.rb
|
|
251
|
+
- spec/rspec_functional_helper.rb
|
|
252
|
+
- spec/rspec_helper.rb
|
|
253
|
+
- spec/spec_helper.rb
|
|
254
|
+
- spec/test_helper.rb
|
|
255
|
+
- spec/unit/functional_test_helper_test.rb
|
|
256
|
+
- spec/unit/macros_test.rb
|
|
257
|
+
- spec/unit/mixin_test.rb
|
|
258
|
+
- spec/unit/rspec_functional_helper.rb
|
|
259
|
+
- spec/unit/rspec_helper_test.rb
|
|
260
|
+
- spec/unit/test_helper_test.rb
|
|
261
|
+
homepage: http://github.com/kristianmandrup/controll
|
|
262
|
+
licenses:
|
|
263
|
+
- MIT
|
|
264
|
+
post_install_message:
|
|
265
|
+
rdoc_options: []
|
|
266
|
+
require_paths:
|
|
267
|
+
- lib
|
|
268
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
|
+
none: false
|
|
270
|
+
requirements:
|
|
271
|
+
- - ! '>='
|
|
272
|
+
- !ruby/object:Gem::Version
|
|
273
|
+
version: '0'
|
|
274
|
+
segments:
|
|
275
|
+
- 0
|
|
276
|
+
hash: 2872567126894970398
|
|
277
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
278
|
+
none: false
|
|
279
|
+
requirements:
|
|
280
|
+
- - ! '>='
|
|
281
|
+
- !ruby/object:Gem::Version
|
|
282
|
+
version: '0'
|
|
283
|
+
requirements: []
|
|
284
|
+
rubyforge_project:
|
|
285
|
+
rubygems_version: 1.8.24
|
|
286
|
+
signing_key:
|
|
287
|
+
specification_version: 3
|
|
288
|
+
summary: Utils for handling complex Controller/Business logic
|
|
289
|
+
test_files: []
|