Skip to content

Commit

Permalink
Add spec for resolving Autoload with a Ruby object
Browse files Browse the repository at this point in the history
  • Loading branch information
dbussink committed Oct 1, 2012
1 parent f4c3856 commit 13d4f49
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/ruby/optional/capi/ext/module_under_autoload_spec.c
Expand Up @@ -3,4 +3,5 @@
void Init_module_under_autoload_spec(void) {
VALUE specs = rb_const_get(rb_cObject, rb_intern("CApiModuleSpecs"));
rb_define_module_under(specs, "ModuleUnderAutoload");
rb_define_module_under(specs, "RubyUnderAutoload");
}
3 changes: 3 additions & 0 deletions spec/ruby/optional/capi/fixtures/module.rb
Expand Up @@ -16,5 +16,8 @@ module M

class Super
end

autoload :ModuleUnderAutoload, "#{extension_path}/module_under_autoload_spec"
autoload :RubyUnderAutoload, File.expand_path('../module_autoload', __FILE__)

end
8 changes: 7 additions & 1 deletion spec/ruby/optional/capi/module_spec.rb
Expand Up @@ -40,11 +40,17 @@
mod.name.should == "CApiModuleSpecs::ModuleSpecsModuleUnder2"
end

it "defines a module for an existing Autoload" do
it "defines a module for an existing Autoload with an extension" do
compile_extension("module_under_autoload")

CApiModuleSpecs::ModuleUnderAutoload.name.should == "CApiModuleSpecs::ModuleUnderAutoload"
end

it "defines a module for an existing Autoload with a ruby object" do
compile_extension("module_under_autoload")

CApiModuleSpecs::RubyUnderAutoload.name.should == "CApiModuleSpecs::RubyUnderAutoload"
end
end

describe "rb_define_const given a String name and a value" do
Expand Down

0 comments on commit 13d4f49

Please sign in to comment.