-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
started working on unmanaged extensions
- Loading branch information
1 parent
210f494
commit e94ea2e
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Neography | ||
class Rest | ||
class Extensions | ||
include Neography::Rest::Helpers | ||
|
||
def initialize(connection) | ||
@connection = connection | ||
end | ||
|
||
def get(path) | ||
@connection.get(path) | ||
end | ||
|
||
def post(path, body = {}) | ||
options = { | ||
:body => body.to_json, | ||
:headers => json_content_type.merge({'Accept' => 'application/json;stream=true'}) | ||
} | ||
|
||
@connection.post(path, options) | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'spec_helper' | ||
|
||
module Neography | ||
class Rest | ||
describe Extensions do | ||
|
||
let(:connection) { stub } | ||
subject { Extensions.new(connection) } | ||
|
||
it "executes an extensions get query" do | ||
path = "/unmanaged_extension/test" | ||
|
||
connection.should_receive(:get).with(path) | ||
subject.get("/unmanaged_extension/test") | ||
end | ||
|
||
it "executes an extensions post query" do | ||
path = "/unmanaged_extension/test" | ||
options = { | ||
:body=>"{\"foo\":\"bar\",\"baz\":\"qux\"}", | ||
:headers=>{"Content-Type"=>"application/json", "Accept"=>"application/json;stream=true"} | ||
} | ||
connection.should_receive(:post).with(path, options) | ||
subject.post("/unmanaged_extension/test", { :foo => "bar", :baz => "qux" }) | ||
end | ||
|
||
end | ||
end | ||
end |
e94ea2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff, Max!