Skip to content
Browse files

major cleanup

  • Loading branch information...
1 parent 79bcda2 commit 50f730f3ce71a626ef7981fdc8502f6dc806be75 @kristianmandrup committed Sep 14, 2012
View
4 lib/controll/flow/event_mapper/path_finder.rb
@@ -1,5 +1,5 @@
module Controll::Flow
- class EventMapper
+ module EventMapper
class PathFinder
attr_accessor :event, :maps, :types
@@ -22,7 +22,7 @@ def path
protected
- include Controll::Flow::EventHelper
+ include Controll::Event::Helper
def event_map
@event_map ||= maps[event.type] || {}
View
4 spec/controll/helper/notify_spec.rb → spec/controll/enabler/notify_spec.rb
@@ -1,10 +1,10 @@
require 'spec_helper'
class Notifier
- include Controll::Helper::Notify
+ include Controll::Enabler::Notify
end
-describe Controll::Helper::Notify do
+describe Controll::Enabler::Notify do
subject { Notifier.new }
context 'initial state' do
View
2 spec/controll/flow/action_mapper/simple_spec.rb
@@ -14,7 +14,7 @@ def self.events
class HelloRender < Controll::Flow::ActionMapper::Simple
events :hello, :damn
- set_default_path '/default'
+ default_path '/default'
end
def notification name
View
4 spec/controll/flow/event_mapper/path_finder_spec.rb
@@ -8,7 +8,7 @@ def error name
Hashie::Mash.new(name: name.to_sym, type: :error)
end
-describe Controll::Flow::Redirect::Action do
+describe Controll::Flow::EventMapper::PathFinder do
let(:redirections) do
{
:error => error_map, :notice => notice_map
@@ -29,7 +29,7 @@ def error name
let(:types) { [:notice, :error] }
context 'use' do
- let(:clazz) { Controll::Flow::Redirect::Action }
+ let(:clazz) { Controll::Flow::EventMapper::PathFinder }
let(:hello) { notice :hello }
let(:bad_payment) { error :bad_payment }
View
6 spec/controll/flow/event_mapper/util_spec.rb
@@ -8,7 +8,7 @@ def error name
Hashie::Mash.new(name: name.to_sym, type: :error)
end
-describe Controll::Flow::Redirect::Mapper do
+describe Controll::Flow::EventMapper::Util do
let(:redirections) do
{
:error => error_map, :notice => notice_map
@@ -31,7 +31,7 @@ def error name
context 'use' do
subject { clazz.new hello, notice_map }
- let(:clazz) { Controll::Flow::Redirect::Mapper }
+ let(:clazz) { Controll::Flow::EventMapper::Util }
let(:hello) { notice :hello }
let(:bad_payment) { error :bad_payment }
@@ -48,7 +48,7 @@ def error name
describe '.matcher event' do
specify do
- subject.send(:matcher, hello).should be_a Controll::Helper::EventMatcher
+ subject.send(:matcher, hello).should be_a Controll::Event::Matcher
end
specify do
View
4 spec/controll/flow/master/executor_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-module MyController
+module MyOwnController
class Update
def render path
send(path) if path
@@ -16,7 +16,7 @@ def default
include Controll::Event::Helper
let(:executor) { Controll::Flow::Master::Executor }
- let(:controller) { MyController::Update.new }
+ let(:controller) { MyOwnController::Update.new }
let(:fallback_event) { create_event :unknown, :notice }
let(:render_event) { create_event :hello, :notice }
View
24 spec/controll/flow/master_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-module MyController
+module MasterController
class Update
def render path
send(path) if path
@@ -48,21 +48,21 @@ def event
end
end
-ActionMapper = Controll::Flow::ActionMapper
-Action = Controll::Flow::Action
+# ActionMapper = Controll::Flow::ActionMapper
+# Action = Controll::Flow::Action
-PathAction = Action::PathAction
-Fallback = Action::Fallback
+# PathAction = Action::PathAction
+# Fallback = Action::Fallback
-Simple = ActionMapper::Simple
-Complex = ActionMapper::Complex
+# Simple = ActionMapper::Simple
+# Complex = ActionMapper::Complex
describe Controll::Flow::Master do
context 'use directly without sublclassing' do
subject { flow.new controller }
let(:flow) { Controll::Flow::Master }
- let(:controller) { MyController::Update.new }
+ let(:controller) { MasterController::Update.new }
describe '.initialize' do
specify do
@@ -81,7 +81,7 @@ def event
subject { flow.new controller }
let(:flow) { Flows::EmptyEvent }
- let(:controller) { MyController::Update.new }
+ let(:controller) { MasterController::Update.new }
describe '.initialize' do
specify do
@@ -101,7 +101,7 @@ def event
subject { flow.new controller }
let(:flow) { Flows::UpdateEventWithoutHandler }
- let(:controller) { MyController::Update.new }
+ let(:controller) { MasterController::Update.new }
describe '.initialize' do
specify do
@@ -121,7 +121,7 @@ def event
subject { flow.new controller }
let(:flow) { Flows::UpdateEvent }
- let(:controller) { MyController::Update.new }
+ let(:controller) { MasterController::Update.new }
describe '.initialize' do
specify do
@@ -145,7 +145,7 @@ def event
subject { flow.new controller }
let(:flow) { Flows::UpdateEventNoMatch }
- let(:controller) { MyController::Update.new }
+ let(:controller) { MasterController::Update.new }
describe '.initialize' do
specify do
View
0 spec/controll_app/lib/assets/.gitkeep
No changes.
View
0 spec/controll_app/lib/tasks/.gitkeep
No changes.
View
6 spec/controll_app/script/rails
@@ -1,6 +0,0 @@
-#!/usr/bin/env ruby
-# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
-
-APP_PATH = File.expand_path('../../config/application', __FILE__)
-require File.expand_path('../../config/boot', __FILE__)
-require 'rails/commands'
View
59 spec/controll_app/spec/controllers/posts_controller_spec.rb
@@ -1,59 +0,0 @@
-require 'spec_helper'
-
-describe PostsController do
- include FocusedController::RSpecFunctionalHelper
-
- before do
- @post = Post.create(:title => 'Hello', :body => 'Omg')
- end
-
- describe PostsController::Index do
- it "should get index" do
- get
- response.should be_success
- subject.posts.should_not be_nil
- end
- end
-
- describe PostsController::New do
- it "should get new" do
- get
- response.should be_success
- end
- end
-
- describe PostsController::Create do
- it "should create post" do
- expect { post :post => @post.attributes }.to change(Post, :count).by(1)
- response.should redirect_to(post_path(subject.post))
- end
- end
-
- describe PostsController::Show do
- it "should show post" do
- get :id => @post.id
- response.should be_success
- end
- end
-
- describe PostsController::Edit do
- it "should get edit" do
- get :id => @post.id
- response.should be_success
- end
- end
-
- describe PostsController::Update do
- it "should update post" do
- put :id => @post.id, :post => @post.attributes
- response.should redirect_to(post_path(subject.post))
- end
- end
-
- describe PostsController::Destroy do
- it "should destroy post" do
- expect { delete :id => @post.id }.to change(Post, :count).by(-1)
- response.should redirect_to(posts_path)
- end
- end
-end
View
6 spec/controll_app/spec/isolated_spec_helper.rb
@@ -1,6 +0,0 @@
-require 'bundler/setup'
-require 'rspec'
-require 'focused_controller/rspec_helper'
-
-APP_ROOT = File.expand_path('../../app', __FILE__)
-POSTS = []
View
5 spec/controll_app/spec/spec_helper.rb
@@ -1,5 +0,0 @@
-require 'rails/application'
-require File.expand_path("../../config/environment", __FILE__)
-require 'rspec'
-require 'focused_controller/rspec_helper'
-require 'focused_controller/rspec_functional_helper'
View
63 spec/controll_app/spec/unit/controllers/posts_controller_isolated_spec.rb
@@ -1,63 +0,0 @@
-require 'isolated_spec_helper'
-require APP_ROOT + '/controllers/application_controller'
-require APP_ROOT + '/controllers/posts_controller'
-require APP_ROOT + '/models/post'
-
-describe PostsController do
- include FocusedController::RSpecHelper
- stub_url :post, :posts
-
- before do
- @post = Post.create(:title => 'Hello', :body => 'Omg')
- end
-
- describe PostsController::Index do
- it "should get index" do
- req
- response.should be_success
- subject.posts.should_not be(:nil)
- end
- end
-
- describe PostsController::New do
- it "should get new" do
- req
- response.should be_success
- end
- end
-
- describe PostsController::Create do
- it "should create post" do
- expect { req :post => @post.attributes }.to change(Post, :count).by(1)
- response.should redirect_to(post_url(subject.post))
- end
- end
-
- describe PostsController::Show do
- it "should show post" do
- req :id => @post.id
- response.should be_success
- end
- end
-
- describe PostsController::Edit do
- it "should get edit" do
- req :id => @post.id
- response.should be_success
- end
- end
-
- describe PostsController::Update do
- it "should update post" do
- req :id => @post.id
- response.should redirect_to(post_url(subject.post))
- end
- end
-
- describe PostsController::Destroy do
- it "should destroy post" do
- expect { req :id => @post.id }.to change(Post, :count).by(-1)
- response.should redirect_to(posts_url)
- end
- end
-end
View
59 spec/controll_app/spec/unit/controllers/posts_controller_spec.rb
@@ -1,59 +0,0 @@
-require 'spec_helper'
-
-describe PostsController do
- include FocusedController::RSpecHelper
-
- before do
- @post = Post.create(:title => 'Hello', :body => 'Omg')
- end
-
- describe PostsController::Index do
- it "should get index" do
- req
- response.should be_success
- subject.posts.should_not be(:nil)
- end
- end
-
- describe PostsController::New do
- it "should get new" do
- req
- response.should be_success
- end
- end
-
- describe PostsController::Create do
- it "should create post" do
- expect { req :post => @post.attributes }.to change(Post, :count).by(1)
- response.should redirect_to(post_path(subject.post))
- end
- end
-
- describe PostsController::Show do
- it "should show post" do
- req :id => @post.id
- response.should be_success
- end
- end
-
- describe PostsController::Edit do
- it "should get edit" do
- req :id => @post.id
- response.should be_success
- end
- end
-
- describe PostsController::Update do
- it "should update post" do
- req :id => @post.id
- response.should redirect_to(post_path(subject.post))
- end
- end
-
- describe PostsController::Destroy do
- it "should destroy post" do
- expect { req :id => @post.id }.to change(Post, :count).by(-1)
- response.should redirect_to(posts_path)
- end
- end
-end
View
0 spec/controll_app/test/functional/.gitkeep
No changes.
View
67 spec/controll_app/test/functional/posts_controller_test.rb
@@ -1,67 +0,0 @@
-require 'test_helper'
-
-module PostsController
- class TestCase < ActionController::TestCase
- include FocusedController::FunctionalTestHelper
-
- setup do
- @post = Post.create(:title => 'Hello', :body => 'Omg')
- end
- end
-
- class IndexTest < TestCase
- test "should get index" do
- get
- assert_response :success
- assert_not_nil @controller.posts
- end
- end
-
- class NewTest < TestCase
- test "should get new" do
- get
- assert_response :success
- end
- end
-
- class CreateTest < TestCase
- test "should create post" do
- assert_difference('Post.count') do
- post :post => @post.attributes
- end
-
- assert_redirected_to post_path(@controller.post)
- end
- end
-
- class ShowTest < TestCase
- test "should show post" do
- get :id => @post.id
- assert_response :success
- end
- end
-
- class EditTest < TestCase
- test "should get edit" do
- get :id => @post.id
- assert_response :success
- end
- end
-
- class UpdateTest < TestCase
- test "should update post" do
- put :id => @post.id, :post => @post.attributes
- assert_redirected_to post_path(@controller.post)
- end
- end
-
- class DestroyTest < TestCase
- test "should destroy post" do
- assert_difference('Post.count', -1) do
- delete :id => @post.id
- end
-
- assert_redirected_to posts_path
- end
- end
-end
View
7 spec/controll_app/test/isolated_test_helper.rb
@@ -1,7 +0,0 @@
-require 'bundler/setup'
-require 'test/unit'
-require 'active_support/test_case'
-require 'focused_controller/test_helper'
-
-APP_ROOT = File.expand_path('../../app', __FILE__)
-POSTS = []
View
6 spec/controll_app/test/test_helper.rb
@@ -1,6 +0,0 @@
-ENV["RAILS_ENV"] = "test"
-require File.expand_path('../../config/environment', __FILE__)
-require 'rails/test_help'
-
-require 'focused_controller/functional_test_helper'
-require 'focused_controller/test_helper'
View
0 spec/controll_app/test/unit/.gitkeep
No changes.
View
71 spec/controll_app/test/unit/controllers/posts_controller_isolated_test.rb
@@ -1,71 +0,0 @@
-require 'isolated_test_helper'
-require APP_ROOT + '/controllers/application_controller'
-require APP_ROOT + '/controllers/posts_controller'
-require APP_ROOT + '/models/post'
-
-module PostsController
- class TestCase < ActiveSupport::TestCase
- include FocusedController::TestHelper
- stub_url :post, :posts
-
- setup do
- @post = Post.create(:title => 'Hello', :body => 'Omg')
- end
- end
-
- class IndexTest < TestCase
- test "should get index" do
- req
- assert_response :success
- assert_not_nil controller.posts
- end
- end
-
- class NewTest < TestCase
- test "should get new" do
- req
- assert_response :success
- end
- end
-
- class CreateTest < TestCase
- test "should create post" do
- assert_difference('Post.count') do
- req :post => @post.attributes
- end
-
- assert_redirected_to post_url(controller.post)
- end
- end
-
- class ShowTest < TestCase
- test "should show post" do
- req :id => @post.id
- assert_response :success
- end
- end
-
- class EditTest < TestCase
- test "should get edit" do
- req :id => @post.id
- assert_response :success
- end
- end
-
- class UpdateTest < TestCase
- test "should update post" do
- req :id => @post.id
- assert_redirected_to post_url(controller.post)
- end
- end
-
- class DestroyTest < TestCase
- test "should destroy post" do
- assert_difference('Post.count', -1) do
- req :id => @post.id
- end
-
- assert_redirected_to posts_url
- end
- end
-end
View
67 spec/controll_app/test/unit/controllers/posts_controller_test.rb
@@ -1,67 +0,0 @@
-require 'test_helper'
-
-module PostsController
- class TestCase < ActiveSupport::TestCase
- include FocusedController::TestHelper
-
- setup do
- @post = Post.create(:title => 'Hello', :body => 'Omg')
- end
- end
-
- class IndexTest < TestCase
- test "should get index" do
- req
- assert_response :success
- assert_not_nil controller.posts
- end
- end
-
- class NewTest < TestCase
- test "should get new" do
- req
- assert_response :success
- end
- end
-
- class CreateTest < TestCase
- test "should create post" do
- assert_difference('Post.count') do
- req :post => @post.attributes
- end
-
- assert_redirected_to post_path(controller.post)
- end
- end
-
- class ShowTest < TestCase
- test "should show post" do
- req :id => @post.id
- assert_response :success
- end
- end
-
- class EditTest < TestCase
- test "should get edit" do
- req :id => @post.id
- assert_response :success
- end
- end
-
- class UpdateTest < TestCase
- test "should update post" do
- req :id => @post.id
- assert_redirected_to post_path(controller.post)
- end
- end
-
- class DestroyTest < TestCase
- test "should destroy post" do
- assert_difference('Post.count', -1) do
- req :id => @post.id
- end
-
- assert_redirected_to posts_path
- end
- end
-end
View
0 spec/controll_app/vendor/assets/javascripts/.gitkeep
No changes.
View
0 spec/controll_app/vendor/assets/stylesheets/.gitkeep
No changes.
View
0 spec/controll_app/vendor/plugins/.gitkeep
No changes.

0 comments on commit 50f730f

Please sign in to comment.
Something went wrong with that request. Please try again.