Sha256: 47acbff3b336a38cffb5df8e541d59fe344fa4e18636b3b5550962c954036561

Contents?: true

Size: 913 Bytes

Versions: 2

Compression:

Stored size: 913 Bytes

Contents

# multi_alias name, :create => :new, :insert_into => [:inject_into, :update], :read => :X_content
#                   :options => :after  
# 
# create_xxx becomes new_xxx
# insert_into_xxx becomes inject_into_xxx and update_xxx
# read_xxx becomes xxx_content (overriding default :after action to insert at the X)

require 'spec_helper'
require 'sugar-high/alias'

class Abc
  def hello_kristian
    'hi'
  end
  multi_alias :kristian, :hello => :howdy, :options => :after
end  

describe "SugarHigh" do
  describe "Arguments" do
    before do
      @obj = Abc.new
    end
    
    context 'Aliased :hello_kristian with :howdy_kristian ' do
      it "should find alias" do
        @obj.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
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sugar-high-0.1.1 spec/sugar-high/alias_spec.rb
sugar-high-0.1.0 spec/sugar-high/alias_spec.rb