Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
major cleanup
  • Loading branch information
kristianmandrup committed Sep 14, 2012
1 parent 79bcda2 commit 50f730f
Show file tree
Hide file tree
Showing 25 changed files with 24 additions and 440 deletions.
4 changes: 2 additions & 2 deletions lib/controll/flow/event_mapper/path_finder.rb
@@ -1,5 +1,5 @@
module Controll::Flow module Controll::Flow
class EventMapper module EventMapper
class PathFinder class PathFinder
attr_accessor :event, :maps, :types attr_accessor :event, :maps, :types


Expand All @@ -22,7 +22,7 @@ def path


protected protected


include Controll::Flow::EventHelper include Controll::Event::Helper


def event_map def event_map
@event_map ||= maps[event.type] || {} @event_map ||= maps[event.type] || {}
Expand Down
@@ -1,10 +1,10 @@
require 'spec_helper' require 'spec_helper'


class Notifier class Notifier
include Controll::Helper::Notify include Controll::Enabler::Notify
end end


describe Controll::Helper::Notify do describe Controll::Enabler::Notify do
subject { Notifier.new } subject { Notifier.new }


context 'initial state' do context 'initial state' do
Expand Down
2 changes: 1 addition & 1 deletion spec/controll/flow/action_mapper/simple_spec.rb
Expand Up @@ -14,7 +14,7 @@ def self.events


class HelloRender < Controll::Flow::ActionMapper::Simple class HelloRender < Controll::Flow::ActionMapper::Simple
events :hello, :damn events :hello, :damn
set_default_path '/default' default_path '/default'
end end


def notification name def notification name
Expand Down
4 changes: 2 additions & 2 deletions spec/controll/flow/event_mapper/path_finder_spec.rb
Expand Up @@ -8,7 +8,7 @@ def error name
Hashie::Mash.new(name: name.to_sym, type: :error) Hashie::Mash.new(name: name.to_sym, type: :error)
end end


