summaryrefslogtreecommitdiff
path: root/spec/hashie/utils_spec.rb
blob: c6be23b1d4eafae9ea59e05b417ebb36ef8fdd40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'spec_helper'

def a_method_to_match_against
  'Hello world!'
end

RSpec.describe Hashie::Utils do
  describe '.method_information' do
    it 'states the module or class that a native method was defined in' do
      bound_method = method(:object_id)

      message = Hashie::Utils.method_information(bound_method)

      expect(message).to match('Kernel')
    end

    it 'states the line a Ruby method was defined at' do
      bound_method = method(:a_method_to_match_against)

      message = Hashie::Utils.method_information(bound_method)

      expect(message).to match('spec/hashie/utils_spec.rb')
    end
  end
end