Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

maps works

  • Loading branch information...
commit 42efdcfd338e131de300554132c7bb2e41c6ab0a 1 parent 566cb65
@kristianmandrup authored
View
12 lib/controll/enabler/path_handler.rb
@@ -6,12 +6,6 @@ def initialize controller, type
@controller, @type = [controller, type]
end
- def map
- @map ||= controller.class.send("#{type}_map")
- end
-
- alias_method :control_action, :type
-
def self.renderer controller, map
self.new controller, map, :render
end
@@ -28,6 +22,12 @@ def execute *args
protected
+ def map
+ @map ||= controller.class.send("#{type}_map")
+ end
+
+ alias_method :control_action, :type
+
def handle_path
controller.send control_action, path, options
end
View
15 spec/controll/enabler/maps_spec.rb
@@ -1,6 +1,13 @@
+require 'spec_helper'
+
+class MySweetController
+ include Controll::Enabler::Maps
+end
+
describe Controll::Enabler::Maps do
subject { controller.new }
- let(:controller) { MyController }
+
+ let(:controller) { MySweetController }
describe '.redirect_map {}' do
before :all do
@@ -14,9 +21,11 @@
describe '.render_map {}' do
before :all do
- controller.render_map :index => %w{alpha beta}
+ controller.render_map :index => %w{alpha zeta}
end
- its(:render_paths) { should == {:index => ['alpha', 'beta'] } }
+ specify do
+ controller.render_map.should == {:index => ['alpha', 'zeta'] }
+ end
end
end
View
3  spec/controll/enabler/path_handler_spec.rb
@@ -19,5 +19,6 @@ def render path
let(:controller) { MySweetController.new }
- describe '.path_for action' do
+ describe '.execute *args' do
+ end
end

0 comments on commit 42efdcf

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