Sha256: 7ae82a6f3967c3f45705dc140a63f6550897f7f3fb9fde0e287c02346fd6487e

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

require 'spec_helper'
require 'source_position'

class Dummy
  def self.foobar
    puts '42'
  end

  def test
    :testing
  end
end

describe SourcePosition do
  subject { Dummy.method(:foobar) }

  its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:5"}

  context 'source_location returns nil value' do
    subject { Object.method(:to_s) }
    its(:source_position) { should eq nil }
  end

  describe 'Method' do
    subject { Dummy.method(:foobar) }
    its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:5"}
  end

  describe 'UnboundMethod' do
    subject { Dummy.instance_method(:test) }
    its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:9"}
  end

  describe 'Proc' do
    subject { Proc.new{} }
    its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:35"}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
source_position-0.0.3 spec/source_position_spec.rb