spec/sugar-high/alias_spec.rb in sugar-high-0.1.1 vs spec/sugar-high/alias_spec.rb in sugar-high-0.1.2

- old
+ new

@@ -8,27 +8,43 @@ require 'spec_helper' require 'sugar-high/alias' class Abc def hello_kristian + 'hello' + end + multi_alias :_after_ => :kristian, :hello => :howdy +end + +class Xyz + def hello_kristian 'hi' end - multi_alias :kristian, :hello => :howdy, :options => :after + + multi_alias :kristian, :hello => :alloha +end + +class Ged + def kristian_hello + 'hejsa' + end + + multi_alias :_before_ => :kristian, :hello => :hejsa end describe "SugarHigh" do - describe "Arguments" do - before do - @obj = Abc.new - end - - context 'Aliased :hello_kristian with :howdy_kristian ' do + describe "Arguments" do + context 'hould alias :hello_kristian with :howdy_kristian ' do it "should find alias" do - @obj.respond_to?(:howdy_kristian).should be_true + Abc.new.respond_to?(:howdy_kristian).should be_true end - it "should find all methods saying 'hi' to kristian" do - Abc.new.get_methods(:all).sort.grep(/(.*)_kristian$/).should have(2).items + it "should find -alloha alias method for kristian" do + Xyz.new.respond_to?(:alloha_kristian).should be_true + end + + it "should find -hejsa alias method for kristian" do + Ged.new.respond_to?(:kristian_hejsa).should be_true end end end end