Permalink
Browse files

add Module#require

  • Loading branch information...
1 parent 697f607 commit 151ee982e1c91c32ce3786b1059719f3cd37d850 @vito committed Apr 4, 2013
Showing with 12 additions and 0 deletions.
  1. +4 −0 lib/atomy/module.rb
  2. +8 −0 spec/atomy/module_spec.rb
View
@@ -38,6 +38,10 @@ def evaluate(node, binding = nil)
block.call
end
+ def require(path)
+ Atomy::CodeLoader.require(path)
+ end
+
def use(mod)
extend mod
include mod
@@ -1,6 +1,7 @@
require "spec_helper"
require "atomy/bootstrap"
+require "atomy/codeloader"
require "atomy/module"
require "atomy/pattern/message"
require "atomy/pattern/equality"
@@ -336,4 +337,11 @@ def expand(node)
its(:locals) { should == [].to_tuple }
end
end
+
+ describe "#require" do
+ it "invokes CodeLoader.require" do
+ Atomy::CodeLoader.should_receive(:require).with("foo/bar/baz")
+ subject.require("foo/bar/baz")
+ end
+ end
end

0 comments on commit 151ee98

Please sign in to comment.