Sha256: 25fcc843eaa689a6a48d5711520e8e0c311195bc5b6ce631b416e32d8a45e421

Contents?: true

Size: 878 Bytes

Versions: 4

Compression:

Stored size: 878 Bytes

Contents

require "spec_helper"

describe RSpec::Matchers, "alias_from" do
  subject { Comment.new }

  describe '#alias_from' do
    it 'handles :alias_method' do
      subject.should alias_from(:parent).to(:ancestor)
    end

    it 'handles method definition' do
      subject.should alias_from(:parent).to(:level_up)
    end

    it 'handles alias receiver with modification' do
      lambda {
        subject.should alias_from(:parent).to(:inspected_parent)
      }.should(
        raise_error(
          RSpec::Expectations::ExpectationNotMetError,
          /alias #parent to #inspected_parent/
        )
      )
    end

    it 'handles missing method' do
      lambda {
        subject.should alias_from(:parent).to(:obviously_missing)
      }.should(
        raise_error(
          NameError,
          /undefined method `obviously_missing'/
        )
      )
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ndlib-on-rspec-0.0.4 spec/ndlib-on-rspec/alias_from_matcher_spec.rb
ndlib-on-rspec-0.0.3 spec/ndlib-on-rspec/alias_from_matcher_spec.rb
ndlib-on-rspec-0.0.2 spec/ndlib-on-rspec/alias_from_matcher_spec.rb
ndlib-on-rspec-0.0.1 spec/ndlib-on-rspec/alias_from_matcher_spec.rb