summaryrefslogtreecommitdiff
path: root/spec/ruby/core/kernel/__dir___spec.rb
blob: 25df92a15d2f523e2298a2462fce1cb99ae2d5a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require_relative '../../spec_helper'

describe "Kernel#__dir__" do
  it "returns the real name of the directory containing the currently-executing file" do
    __dir__.should == File.realpath(File.dirname(__FILE__))
  end

  context "when used in eval with top level binding" do
    it "returns the real name of the directory containing the currently-executing file" do
      eval("__dir__", binding).should == File.realpath(File.dirname(__FILE__))
    end
  end
end