Skip to content

Commit

Permalink
add Module#require
Browse files Browse the repository at this point in the history
  • Loading branch information
vito committed Apr 4, 2013
1 parent 697f607 commit 151ee98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/atomy/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions spec/atomy/module_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "spec_helper"

require "atomy/bootstrap"
require "atomy/codeloader"
require "atomy/module"
require "atomy/pattern/message"
require "atomy/pattern/equality"
Expand Down Expand Up @@ -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.