Sha256: 361fa7be73c5eec854e552cd5ffab088ee51d5437b79f212eefc2e1eb9745652
Contents?: true
Size: 1.87 KB
Versions: 3
Compression:
Stored size: 1.87 KB
Contents
require 'spec_helper' class MySweetController include Controll::Enabler def fallback_path 'root' end def away 'away' end def perfect 'perfect' end end ActionMapper = Controll::Flow::ActionMapper Action = Controll::Flow::Action class Redirecter < ActionMapper::Complex event_map 'inperfect' => [:cool, :sweet], 'away' => [:success] end class Renderer < ActionMapper::Simple events %w{perfect} end describe Controll::Enabler::PathResolver do def notice name Hashie::Mash.new(name: name.to_sym, type: :notice) end def error name Hashie::Mash.new(name: name.to_sym, type: :error) end let(:controller) { MySweetController.new } let(:render_map) { {'perfect' => [:cool, :sweet], 'home' => [:success] }} let(:redirect_map) { {'inperfect' => [:cool, :sweet], 'away' => [:success] } } let(:fallback_action) { Action::Fallback.new controller } context 'initialize controller, render_map' do subject { Controll::Enabler::PathResolver.new controller, render_map } its(:caller) { should == controller } its(:controller) { should == controller } its(:event_map) { should == render_map } describe '.resolve' do specify do subject.resolve.should == 'home' end describe '.resolve :cool' do specify do subject.resolve(:cool).should == 'perfect' end end describe '.resolve sweet' do specify do subject.resolve(:sweet).should == 'perfect' end end describe '.resolve :uncool' do specify do subject.resolve(:uncool).should_not == 'perfect' end specify do subject.resolve(:uncool).should == nil end end describe '.resolve Fallback Action' do specify do subject.resolve(fallback_action).should == nil end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
controll-0.3.2 | spec/controll/enabler/path_resolver_spec.rb |
controll-0.3.1 | spec/controll/enabler/path_resolver_spec.rb |
controll-0.3.0 | spec/controll/enabler/path_resolver_spec.rb |