Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/libv8/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class System < Location
def configure(context = MkmfContext.new)
context.send(:dir_config, 'v8')
context.send(:find_header, 'v8.h') or fail NotFoundError
context.send(:have_library, 'v8') or fail NotFoundError
end

class NotFoundError < StandardError
Expand Down
12 changes: 12 additions & 0 deletions spec/location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,28 @@
describe "configuring a compliation context with it" do
before do
@context.stub(:find_header) {true}
@context.stub(:have_library) {true}
@location.configure @context
end
it "adds the include path to the front of the include flags" do
@context.should have_received(:dir_config).with('v8').at_least(:once)
@context.should have_received(:find_header).with('v8.h').at_least(:once)
@context.should have_received(:have_library).with('v8').at_least(:once)
end
end
describe "when the v8 library cannot be found" do
before do
@context.stub(:find_header) {true}
@context.stub(:have_library) {false}
end
it "raises a NotFoundError" do
expect {@location.configure @context}.to raise_error Libv8::Location::System::NotFoundError
end
end
describe "when the v8.h header cannot be found" do
before do
@context.stub(:find_header) {false}
@context.stub(:have_library) {true}
end
it "raises a NotFoundError" do
expect {@location.configure @context}.to raise_error Libv8::Location::System::NotFoundError
Expand Down