Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

lots of little fixes

  • Loading branch information...
commit 79bcda2ca8cf1e71d667d343e078a83a7fd4ab00 1 parent 4281db0
@kristianmandrup authored
View
4 lib/controll/enabler/path_resolver.rb
@@ -21,9 +21,9 @@ def resolve action = nil
def handle action
case action
- when ActionMapper::Fallback
+ when Action::Fallback
nil
- when ActionMapper::PathAction
+ when Action::PathAction
action.resolved_path
when Symbol, Controll::Event
resolve_event action
View
1  lib/controll/flow/action_mapper/complex.rb
@@ -29,6 +29,7 @@ def event_map_for type = :notice
# also auto-adds type to types
def event_map *args, &block
@event_maps ||= {}
+ @types ||= []
return @event_maps if args.empty? && !block_given?
type = args.first.kind_of?(Symbol) ? args.shift : :notice
View
6 spec/controll/command_spec.rb
@@ -6,7 +6,7 @@ def flash
end
end
-class SignInCommand < Controll::Command
+class SignOffCommand < Controll::Command
attribute :parent_id, String
def perform
@@ -43,13 +43,13 @@ def parent_id
describe '.command name, *args' do
specify do
- subject.command(:sign_in).should be_a Controll::Command
+ subject.command(:sign_off).should be_a Controll::Command
end
end
describe '.command! name, *args' do
specify do
- subject.command!(:sign_in).should == {id: 7, parent: 'my parent', user_id: 1 }
+ subject.command!(:sign_off).should == {id: 7, parent: 'my parent', user_id: 1 }
end
end
end
View
35 spec/controll/executor/controlled_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+class MyControlledExec < Controll::Executor::Controlled
+end
+
+class MyAwesomeController
+ def hello
+ "hello"
+ end
+end
+
+describe Controll::Executor::Controlled do
+ subject { MyControlledExec.new controller }
+
+ let(:controller) { MyAwesomeController.new }
+
+ describe '.method_missing' do
+ specify do
+ subject.hello.should == 'hello'
+ end
+
+ specify do
+ expect { subject.bye }.to raise_error
+ end
+ end
+
+ describe '.execute' do
+ end
+
+ describe '.result' do
+ end
+
+ describe 'self.execute &block' do
+ end
+end
View
7 spec/controll/executor/notificator_spec.rb → spec/controll/executor/delegator_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
-
-class MyExec < Controll::Executor::Notificator
+class MyDelegator < Controll::Executor::Delegator
end
class MyAwesomeController
@@ -10,8 +9,8 @@ def hello
end
end
-describe Controll::Executor::Notificator do
- subject { MyExec.new controller }
+describe Controll::Executor::Delegator do
+ subject { MyDelegator.new controller }
let(:controller) { MyAwesomeController.new }
View
16 spec/controll/flow/action_mapper/complex_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
-class HelloToWelcomeRedirect < Controll::Flow::Redirect
- set_redirections :welcome => [:hello, :hi]
+class HelloToWelcomeRedirect < Controll::Flow::ActionMapper::Complex
+ event_map :welcome => [:hello, :hi]
end
-class ErrorBadRedirect < Controll::Flow::Redirect
- set_redirections :error, bad: ['bad_payment', 'wrong_payment']
+class ErrorBadRedirect < Controll::Flow::ActionMapper::Complex
+ event_map :error, bad: ['bad_payment', 'wrong_payment']
end
def notification name
@@ -16,19 +16,19 @@ def error name
Hashie::Mash.new(name: name.to_sym, type: :error)
end
-describe Controll::Flow::Redirect do
+describe Controll::Flow::ActionMapper::Complex do
describe 'class macros' do
before :all do
- ErrorBadRedirect.set_redirections :error, crap: ['bad_payment', 'wrong_payment']
+ ErrorBadRedirect.event_map :error, crap: ['bad_payment', 'wrong_payment']
end
specify {
- ErrorBadRedirect.redirections_for(:error).should == {crap: ['bad_payment', 'wrong_payment']}
+ ErrorBadRedirect.event_map_for(:error).should == {crap: ['bad_payment', 'wrong_payment']}
}
specify {
- ErrorBadRedirect.redirections.should == {error: {crap: ['bad_payment', 'wrong_payment']} }
+ ErrorBadRedirect.event_maps.should == {error: {crap: ['bad_payment', 'wrong_payment']} }
}
end
View
6 spec/controll/flow/action_mapper/fallback_spec.rb
@@ -6,10 +6,10 @@ def do_fallback fallback
end
end
-class BasicFallback < Controll::Flow::Fallback
+class BasicFallbackAction < Controll::Flow::Action::Fallback
end
-describe Controll::Flow::Fallback do
+describe Controll::Flow::Action::Fallback do
context 'Basic default fallback' do
subject { clazz.new controller, event }
@@ -21,7 +21,7 @@ class BasicFallback < Controll::Flow::Fallback
describe '.action controller, event' do
specify do
- clazz.action(controller, event).should be_a Controll::Flow::Fallback
+ clazz.action(controller, event).should be_a Controll::Flow::Action::Fallback
end
end
View
8 spec/controll/flow/action_mapper/simlple_spec.rb → spec/controll/flow/action_mapper/simple_spec.rb
@@ -1,18 +1,18 @@
require 'spec_helper'
-class NoEventsRender < Controll::Flow::Render
+class NoEventsRender < Controll::Flow::ActionMapper::Simple
def self.events
[]
end
end
-class HiRender < Controll::Flow::Render
+class HiRender < Controll::Flow::ActionMapper::Simple
def self.events
[:hi]
end
end
-class HelloRender < Controll::Flow::Render
+class HelloRender < Controll::Flow::ActionMapper::Simple
events :hello, :damn
set_default_path '/default'
end
@@ -21,7 +21,7 @@ def notification name
Hashie::Mash.new(name: name.to_sym, type: :notification)
end
-describe Controll::Flow::Render do
+describe Controll::Flow::ActionMapper::Simple do
context 'use directly without sublclassing' do
subject { clazz.new '/' }
Please sign in to comment.
Something went wrong with that request. Please try again.