Sha256: d67d9e7753b16af87bf6d7b8db28e8933c9dc4d9f53b463205aea0c331276a81
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
# encoding: utf-8 require 'spec_helper' require File.expand_path('../fixtures/classes', __FILE__) describe Aliasable, '#inheritable_alias' do subject { object.inheritable_alias(aliases) } let(:aliases) { { :other => :test } } let(:object) { Class.new(AliasableSpecs::Object) } let(:aliasable) { object.new } it_should_behave_like 'a command method' it 'creates a method #other' do expect { subject }.to change { aliasable.respond_to?(:other) }. from(false). to(true) end it 'aliases #other to #test' do subject retval = mock('Return Value') aliasable.should_receive(:test).and_return(retval) aliasable.other.should equal(retval) end specification = proc do object.class_eval do def test caller end end subject file, line = aliasable.other.first.split(':')[0, 2] File.expand_path(file).should eql(File.expand_path('../../../../../lib/axiom/support/aliasable.rb', __FILE__)) line.to_i.should be(38) end it 'sets the file and line number properly' do if RUBY_PLATFORM.include?('java') pending('Kernel#caller returns the incorrect line number in JRuby', &specification) else instance_eval(&specification) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | spec/unit/axiom/aliasable/inheritable_alias_spec.rb |