describe Controll::Flow::Redirect::Action do describe Controll::Flow::EventMapper::PathFinder do
let(:redirections) do let(:redirections) do
{ {
:error => error_map, :notice => notice_map :error => error_map, :notice => notice_map
Expand All @@ -29,7 +29,7 @@ def error name
let(:types) { [:notice, :error] } let(:types) { [:notice, :error] }


context 'use' do context 'use' do
let(:clazz) { Controll::Flow::Redirect::Action } let(:clazz) { Controll::Flow::EventMapper::PathFinder }
let(:hello) { notice :hello } let(:hello) { notice :hello }
let(:bad_payment) { error :bad_payment } let(:bad_payment) { error :bad_payment }


Expand Down
6 changes: 3 additions & 3 deletions spec/controll/flow/event_mapper/util_spec.rb
Expand Up @@ -8,7 +8,7 @@ def error name
Hashie::Mash.new(name: name.to_sym, type: :error) Hashie::Mash.new(name: name.to_sym, type: :error)
end end


describe Controll::Flow::Redirect::Mapper do describe Controll::Flow::EventMapper::Util do
let(:redirections) do let(:redirections) do
{ {
:error => error_map, :notice => notice_map :error => error_map, :notice => notice_map
Expand All @@ -31,7 +31,7 @@ def error name
context 'use' do context 'use' do
subject { clazz.new hello, notice_map } subject { clazz.new hello, notice_map }


let(:clazz) { Controll::Flow::Redirect::Mapper } let(:clazz) { Controll::Flow::EventMapper::Util }
let(:hello) { notice :hello } let(:hello) { notice :hello }
let(:bad_payment) { error :bad_payment } let(:bad_payment) { error :bad_payment }


Expand All @@ -48,7 +48,7 @@ def error name


describe '.matcher event' do describe '.matcher event' do
specify do specify do
subject.send(:matcher, hello).should be_a Controll::Helper::EventMatcher subject.send(:matcher, hello).should be_a Controll::Event::Matcher
end end


specify do specify do
Expand Down
4 changes: 2 additions & 2 deletions spec/controll/flow/master/executor_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'


module MyController module MyOwnController
class Update class Update
def render path def render path
send(path) if path send(path) if path
Expand All @@ -16,7 +16,7 @@ def default
include Controll::Event::Helper include Controll::Event::Helper


let(:executor) { Controll::Flow::Master::Executor } let(:executor) { Controll::Flow::Master::Executor }
let(:controller) { MyController::Update.new } let(:controller) { MyOwnController::Update.new }


let(:fallback_event) { create_event :unknown, :notice } let(:fallback_event) { create_event :unknown, :notice }
let(:render_event) { create_event :hello, :notice } let(:render_event) { create_event :hello, :notice }
Expand Down
24 changes: 12 additions & 12 deletions spec/controll/flow/master_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'


module MyController module MasterController
class Update class Update
def render path def render path
send(path) if path send(path) if path
Expand Down Expand Up @@ -48,21 +48,21 @@ def event
end end
end end


ActionMapper = Controll::Flow::ActionMapper # ActionMapper = Controll::Flow::ActionMapper
Action = Controll::Flow::Action # Action = Controll::Flow::Action


PathAction = Action::PathAction # PathAction = Action::PathAction
Fallback = Action::Fallback # Fallback = Action::Fallback


Simple = ActionMapper::Simple # Simple = ActionMapper::Simple
Complex = ActionMapper::Complex # Complex = ActionMapper::Complex


describe Controll::Flow::Master do describe Controll::Flow::Master do
context 'use directly without sublclassing' do context 'use directly without sublclassing' do
subject { flow.new controller } subject { flow.new controller }


let(:flow) { Controll::Flow::Master } let(:flow) { Controll::Flow::Master }
let(:controller) { MyController::Update.new } let(:controller) { MasterController::Update.new }


describe '.initialize' do describe '.initialize' do
specify do specify do
Expand All @@ -81,7 +81,7 @@ def event
subject { flow.new controller } subject { flow.new controller }


let(:flow) { Flows::EmptyEvent } let(:flow) { Flows::EmptyEvent }
let(:controller) { MyController::Update.new } let(:controller) { MasterController::Update.new }


describe '.initialize' do describe '.initialize' do
specify do specify do
Expand All @@ -101,7 +101,7 @@ def event
subject { flow.new controller } subject { flow.new controller }


let(:flow) { Flows::UpdateEventWithoutHandler } let(:flow) { Flows::UpdateEventWithoutHandler }
let(:controller) { MyController::Update.new } let(:controller) { MasterController::Update.new }


describe '.initialize' do describe '.initialize' do
specify do specify do
Expand All @@ -121,7 +121,7 @@ def event
subject { flow.new controller } subject { flow.new controller }


let(:flow) { Flows::UpdateEvent } let(:flow) { Flows::UpdateEvent }
let(:controller) { MyController::Update.new } let(:controller) { MasterController::Update.new }


describe '.initialize' do describe '.initialize' do
specify do specify do
Expand All @@ -145,7 +145,7 @@ def event
subject { flow.new controller } subject { flow.new controller }


let(:flow) { Flows::UpdateEventNoMatch } let(:flow) { Flows::UpdateEventNoMatch }
let(:controller) { MyController::Update.new } let(:controller) { MasterController::Update.new }


describe '.initialize' do describe '.initialize' do
specify do specify do
Expand Down
Empty file.
Empty file.
6 changes: 0 additions & 6 deletions spec/controll_app/script/rails

This file was deleted.

59 changes: 0 additions & 59 deletions spec/controll_app/spec/controllers/posts_controller_spec.rb

This file was deleted.

6 changes: 0 additions & 6 deletions spec/controll_app/spec/isolated_spec_helper.rb

This file was deleted.

5 changes: 0 additions & 5 deletions spec/controll_app/spec/spec_helper.rb

This file was deleted.

This file was deleted.

59 changes: 0 additions & 59 deletions spec/controll_app/spec/unit/controllers/posts_controller_spec.rb

This file was deleted.

Empty file.

0 comments on commit 50f730f

Please sign in to comment.